Skip to content

Commit

Permalink
Add code to catch active stimulus that should be marked but fall outs…
Browse files Browse the repository at this point in the history
…ide of the trials.
  • Loading branch information
morriscb committed Sep 14, 2023
1 parent d0d7392 commit 597ded7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions allensdk/brain_observatory/behavior/stimulus_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,14 @@ def add_active_flag(
& (~stim_pres_table.image_name.isna())
)
active[stim_mask] = True

# Clean up potential stimuli that fall outside in time of the trials
# but are part of the "active" stimulus block.
if "stimulus_block" in stim_pres_table.columns:
for stim_block in stim_pres_table["stimulus_block"].unique():
block_mask = stim_pres_table["stimulus_block"] == stim_block
if np.any(active[block_mask]):
active[block_mask] = True
stim_pres_table["active"] = active
return stim_pres_table

Expand Down

0 comments on commit 597ded7

Please sign in to comment.