Loading Trials Data
Task related behavioral data
Relevant Alf objects
trials
Loading
[2]:
from one.api import ONE
one = ONE()
eid = '4ecb5d24-f5cc-402c-be28-9d0f7cb14b3a'
trials = one.load_object(eid, 'trials', collection='alf')
/home/runner/Downloads/ONE/openalyx.internationalbrainlab.org/hoferlab/Subjects/SWC_043/2020-09-21/001/alf/_ibl_trials.goCueTrigger_times.npy: 100%|██████████| 4.36k/4.36k [00:00<00:00, 35.5kB/s]
/home/runner/Downloads/ONE/openalyx.internationalbrainlab.org/hoferlab/Subjects/SWC_043/2020-09-21/001/alf/_ibl_trials.table.pqt: 100%|██████████| 45.0k/45.0k [00:00<00:00, 283kB/s]
/home/runner/Downloads/ONE/openalyx.internationalbrainlab.org/hoferlab/Subjects/SWC_043/2020-09-21/001/alf/_ibl_trials.stimOff_times.npy: 100%|██████████| 4.36k/4.36k [00:00<00:00, 29.7kB/s]
More details
Useful modules
Exploring trials data
Example 1. Computing behavioral performance
[3]:
from brainbox.behavior.training import compute_performance
# compute performance
performance, contrasts, n_contrasts = compute_performance(trials)
# compute performance expressed as probability of choosing right
performance, contrasts, n_contrasts = compute_performance(trials, prob_right=True)
# compute performance during 0.8 biased block
performance, contrasts, n_contrasts = compute_performance(trials, block=0.8)
Example 2. Filtering trials
[4]:
from brainbox.task.trials import find_trial_ids
# find index for stim right trials ordered by trial number
trial_id, _ = find_trial_ids(trials, side='right', choice='all', order='trial num')
# find index for correct, stim left, 100% contrast trials ordered by reaction time
trial_id, _ = find_trial_ids(trials, side='left', choice='correct', contrast=[1], order='reaction time')
# find index for correct trials ordered by trial number sorted by stimulus side
trial_id, _ = find_trial_ids(trials, side='left', choice='correct', order='reaction time', sort='side')
Example 3. Plotting pyschometric curve
[5]:
from brainbox.behavior.training import plot_psychometric
fig, ax = plot_psychometric(trials)

Example 4: Computing Task QC for session
[ ]:
from ibllib.qc import task_metrics
qc = task_metrics.TaskQC(eid)
outcome, results = qc.run()
print(f'QC_status: {outcome}')
print(f'Individual QC values:')
results
Information about individual qc checks can be found by looking at the docstring (replace _task
with check
), e.g.
[ ]:
help(task_metrics.check_errorCue_delays)
Other relevant examples
COMING SOON