Skip to content
eftychios pnevmatikakis edited this page Oct 1, 2018 · 5 revisions

Motion Correction tips

  • Non-rigid motion correction is not always necessary. Sometimes, rigid motion correction will be sufficient and it will lead to significant performance gains in terms of speed. Check your data to before/after rigid motion correction to decide what is best for you. The boolean parameter params.motion.pw_rigid can be used to alternate between rigid and non-rigid motion correction using the same function MotionCorrect.motion_correct.

  • When using piecewise rigid motion correction, use parameters that physically make sense. For example, a typical patch size could be around 100um x 100um since motion can in many times be approximated as rigid for smaller patches (if the imaging is not too slow). Similarly, the maximum allowed shifts can in typical 2p recordings chosen to correspond to 10um. The patch size is given by the sum of the parameters params.motion.strides + params.motion.overlaps. The maximum shifts parameter is params.motion.max_shifts. These values corresponds to pixels so make sure you have a rough idea of the spatial resolution of your data. There is a parameter for that params.data.dxy.

  • Motion correction works in parallel by splitting each file in multiple chunks and processing them in parallel. Make sure that the length of each chunk is not too small by setting the parameter params.motion.num_frames_split.

CaImAn Online Processing tips

  • Important parameters for online processing are the CNN threshold value params.online.thresh_CNN_noisy, the trace SNR params.online.min_SNR and the number of candidate components to be considered at each timestep params.online.min_num_trial. Lower values for the thresholds (e.g., 1 for params.online.min_SNR and 0.5 for params.online.thresh_CNN_noisy) and/or higher values for params.online.min_num_trial (e.g., 10) can lead to higher recall values, although potentially at the expense of lower precision. In general they are preferable for datasets that are relatively short (e.g., 10000 frames or less). On the other hand, higher threshold values (e.g., 1.5 for params.online.min_SNR and 0.7 for params.online.thresh_CNN_noisy) and/or lower values for params.online.min_num_trial (e.g., 5) will lead to higher precision values, although potentially at the expense of lower recall. n general they are preferable for datasets that are longer (e.g., 10000 frames or more).

  • If your analysis setup allows it, multiple epochs over the data can be very beneficial, especially in the strict regime or high acceptance thresholds.

  • In general, bare initialization can be used most of the times, to capture the neuropil activity and a small number of neurons at an initial chunk. For a large FOV with lots of active neurons, e.g., a plane from a zebrafish dataset, bare initialization can be inadequate. In this case, a proper initialization with cnmf can lead to substantially better results.

  • Spatial downsampling can lead to significant speed gains, often at no expense in terms of accuracy. It can be set through the parameter ds_factor.

  • When using the CNN for screening candidate components, the usage of a GPU can lead to significant computational gainings.

CaImAn Batch processing tips

1p processing tips

Deconvolution tips

  • Simultaneous deconvolution and source extraction can mostly offer benefits in particularly low SNR data. In most cases, running source extraction without deconvolution (p=0), followed by deconvolution will be sufficient.

  • It is generally better to perform some sort of de-trending on the extracted calcium traces prior to deconvolution to correct for baseline drifts that can results in wrongfully deconvolved neural activity. You can use the estimates.detrend_df_f methods for that.

  • For interpreting the deconvolved neural activity varible S, see here.