AllenInstitute / AllenSDK

code for reading and processing Allen Institute for Brain Science data
https://allensdk.readthedocs.io/en/latest/
Other
344 stars 150 forks source link

add informative columns to VisualBehaviorOphysProjectCache experiments_table #2182

Closed matchings closed 3 years ago

matchings commented 3 years ago

Describe the use case that is addressed by this feature. Currently it is difficult to understand the relevant experimental conditions given the available metadata in the experiments_table. For example, to know whether a session is active behavior or passive viewing, or what image set was shown, users must parse the string in the 'session_type' column (ex: OPHYS_2_images_A_passive).

In addition, to know whether the stimulus shown was novel to the mouse or not, users must know that OPHYS_4 is intended to be the novel session, but given retakes it is not always novel, so they must also consider the prior_exposures_to_image_set column.

Describe the solution you'd like A few additional columns that make these conditions explicit would make understanding and parsing the dataset much easier. Code to create said columns exists in visual_behavior_analysis here:

https://github.com/AllenInstitute/visual_behavior_analysis/blob/master/visual_behavior/data_access/utilities.py#L1307 https://github.com/AllenInstitute/visual_behavior_analysis/blob/master/visual_behavior/data_access/utilities.py#L1344 https://github.com/AllenInstitute/visual_behavior_analysis/blob/master/visual_behavior/data_access/utilities.py#L1403

Additional context This will be needed for the SWDB course.

Describe alternatives you've considered If it is not possible to add these columns, we can provide separate functionality to add them, but that adds an unnecessary layer on top of the SDK.

djkapner commented 3 years ago

It appears that when serving up the ophys_experiment_table that there is already a placeholder for postprocess_additional() which seems like a good place to generate these extra columns.

danielsf commented 3 years ago

@matchings

This method

https://github.com/AllenInstitute/visual_behavior_analysis/blob/master/visual_behavior/data_access/utilities.py#L1403

sets image_type to the 16th character of session_type. Is there a sensible nonsense value I can put in just in case session_type ever gets assigned a value that is fewer than 16 characters long? Would 'N/A' be acceptable? I just don't want the method to fail because we change our convention for session_type sometime in the future.

matchings commented 3 years ago

@danielsf sure, 'N/A' would be fine.

I don't anticipate that session_type will be changing for the Visual Behavior project, given that data collection is completed and this is the last release, but if this same code for creating the ophys_experiment_table is used for future projects, then this might come into play.

danielsf commented 3 years ago

This has been addressed by PR #2184