Skip to content

Foraging session animal response#99

Closed
rachelstephlee wants to merge 3 commits into
mainfrom
foraging_session_animal_response
Closed

Foraging session animal response#99
rachelstephlee wants to merge 3 commits into
mainfrom
foraging_session_animal_response

Conversation

@rachelstephlee

Copy link
Copy Markdown
Collaborator

choice column should be called 'choice', not 'animal response'.

Also, found a minor bug that dropped ignore trials when getting average signal.

@rachelstephlee rachelstephlee requested a review from alexpiet March 26, 2026 23:59

# Merge on 'trial'
df_trials = df_trials.merge(avg_activity[['trial', output_col]], on='trial', how='left')
df_trials = nwb.df_trials.merge(avg_activity[['trial', output_col]], on='trial', how='left')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this, because above on 364/365 we do some filtering on nwb.df_trials

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the filtering is so that if we are timelocking to an event that doesn't occur in all trials, it will not cause an error.

however, if we timelock to choice, this would mean all ignore trials are automatically dropped.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we might be timelocking to other events. This line would then make all the previous filtering get ignored

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous filtering is just for getting the averages. by merging onto the original nwb, we make sure we don't discard any data, just that the average activity will be set to nan.


if "side_bias" not in nwb.df_trials:
fig, axes = plot_foraging_session(
[np.nan if x == 2 else x for x in nwb.df_trials["animal_response"].values],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this. The column name that is in the NWB is "animal_response". I agree choice would be a better name, but thats not how its named in the file.

Are you sure you aren't renaming animal_response somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me double check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found the rename. it was when i added the foraging model. i'll fix that.

@rachelstephlee

Copy link
Copy Markdown
Collaborator Author

Closing this. fixed it differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants