denisecailab / ezTrack

Free, platform independent, behavior tracking software.
GNU General Public License v3.0
118 stars 41 forks source link

Reanalyzing motion data for freezing? #3

Closed MicTott closed 5 years ago

MicTott commented 5 years ago

Are there functions for reanalyzing the motion data for freezing using a different threshold without having to reanalyze the entire video files? I may have missed it, but I looked through your code and paper but didn't see anything about this.

My current problem is that I am trying find an optimal threshold for calculating freezing by comparing the output percentages by ezTrack to our current freezing system, but this will take way too long if I have to reprocess my video files every single time I want to tweak the threshold (I'm working with 45 min videos which are taking roughly 2 hours each to process). Instead, it would be nice if I only have to process the videos once and then be able to take the raw "motion" values from the FreezingOutput.csv and simply reanalyze those with a new threshold (which should only take seconds instead of hours).

I know that you currently have the "Individual" Jupyter notebook for optimizing parameters, but essentially it seems to make sense to me that steps 5 and 7 from this notebook should be able to be easily computed without actually reanalyzing the video files. I'm likely going to write my own code for this at the moment to save me a headache, but I think this would be a very useful tool for you guys to add for others in the future.

ZachPenn commented 5 years ago

Once motion is calculated you can run step 5 again and again with as many thresholds as you'd like, without re-analyzing motion, provided you haven't reset the kernel. Alternatively, look into using Pandas to read FreezingOuput.csv back as a Pandas DataFrame (pandas.read_csv) (if you are returning to the same data set after some time) and then pass the Motion column into fz.MeasureFreezing in 5b e.g.(mydata['Motion'] instead of 'Motion'). Note that you'll also have to change Motion to mydata['Motion'] under the call to fz.SaveData in 5b.