AllenInstitute / AllenSDK

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

ticket/PSB155: Add is_sham_change column. #2715

Closed morriscb closed 10 months ago

morriscb commented 10 months ago

Add is_sham_change to stimulus presentations.

Add trials as an optional input to allow for calculating new columns: active, is_sham_change. Move trials_id calculation to stimulus presentations init to better handle all presentations table creation modes. Add int typing enforcement to trials table. Add active, and is_sham_change to stimulus processing. Simplify trials_id calculation. Add unittests for active and is_sham_change column calculation and update other unittests.

Note: Will update linting failures before merge to avoid chaff from non-change files. Updating on #2712

morriscb commented 10 months ago

Why did Corbett set a condition, (stimulus_block==5) & (is_sham_change) that is commented as the passive block and you only needed to use the condition ~stim_df.active? Corbett used stim_df.active to subset the active rows but didn't use the inverse to subset the passive rows.

#2643 (comment)

Corbett is assuming that block 5 is a replay block, that is the same stimulus is replayed to the mouse. Both his and my code copies information from the trials table and related columns (is_sham_change being one) from the active into this reply block. The code I wrote is more general in case in the future there are 1) more than one active block 2) more than one replay block. In short it's doing the same thing but doesn't relying on assuming the block numbers.