AllenNeuralDynamics / aind-dynamic-foraging-data-utils

Tools for the analysis of behavior and neural data from the dynamic foraging task
MIT License
2 stars 0 forks source link

NWB to trials_table, and events table #1

Closed alexpiet closed 2 months ago

alexpiet commented 8 months ago

Is your feature request related to a problem? Please describe. NWB files will be generated for each session. We would like a standard way to extract two pandas dataframes

Describe the solution you'd like

irisstone commented 8 months ago

@hanhou is your nwb_to_df function a good place to start for getting a trials table? Does this match up with the trials table info you added in the planning document? Does it include all of the things that @ZhixiaoSu has listed in the bullet points of what the columns of her trial table includes, or are there other things that either of you think would be good to include?

Hoping to port something to this repo soon that includes all of the columns in a trial table that we need, and it seems like the easiest way might be easiest to modify that nwb_to_df function (if it needs modification).

hanhou commented 8 months ago

Does this match up with the trials table info you added in the planning document? Does it include all of the things that @ZhixiaoSu has listed in the bullet points of what the columns of her trial table includes, or are there other things that either of you think would be good to include?

Not really. My nwb_to_df function only extract session-level stats, not the trial table. To extract the trial table from nwb, see df_trials in this notebook. To extract the event table, see Behavioral events section of the same notebook.

Also, my code is still incomplete even for the session table, see my comments here.

hanhou commented 8 months ago

And if you're talking about creating the standardized util functions to parse the nwb files, it may be better to start from a clean repo. The nwb_to_df function you mentioned is a part of my temporary behavioral pipeline. Eventually what should happen is my repo calls functions from your standardized utils to fill in the tables.

irisstone commented 8 months ago

Thanks @hanhou, that's helpful! @alexpiet is there an interest in having a sessions table as part of this repo, as well? I could imagine wanting both for my purposes, and it might be easier to start with that and I could write a new function (borrowing from Han's nwb_to_df function what I can) and then extending it to include the additional things mentioned in Han's comments. And after that work on one for trials. Ultimately then this repo would have e.g. a nwb_to_df.py module with functions that return df_trials, df_events, and df_sessions, etc.

alexpiet commented 8 months ago

I think that would be in the scope of this issue https://github.com/AllenNeuralDynamics/dynamic-foraging-analysis/issues/6