kushalkolar / serenity

Realtime analysis & visualization of calcium imaging data
GNU General Public License v3.0
1 stars 0 forks source link

Data model for downstream analysis #11

Open kushalkolar opened 1 year ago

kushalkolar commented 1 year ago

Create a data model abstraction to deal with categorical segments of time series data. Indexing is annoying with all the various time segments. Something like this would be nice:

# returns list of arrays, each array corresponds to a trial period. 
calcium[:, exp.segments.trial]

calcium[:, exp.labels.ethogram.chew[True] + pint.parse("3 ms")]

# inter trial interval
calcium[:, ~exp.segmemts.trial]

# each frame can have categorical labels such as the trial index. Need to decide how to count post trial intervals, make just could it as part of the previous trial for this index 
calcium[:, exp.segments.trial] / calcium[:, exp.segments.pre_trial].mean(groupby=exp.labels.trial_ix)

# indexing cells 
calcium[pc_dim2_weights > 2, exp.labels.ethogram.chew[True] + pint.parse("3 ms")] 
kushalkolar commented 1 year ago

Some of this should be possible using pandas by putting every timepoint as a row, but it's probably not enough for what we need.