Allen Brain Observatory - get_stimulus_template doesn't work with static_gratings

138 Views Asked by At

I am analyzing data from an experiment with the static_gratings stimulus. The SDK documentation says the get_stimulus_template function can take as an argument any stimulus used in a queried experiment. I called list_stimuli() on the experiment to confirm static_gratings is a used stimulus.

When I run get_stimulus_template('static_gratings'), I get this traceback/error:

  Traceback (most recent call last):

  File "<ipython-input-46-be84d6ea7546>", line 1, in <module>
    sg_scenes = expData.get_stimulus_template('static_gratings')

  File "/Users/randallellis/anaconda/lib/python2.7/site-packages/allensdk/core/brain_observatory_nwb_data_set.py", line 373, in get_stimulus_template
    image_stack = f['stimulus']['templates'][stim_name]['data'].value

  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1490025880382/work/h5py/_objects.c:2846)

  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1490025880382/work/h5py/_objects.c:2804)

  File "/Users/randallellis/anaconda/lib/python2.7/site-packages/h5py/_hl/group.py", line 169, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)

  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1490025880382/work/h5py/_objects.c:2846)

  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/h5py_1490025880382/work/h5py/_objects.c:2804)

  File "h5py/h5o.pyx", line 190, in h5py.h5o.open (/Users/ilan/minonda/conda-bld/h5py_1490025880382/work/h5py/h5o.c:3740)

KeyError: "Unable to open object (Object 'static_gratings_image_stack' doesn't exist)"

Any help with this is appreciated.

1

There are 1 best solutions below

0
On

That's strange. Can you provide the rest of the code you use to create expData? I can check to see if there's something wrong with the NWB file. You might also try deleting the NWB file and re-downloading it in case something is wrong with your file (e.g. didn't finish downloading).

Update: Ignore the previous response -- I misread your question.

The problem is that we currently do not provide the templates for the static gratings and drifting gratings stimuli. Those stimuli are generated procedurally by psychopy when we present the stimulus. See:

https://github.com/AllenInstitute/AllenSDK/issues/24

We are currently working on incorporating those methods into the AllenSDK so that folks can generate them on their own. The natural movies, natural scenes, and locally sparse noise templates are all available in the NWB file.