Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding DF/F #248

Open
bahaaaldin214 opened this issue Jul 6, 2023 · 2 comments
Open

Finding DF/F #248

bahaaaldin214 opened this issue Jul 6, 2023 · 2 comments

Comments

@bahaaaldin214
Copy link

Hello,
I am using the Minian pipeline Jupyter notebook. I was able to extract the data and save it into an .NC file for further analysis through python. I was then able to read that data with no issues. I saved the variables [A, C, S], from what I read, my understanding is those variables correspond to (correct me if im wrong)

A: 3d matrix with [height, width and unit id]
C: calcium concentration array
S: spike firing rate

I managed to iterate through the C and S variables with ease to graph each cell I wanted using the matplotlib library in python, but I was stuck on my next step.

My next step is to extract the calcium transients of each cell. As I have read in this article: Minian, an open-source miniscope analysis pipeline | eLife (elifesciences.org) or (https://elifesciences.org/articles/70661) They were able to use the CNMF-E toolbox to do this; however, this toolbox didn't seem to be well documented and I wasn't able to replicate the results. Here is a link to the CNMF-E toolbox that extracts the DF_F:
https://github.com/zhoupc/CNMF_E/blob/master/ca_source_extraction/utilities/extract_DF_F.m

I am looking for some guidance on how I should approach this problem; if you could, you can reply to this email or reach me at my contact information below. I also Cc the researcher I am working under.

@EricThomson
Copy link

EricThomson commented Jan 16, 2024

Caiman maintainer here -- that is some really old unsupported matlab code you referenced for extracting DFF: the more up-to-date Python code is here:

detrend_df_f()

Unfortunately we don't do an amazing job describing/documenting DF/F and this is something I'd really like to improve.

The traditional measure of dff is just dff(t) = (F(t)-F0)/F0, where F0 is baseline activity. In the early days, F0 was activity during some initial stretch of recording when the brain "wasn't doing anything" (e.g., for retinal ganglion cells, think of animal sitting in dark before the stimulus is presented). This is fine in some limited contexts, but is problematic for many systems, so is now measured using different methods. E.g., overall mean, moving average, moving percentile. The latter is the most popular now, and is (almost) what we do in Caiman, and you can do it with your own data. (We have an additional term in the denominator in Caiman based on background activity, but I think it can often usually safely be ignored).

@gadsfly
Copy link

gadsfly commented May 23, 2024

checkout this: flatironinstitute/CaImAn#1285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants