Skip to content

Latest commit

 

History

History
319 lines (156 loc) · 14.9 KB

caiman_parameters.md

File metadata and controls

319 lines (156 loc) · 14.9 KB

DATA PARAMETERS (CNMFParams.data)

  • fnames: list[str] - list of complete paths to files that need to be processed

  • dims: (int, int), default: computed from fnames - dimensions of the FOV in pixels

  • fr: float, default: 30 - imaging rate in frames per second

  • decay_time: float, default: 0.4 - length of typical transient in seconds

  • dxy: (float, float) - spatial resolution of FOV in pixels per um

  • var_name_hdf5: str, default: 'mov' - if loading from hdf5 name of the variable to load

  • caiman_version: str - version of CaImAn being used

  • last_commit: str - hash of last commit in the caiman repo

  • mmap_F: list[str] - paths to F-order memory mapped files after motion correction

  • mmap_C: str - path to C-order memory mapped file after motion correction

PATCH PARAMS (CNMFParams.patch)

  • rf: int or list or None, default: None - Half-size of patch in pixels. If None, no patches are constructed and the whole FOV is processed jointly. If list, it should be a list of two elements corresponding to the height and width of patches

  • stride: int or None, default: None - Overlap between neighboring patches in pixels.

  • nb_patch: int, default: 1 - Number of (local) background components per patch

  • border_pix: int, default: 0 - Number of pixels to exclude around each border.

  • low_rank_background: bool, default: True - Whether to update the background using a low rank approximation. If False all the nonzero elements of the background components are updated using hals (to be used with one background per patch)

  • del_duplicates: bool, default: False - Delete duplicate components in the overlaping regions between neighboring patches. If False, then merging is used.

  • only_init: bool, default: True - whether to run only the initialization

  • p_patch: int, default: 0 - order of AR dynamics when processing within a patch

  • skip_refinement: bool, default: False - Whether to skip refinement of components (deprecated?)

  • remove_very_bad_comps: bool, default: True - Whether to remove (very) bad quality components during patch processing

  • p_ssub: float, default: 2 - Spatial downsampling factor

  • p_tsub: float, default: 2 - Temporal downsampling factor

  • memory_fact: float, default: 1 - unitless number for increasing the amount of available memory

  • n_processes: int - Number of processes used for processing patches in parallel

  • in_memory: bool, default: True - Whether to load patches in memory

PRE-PROCESS PARAMS (CNMFParams.preprocess)

  • sn: np.array or None, default: None - noise level for each pixel

  • noise_range: [float, float], default: [.25, .5] - range of normalized frequencies over which to compute the PSD for noise determination

  • noise_method: 'mean'|'median'|'logmexp', default: 'mean' - PSD averaging method for computing the noise std

  • max_num_samples_fft: int, default: 3*1024 - Chunk size for computing the PSD of the data (for memory considerations)

  • n_pixels_per_process: int, default: 1000 - Number of pixels to be allocated to each process

  • compute_g': bool, default: False - whether to estimate global time constant

  • p: int, default: 2 - order of AR indicator dynamics

  • lags: int, default: 5 - number of lags to be considered for time constant estimation

  • include_noise: bool, default: False - flag for using noise values when estimating g

  • pixels: list, default: None - pixels to be excluded due to saturation

  • check_nan: bool, default: True - whether to check for NaNs

