MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
349 stars 241 forks source link

calculating dF/F0 #598

Open charlesphi opened 3 years ago

charlesphi commented 3 years ago

Good Evening,

First, Thank you very much for this great tool!

I have recently started to use Suite2p and I am still learning and I am very unexperimented in coding. I am wondering what would be the easiest way to change the raw fluorescence signal into delta F/F0.

Also, I am not sure why I am not seeing the new "report_time: " in the GUI.

Best regards

carsen-stringer commented 3 years ago

no we don't, calculating dF/F0 is tricky and the estimate can vary a lot depending on how you choose to do it. I will add the enhancement label as something to add in the future to suite2p

carsen-stringer commented 3 years ago

we do have a step in suite2p for additive baseline correction which we run before deconvolution. we don't save this intermediate baseline-corrected trace but you can get it by running the following:

import numpy as np
from suite2p.extraction import dcnv
F = np.load('F.npy')
Fneu = np.load('Fneu.npy')
ops = np.load('ops.npy', allow_pickle=True).item()
dF = F.copy() - 0.7*Fneu
dF = dcnv.preprocess(dF, ops['baseline'], ops['win_baseline'], 
                                   ops['sig_baseline'], ops['fs'], ops['prctile_baseline'])
frederikrogge commented 2 years ago

Hey, I have a question regarding this.

So from here I see that you first subtract the neuropil and then again subtract some baseline of the signal. I saw that the same is done before deconvolution.

What's F0 then in this example? If I were to calculate dF/F0, what would I use for F0?

Thank you very much in advance!

amena1201 commented 3 months ago

does the deconvolved trace depend on a fluorescence correction (using deltaF/Fo)? How might someone go about calculating delta F/Fo of the corrected F to then calculate the deconvolution?

Thanks