Skip to content

Monika user detection#1

Open
monikascholz wants to merge 26 commits intomonikascholz:masterfrom
leiferlab:monika_user_detection
Open

Monika user detection#1
monikascholz wants to merge 26 commits intomonikascholz:masterfrom
leiferlab:monika_user_detection

Conversation

@monikascholz
Copy link
Owner

No description provided.

aleifer and others added 26 commits July 10, 2019 11:54
I'm a little dissapointed to see that in the newly regenerated Fig 2 I
get an R^2 of .44 instead of the expected .49. Not sure whats going on
here because as far as I can tell this should be the code exaclty as
Monika had left it, with only superficial changes such as
wrapping things in a function and pointing to the correct filenams.

But its pretty close.
I plan to use this as a jumping off point to reimpement the minumum
changes I want to change how e do normalizaiton, interpolation and smoothing.
and some of the other analyses that I don't think are particularly
relevant..
I've added the photobleachign correction code. I am photobleaching
following the logic outlined in Xiaowen Chen's Phys Rev E paper 2019.
This is slightly different then what Jeff did in the 3dBrain MATLAB code.
In that code he fit the exponential and then subtracted it off. Here I
divide it off, but rescale the trace to match the original.

Note: in its current state, the pipeline is not utilizing the
photocorrected traces, but now at least I have the machinery to create
it.
Now I can run the analysis all the way through and generate fig 2.
Performance however is extremely low, probably because by using the raw
traces I am skipping over some outlier removal that Jeff must have been
taking care of.

Also turned of the PCARaw analysis which seems to be unused and was
throwing an error.
added a nanoutliers funciotn that uses a modified hampel filter to
replace 3sigma outliers in a specificed framewindow size (here 3.3s, or
20 volumes) with NaNs.

The functions run without error. but i haven't fully tested the results.

Note that the function is super slow and seems to seriously slow down
the analysis.
…tion

Code should be  functionally the same as the state Monika left it for the
latest manuscript.

Note fig 2v3 still generates 0.44 R2 instaed of 0.49 as expected
(but still consistent with how I recieved the code in early june).
Made minimum changes necessary to run metaRunAnalysis and regenerate
the analysis for AML32 moving. And also to run dataQualityCheck.

Code should otherwise be as Monika left it in June.
Visually inspected the output on real data. Looks good.

I added some visualization stuff.
Previously the photobleaching correction was failing by producing
traces that blew up towards the latter half of the trace.

The bug was an algebra error. To fit the exponent, at Francesco's
suggestion, I rescaled the origional traces so that it was on the range
of zero to one. This dramatically improves fitting performance and
efficiency. So then I had to rescale the fitting parameters back.

Previously I had been only scaling the a scaler in y=a exp(-bx)+ c.
But of course c had been scaled to. So now I also rescale c. And that
fixes everything.

ADDITONAL:
fixed a bug about using max instead of nanmax in the fitting routines.
moving photobleaching correiton and outlier detectiong and naning
from Jeff's matlab code to python appears to decrease velocity
decoding performance of our marquee dataset in fig 2v3. (but strangely
decoding performance of turning is preserved).

In previous commits, photobleaching correciton had been done according
to Xiaowen's method in the Phys Rev E paper (division not subtraction).

Visual inspection shows no obvious difference between the old matlab
based photoblecahign correciotn and the new division approach in python.
If anything, the new approach does a better job preserving variance
across time.

Remains unresolved why performance suffers.

One hypothesis: maybe I am currently being less agressive about nan'ing
entire columns then Jeff's matlab pipeline? Need to check.
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

Successfully merging this pull request may close these issues.

2 participants