INIT PARAMS (CNMFParams.init)

  • K: int, default: 30 - number of components to be found (per patch or whole FOV depending on whether rf=None)

  • SC_kernel: {'heat', 'cos', binary'}, default: 'heat' - kernel for graph affinity matrix

  • SC_sigma: float, default: 1 - variance for SC kernel

  • SC_thr: float, default: 0, - threshold for affinity matrix

  • SC_normalize: bool, default: True - standardize entries prior to computing the affinity matrix

  • SC_use_NN: bool, default: False - sparsify affinity matrix by using only nearest neighbors

  • SC_nnn: int, default: 20 - number of nearest neighbors to use

  • gSig: [int, int], default: [5, 5] - radius of average neurons (in pixels)

  • gSiz: [int, int], default: [int(round((x * 2) + 1)) for x in gSig], - half-size of bounding box for each neuron

  • center_psf: bool, default: False - whether to use 1p data processing mode. Set to true for 1p

  • ssub: float, default: 2 - spatial downsampling factor

  • tsub: float, default: 2 - temporal downsampling factor

  • nb: int, default: 1 - number of background components

  • lambda_gnmf: float, default: 1. - regularization weight for graph NMF

  • maxIter: int, default: 5 - number of HALS iterations during initialization

  • method_init: 'greedy_roi'|'corr_pnr'|'sparse_NMF'|'local_NMF' default: 'greedy_roi' - initialization method. use 'corr_pnr' for 1p processing and 'sparse_NMF' for dendritic processing.

  • min_corr: float, default: 0.85 - minimum value of correlation image for determining a candidate component during corr_pnr

  • min_pnr: float, default: 20 - minimum value of psnr image for determining a candidate component during corr_pnr

  • seed_method: str {'auto', 'manual', 'semi'} - methods for choosing seed pixels during greedy_roi or corr_pnr initialization 'semi' detects nr components automatically and allows to add more manually if running as notebook 'semi' and 'manual' require a backend that does not inline figures, e.g. %matplotlib tk

  • ring_size_factor: float, default: 1.5 - radius of ring (*gSig) for computing background during corr_pnr

  • ssub_B: float, default: 2 - downsampling factor for background during corr_pnr

  • init_iter: int, default: 2 - number of iterations during corr_pnr (1p) initialization

  • nIter: int, default: 5 - number of rank-1 refinement iterations during greedy_roi initialization

  • rolling_sum: bool, default: True - use rolling sum (as opposed to full sum) for determining candidate centroids during greedy_roi

  • rolling_length: int, default: 100 - width of rolling window for rolling sum option

  • kernel: np.array or None, default: None - user specified template for greedyROI

  • max_iter_snmf : int, default: 500 - maximum number of iterations for sparse NMF initialization

  • alpha_snmf: float, default: 100 - sparse NMF sparsity regularization weight

  • sigma_smooth_snmf : (float, float, float), default: (.5,.5,.5) - std of Gaussian kernel for smoothing data in sparse_NMF

  • perc_baseline_snmf: float, default: 20 - percentile to be removed from the data in sparse_NMF prior to decomposition

  • normalize_init: bool, default: True - whether to equalize the movies during initialization

  • options_local_NMF: dict - dictionary with parameters to pass to local_NMF initializer

SPATIAL PARAMS (CNMFParams.spatial)

  • method_exp: 'dilate'|'ellipse', default: 'dilate' - method for expanding footprint of spatial components

  • dist: float, default: 3 - expansion factor of ellipse

  • expandCore: morphological element, default: None(?) - morphological element for expanding footprints under dilate

  • nb: int, default: 1 - number of global background components

  • n_pixels_per_process: int, default: 1000 - number of pixels to be processed by each worker

  • thr_method: 'nrg'|'max', default: 'nrg' - thresholding method

  • maxthr: float, default: 0.1 - Max threshold

  • nrgthr: float, default: 0.9999 - Energy threshold

  • extract_cc: bool, default: True - whether to extract connected components during thresholding (might want to turn to False for dendritic imaging)

  • medw: (int, int) default: None - window of median filter (set to (3,)*len(dims) in cnmf.fit)

  • se: np.array or None, default: None - Morphological closing structuring element (set to np.ones((3,)*len(dims), dtype=np.uint8) in cnmf.fit)

  • ss: np.array or None, default: None - Binary element for determining connectivity (set to np.ones((3,)*len(dims), dtype=np.uint8) in cnmf.fit)

  • update_background_components: bool, default: True - whether to update the spatial background components

  • method_ls: 'lasso_lars'|'nnls_L0', default: 'lasso_lars' - 'nnls_L0'. Nonnegative least square with L0 penalty, 'lasso_lars' lasso lars function from scikit learn

  • block_size : int, default: 5000 - Number of pixels to process at the same time for dot product. Reduce if you face memory problems

  • num_blocks_per_run: int, default: 20 - Parallelization of A'*Y operation

  • normalize_yyt_one: bool, default: True - Whether to normalize the C and A matrices so that diag(C*C.T) = 1 during update spatial

TEMPORAL PARAMS (CNMFParams.temporal)

  • ITER: int, default: 2 - block coordinate descent iterations

  • method_deconvolution: 'oasis'|'cvxpy'|'oasis', default: 'oasis' - method for solving the constrained deconvolution problem ('oasis','cvx' or 'cvxpy') if method cvxpy, primary and secondary (if problem unfeasible for approx solution)

  • solvers: 'ECOS'|'SCS', default: ['ECOS', 'SCS'] - solvers to be used with cvxpy, can be 'ECOS','SCS' or 'CVXOPT'

  • p: 0|1|2, default: 2 - order of AR indicator dynamics

  • memory_efficient: False

  • bas_nonneg: bool, default: True - whether to set a non-negative baseline (otherwise b >= min(y))

  • noise_range: [float, float], default: [.25, .5] - range of normalized frequencies over which to compute the PSD for noise determination

  • noise_method: 'mean'|'median'|'logmexp', default: 'mean' - PSD averaging method for computing the noise std

  • lags: int, default: 5 - number of autocovariance lags to be considered for time constant estimation

  • optimize_g: bool, default: False - flag for optimizing time constants

  • fudge_factor: float (close but smaller than 1) default: .96 - bias correction factor for discrete time constants

  • nb: int, default: 1 - number of global background components

  • verbosity: bool, default: False - whether to be verbose

  • block_size : int, default: 5000 - Number of pixels to process at the same time for dot product. Reduce if you face memory problems

  • num_blocks_per_run: int, default: 20 - Parallelization of A'*Y operation

  • s_min: float or None, default: None - Minimum spike threshold amplitude (computed in the code if used).

MERGE PARAMS (CNMFParams.merge)

  • do_merge: bool, default: True - Whether or not to merge

  • thr: float, default: 0.8 - Trace correlation threshold for merging two components.

  • merge_parallel: bool, default: False - Perform merging in parallel

  • max_merge_area: int or None, default: None - maximum area (in pixels) of merged components, used to determine whether to merge components during fitting process

QUALITY EVALUATION PARAMETERS (CNMFParams.quality)

  • min_SNR: float, default: 2.5 - trace SNR threshold. Traces with SNR above this will get accepted

  • SNR_lowest: float, default: 0.5 - minimum required trace SNR. Traces with SNR below this will get rejected

  • rval_thr: float, default: 0.8 - space correlation threshold. Components with correlation higher than this will get accepted

  • rval_lowest: float, default: -1 - minimum required space correlation. Components with correlation below this will get rejected

  • use_cnn: bool, default: True - flag for using the CNN classifier.

  • min_cnn_thr: float, default: 0.9 - CNN classifier threshold. Components with score higher than this will get accepted

  • cnn_lowest: float, default: 0.1 - minimum required CNN threshold. Components with score lower than this will get rejected.

  • gSig_range: list or integers, default: None - gSig scale values for CNN classifier. In not None, multiple values are tested in the CNN classifier.

MOTION CORRECTION PARAMETERS (CNMFParams.motion)

  • border_nan: bool or str, default: 'copy' - flag for allowing NaN in the boundaries. True allows NaN, whereas 'copy' copies the value of the nearest data point.

  • gSig_filt: int or None, default: None - size of kernel for high pass spatial filtering in 1p data. If None no spatial filtering is performed

  • is3D: bool, default: False - flag for 3D recordings for motion correction

  • max_deviation_rigid: int, default: 3 - maximum deviation in pixels between rigid shifts and shifts of individual patches

  • max_shifts: (int, int), default: (6,6) - maximum shifts per dimension in pixels.

  • min_mov: float or None, default: None - minimum value of movie. If None it get computed.

  • niter_rig: int, default: 1 - number of iterations rigid motion correction.

  • nonneg_movie: bool, default: True - flag for producing a non-negative movie.

  • num_frames_split: int, default-: 80 - split movie every x frames for parallel processing

  • num_splits_to_process_els, default: [7, None]

  • num_splits_to_process_rig, default: None

  • overlaps: (int, int), default: (24, 24) - overlap between patches in pixels in pw-rigid motion correction.

  • pw_rigid: bool, default: False - flag for performing pw-rigid motion correction.

  • shifts_opencv: bool, default: True - flag for applying shifts using cubic interpolation (otherwise FFT)

  • splits_els: int, default: 14 - number of splits across time for pw-rigid registration

  • splits_rig: int, default: 14 - number of splits across time for rigid registration

  • strides: (int, int), default: (96, 96) - how often to start a new patch in pw-rigid registration. Size of each patch will be strides + overlaps

  • upsample_factor_grid" int, default: 4 - motion field upsampling factor during FFT shifts.

  • use_cuda: bool, default: False - flag for using a GPU.

  • indices: tuple(slice), default: (slice(None), slice(None)) - Use that to apply motion correction only on a part of the FOV

RING CNN PARAMETERS (CNMFParams.ring_CNN)

  • n_channels: int, default: 2 - Number of "ring" kernels

  • use_bias: bool, default: False - Flag for using bias in the convolutions

  • use_add: bool, default: False - Flag for using an additive layer

  • pct: float between 0 and 1, default: 0.01 - Quantile used during training with quantile loss function

  • patience: int, default: 3 - Number of epochs to wait before early stopping

  • max_epochs: int, default: 100 - Maximum number of epochs to be used during training

  • width: int, default: 5 - Width of "ring" kernel

  • loss_fn: str, default: 'pct' - Loss function specification ('pct' for quantile loss function, 'mse' for mean squared error)

  • lr: float, default: 1e-3 - (initial) learning rate

  • lr_scheduler: function, default: None - Learning rate scheduler function

  • path_to_model: str, default: None - Path to saved weights (if training then path to saved model weights)

  • remove_activity: bool, default: False - Flag for removing activity of last frame prior to background extraction

  • reuse_model: bool, default: False - Flag for reusing an already trained model (saved in path to model)