Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct signed contrast computation #761

Open
wants to merge 1 commit into
base: iblrigv8
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iblrig/base_choice_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,11 @@
)

def new_block(self):
"""
if block_init_5050
First block has 50/50 probability of leftward stim
is 90 trials long
"""

Check failure on line 839 in iblrig/base_choice_world.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (D403)

iblrig/base_choice_world.py:835:9: D403 First word of the docstring should be capitalized: `if` -> `If`
self.block_num += 1 # the block number is zero based
self.block_trial_num = 0

Expand Down Expand Up @@ -966,7 +966,7 @@

def compute_performance(self):
"""Aggregate the trials table to compute the performance of the mouse on each contrast."""
self.trials_table['signed_contrast'] = self.trials_table.contrast * self.trials_table.position
self.trials_table['signed_contrast'] = self.trials_table.contrast * np.sign(self.trials_table.position)
performance = self.trials_table.groupby(['signed_contrast']).agg(
last_50_perf=pd.NamedAgg(column='trial_correct', aggfunc=lambda x: np.sum(x[np.maximum(-50, -x.size) :]) / 50),
ntrials=pd.NamedAgg(column='trial_correct', aggfunc='count'),
Expand Down
Loading