-
Notifications
You must be signed in to change notification settings - Fork 159
Closed
Description
As a visual behavior analyst, I want to track start time, stop time, duration, and properties for images and gratings, so that I can do a complete analysis of a visual behavior experiment.
To do this, need to map information about gratings into the data structure that currently exists only for static images. Gratings properties are in the pkl file, and include:
spatial frequency (how wide is the bar)
phase: where in the wave does the bar begin +/- 0.25
rotation: +90/-90
- Change the gratings name in
allensdk/brain_observatory/behavior/trials_processing.pyto the convention ofgratings_<angle> - Add tests for the function
get_trialsin thetrials_processingmodule (this function appears to be untested but a test file does exist)
Acceptance criteria:
- Demonstrate for an ophys behavior session, and a behavior-only session that stimulus_presentations table can be generated with valid data for image and grating stimulus presentations
- Creation of a pandas dataframe that can be presented to the visual behavior team that shows the correct naming convention for gratings stimuli
Repro steps:
from allensdk.brain_observatory.behavior.behavior_project_cache import BehaviorProjectCache as bpc
MANIFEST_PATH = "//allen/programs/braintv/workgroups/nc-ophys/visual_behavior/2020_cache/production_cache/manifest.json"
cache = bpc.from_lims(manifest = MANIFEST_PATH)
behavior_session_id = 983472077
session = cache.get_behavior_session_data(behavior_session_id)
session.trials
Stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/allen/aibs/technology/waynew/conda/allensdk_latest/lib/python3.7/site-packages/allensdk/brain_observatory/behavior/behavior_data_session.py", line 224, in trials
self._trials = self.api.get_trials()
File "/allen/aibs/technology/waynew/conda/allensdk_latest/lib/python3.7/site-packages/allensdk/internal/api/behavior_data_lims_api.py", line 326, in get_trials
stimulus_presentations = self.get_stimulus_presentations()
File "/allen/aibs/technology/waynew/conda/allensdk_latest/lib/python3.7/site-packages/allensdk/internal/api/behavior_data_lims_api.py", line 234, in get_stimulus_presentations
data, stimulus_timestamps)
File "/allen/aibs/technology/waynew/conda/allensdk_latest/lib/python3.7/site-packages/allensdk/brain_observatory/behavior/stimulus_processing.py", line 44, in get_stimulus_presentations
stimulus_table = get_visual_stimuli_df(data, stimulus_timestamps)
File "/allen/aibs/technology/waynew/conda/allensdk_latest/lib/python3.7/site-packages/allensdk/brain_observatory/behavior/stimulus_processing.py", line 229, in get_visual_stimuli_df
draw_log_rising_edges = len(np.where(np.diff(stimuli['images']['draw_log'])==1)[0])
KeyError: 'images'
dougollerenshaw and alexpiet