cortex-lab / Suite2P

Tools for processing 2P recordings
Other
120 stars 65 forks source link

Option to turn off baseline estimation and detrending? #151

Open naomicxia opened 5 years ago

naomicxia commented 5 years ago

Is it possible to have an option where I can turn off the detrending, for example if I have known period of 'baseline' vs 'task epochs' and so that I am able to do custom baseline subtraction downstream of suite2p? What happens right now is that the suite2p detrending is so good that many time points are ~0. Thank you for your hard work on making this pipeline work for so many people!

marius10p commented 5 years ago

Are you working with the raw fluorescence or the spike deconvolved data? Baseline subtraction is only done prior to spike deconvolution (and never saved). If you would like the raw fluorescence output, it's in Fcell. You need to manually subtract off the neuropil FcellNeu, with either a fixed coefficient (say 0.7) or the coefficient estimated by Suite2p together with the deconvolution (in stat.neuropilCoefficient).

naomicxia commented 5 years ago

Hi Marius, I'm working with the raw fluorescence and I'm using OASIS as deconvolution. My raw traces have extremely low baseline (most values are 0) and that is why I wondered if there is already a baseline subtraction step in the pipeline. I added the fix mentioned in (https://github.com/cortex-lab/Suite2P/issues/149) but results were identical and I still have low baseline in the Fcell as well as Fcell-c*FcellNeu output.

marius10p commented 5 years ago

GCaMP expression in most cells has very low baselines, so they can have high SNR. As such, the baseline can sometimes be noisily estimated as 0, or below 0 and clipped to 0. We don't typically compute dF/F because of this.