AllenInstitute / AllenInstitute/AllenSDK

get_extended_trials fails for some behavior only sessions

Open
#1,908 1 comment 0 reactions 1 assignee View on GitHub

@wbwakeman is already working on this.

Since Feb 26, 2021.

braintv
Dominant language
Jupyter Notebook
Stars
398
Forks
163
PR merge metrics
No merged PRs in 30d

Description

For some behavior only sessions, running get_extended_trials() provokes a somewhat inscrutable error from within trials_processing.py.

For example:

>>> from allensdk.brain_observatory.behavior.behavior_session import BehaviorSession
>>> session = BehaviorSession.from_lims(962822728)
>>> df = session.api.get_extended_trials()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/allen/aibs/technology/danielsf/miniconda3/envs/allensdk_dev2/lib/python3.8/site-packages/allensdk-2.7.0-py3.8.egg/allensdk/brain_observatory/behavior/session_apis/data_transforms/behavior_data_transforms.py", line 261, in get_extended_trials
    return get_extended_trials(data)
  File "/allen/aibs/technology/danielsf/miniconda3/envs/allensdk_dev2/lib/python3.8/site-packages/allensdk-2.7.0-py3.8.egg/allensdk/brain_observatory/behavior/trials_processing.py", line 964, in get_extended_trials
    return create_extended_trials(trials=get_trials_v0(data, time),
  File "/allen/aibs/technology/danielsf/miniconda3/envs/allensdk_dev2/lib/python3.8/site-packages/allensdk-2.7.0-py3.8.egg/allensdk/brain_observatory/behavior/trials_processing.py", line 754, in get_trials_v0
    from_group, from_name, to_group, to_name = get_image_info_from_trial(trial_log, ti)
  File "/allen/aibs/technology/danielsf/miniconda3/envs/allensdk_dev2/lib/python3.8/site-packages/allensdk-2.7.0-py3.8.egg/allensdk/brain_observatory/behavior/trials_processing.py", line 696, in get_image_info_from_trial
    _, _, prev_group, prev_name = get_image_info_from_trial(trial_log, ti - 1)
  File "/allen/aibs/technology/danielsf/miniconda3/envs/allensdk_dev2/lib/python3.8/site-packages/allensdk-2.7.0-py3.8.egg/allensdk/brain_observatory/behavior/trials_processing.py", line 690, in get_image_info_from_trial
    raise RuntimeError('Should not have been possible')
RuntimeError: Should not have been possible

Here is a random sample of sessions that cause the error

[962822728, 1064436629, 1059690999, 877218464, 827655347, 896543686, 1034920219, 853805860, 1047709328, 1042765331, 1078567940]

Here is a random sample of sessions that do not

[818782934, 810303404, 882415298, 1010794220, 1026342864, 1007849594, 861788094, 778884020, 910859641, 814269306]

I have not put any effort into interrogating what makes these sets of sessions different.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.