Hi, I want to load the nwb files from this dataset (DANDI Archive) but see the error when getting the sweep.
Here is the code:
from allensdk.core.nwb_data_set import NwbDataSet
file_name = 'C:/Users/swamylab/Downloads/sub-612905668_ses-614728579_icephys.nwb'
data_set = NwbDataSet(file_name)
data_set.get_experiment_sweep_numbers()
Here is the error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[36], line 4
2 file_name = 'C:/Users/swamylab/Downloads/sub-612905668_ses-614728579_icephys.nwb'
3 data_set = NwbDataSet(file_name)
----> 4 data_set.get_experiment_sweep_numbers()
File ~\anaconda3\envs\allensdk\Lib\site-packages\allensdk\core\nwb_data_set.py:320, in NwbDataSet.get_experiment_sweep_numbers(self)
315 """ Get all of the sweep numbers for experiment epochs in the file,
316 not including test sweeps. """
318 with h5py.File(self.file_name, 'r') as f:
319 sweeps = [int(e.split('_')[1])
--> 320 for e in f['epochs'].keys() if
321 e.startswith('Experiment_')]
322 return sweeps
File h5py\_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py\_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File ~\anaconda3\envs\allensdk\Lib\site-packages\h5py\_hl\group.py:357, in Group.__getitem__(self, name)
355 raise ValueError("Invalid HDF5 object reference")
356 elif isinstance(name, (bytes, str)):
--> 357 oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
358 else:
359 raise TypeError("Accessing a group is done with bytes or str, "
360 "not {}".format(type(name)))
File h5py\_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py\_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File h5py\h5o.pyx:189, in h5py.h5o.open()
KeyError: "Unable to synchronously open object (object 'epochs' doesn't exist)"