Skip to content

error opening icephys file #115

@bendichter

Description

@bendichter

dandiset: 001183

path: sub-2020-02-15-0006/sub-2020-02-15-0006_icephys.nwb

download: https://api.dandiarchive.org/api/dandisets/001183/versions/draft/assets/89d74f56-fa79-4162-b6e6-cd5c2659f7ad/download/

This is an icephys file. I can download it and open it in PyNWB, but when I try to open it in using lindi it throws an error.

# this works
import pynwb

fpath = "/Users/bdichter/Downloads/sub-2020-02-15-0006_icephys.nwb"

pynwb.NWBHDF5IO(fpath,"r").read()

# this does not work
import lindi
download_url = 'https://api.dandiarchive.org/api/dandisets/001183/versions/draft/assets/89d74f56-fa79-4162-b6e6-cd5c2659f7ad/download/'
f = lindi.LindiH5pyFile.from_hdf5_file(download_url)
nwb = pynwb.NWBHDF5IO(file=f, mode='r').read()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[135], line 4
      2 download_url = 'https://api.dandiarchive.org/api/dandisets/001183/versions/draft/assets/89d74f56-fa79-4162-b6e6-cd5c2659f7ad/download/'
      3 f = lindi.LindiH5pyFile.from_hdf5_file(download_url)
----> 4 nwb = pynwb.NWBHDF5IO(file=f, mode='r').read()

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/pynwb/__init__.py:489, in NWBHDF5IO.read(self, **kwargs)
    486         raise TypeError("NWB version %s not supported. PyNWB supports NWB files version 2 and above." %
    487                         str(file_version_str))
    488 # read the file
--> 489 file = super().read(**kwargs)
    490 return file

File ~/miniconda3/lib/python3.12/site-packages/hdmf/backends/hdf5/h5tools.py:458, in HDF5IO.read(self, **kwargs)
    455     raise UnsupportedOperation("Cannot read from file %s in mode '%s'. Please use mode 'r', 'r+', or 'a'."
    456                                % (self.source, self.__mode))
    457 try:
--> 458     return super().read(**kwargs)
    459 except UnsupportedOperation as e:
    460     if str(e) == 'Cannot build data. There are no values.':  # pragma: no cover

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/backends/io.py:60, in HDMFIO.read(self, **kwargs)
     57 if all(len(v) == 0 for v in f_builder.values()):
     58     # TODO also check that the keys are appropriate. print a better error message
     59     raise UnsupportedOperation('Cannot build data. There are no values.')
---> 60 container = self.__manager.construct(f_builder)
     61 container.read_io = self
     62 if self.herd_path is not None:

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:286, in BuildManager.construct(self, **kwargs)
    282     result = self.__type_map.construct(builder, self, parent)
    283 else:
    284     # we are at the top of the hierarchy,
    285     # so it must be time to resolve parents
--> 286     result = self.__type_map.construct(builder, self, None)
    287     self.__resolve_parents(result)
    288 self.prebuilt(result, builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:813, in TypeMap.construct(self, **kwargs)
    811     raise ValueError('No ObjectMapper found for builder of type %s' % dt)
    812 else:
--> 813     return obj_mapper.construct(builder, build_manager, parent)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/pynwb/io/file.py:161, in NWBFileMap.construct(self, **kwargs)
    157         builder.groups['bands'].attributes['namespace'] = 'core'
    159 apply_to_child_builders(nwbfile_builder, [update_builder_frequency_bands_table])
--> 161 return super().construct(**kwargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1338, in ObjectMapper.construct(self, **kwargs)
   1336 cls = manager.get_cls(builder)
   1337 # gather all subspecs
-> 1338 subspecs = self.__get_subspec_values(builder, self.spec, manager)
   1339 # get the constructor argument that each specification corresponds to
   1340 const_args = dict()

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1267, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1265                 ret[subspec] = self.__flatten(sub_builder, subspec, manager)
   1266     # now process groups and datasets
-> 1267     self.__get_sub_builders(groups, spec.groups, manager, ret)
   1268     self.__get_sub_builders(datasets, spec.datasets, manager, ret)
   1269 elif isinstance(spec, DatasetSpec):

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1318, in ObjectMapper.__get_sub_builders(self, sub_builders, subspecs, manager, ret)
   1315     continue
   1316 if dt is None:
   1317     # recurse
-> 1318     ret.update(self.__get_subspec_values(sub_builder, subspec, manager))
   1319 else:
   1320     ret[subspec] = manager.construct(sub_builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1267, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1265                 ret[subspec] = self.__flatten(sub_builder, subspec, manager)
   1266     # now process groups and datasets
-> 1267     self.__get_sub_builders(groups, spec.groups, manager, ret)
   1268     self.__get_sub_builders(datasets, spec.datasets, manager, ret)
   1269 elif isinstance(spec, DatasetSpec):

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1318, in ObjectMapper.__get_sub_builders(self, sub_builders, subspecs, manager, ret)
   1315     continue
   1316 if dt is None:
   1317     # recurse
-> 1318     ret.update(self.__get_subspec_values(sub_builder, subspec, manager))
   1319 else:
   1320     ret[subspec] = manager.construct(sub_builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1267, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1265                 ret[subspec] = self.__flatten(sub_builder, subspec, manager)
   1266     # now process groups and datasets
-> 1267     self.__get_sub_builders(groups, spec.groups, manager, ret)
   1268     self.__get_sub_builders(datasets, spec.datasets, manager, ret)
   1269 elif isinstance(spec, DatasetSpec):

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1320, in ObjectMapper.__get_sub_builders(self, sub_builders, subspecs, manager, ret)
   1318     ret.update(self.__get_subspec_values(sub_builder, subspec, manager))
   1319 else:
-> 1320     ret[subspec] = manager.construct(sub_builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:282, in BuildManager.construct(self, **kwargs)
    280 if parent_builder is not None:
    281     parent = self._get_proxy_builder(parent_builder)
--> 282     result = self.__type_map.construct(builder, self, parent)
    283 else:
    284     # we are at the top of the hierarchy,
    285     # so it must be time to resolve parents
    286     result = self.__type_map.construct(builder, self, None)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:813, in TypeMap.construct(self, **kwargs)
    811     raise ValueError('No ObjectMapper found for builder of type %s' % dt)
    812 else:
--> 813     return obj_mapper.construct(builder, build_manager, parent)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1338, in ObjectMapper.construct(self, **kwargs)
   1336 cls = manager.get_cls(builder)
   1337 # gather all subspecs
-> 1338 subspecs = self.__get_subspec_values(builder, self.spec, manager)
   1339 # get the constructor argument that each specification corresponds to
   1340 const_args = dict()

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1267, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1265                 ret[subspec] = self.__flatten(sub_builder, subspec, manager)
   1266     # now process groups and datasets
-> 1267     self.__get_sub_builders(groups, spec.groups, manager, ret)
   1268     self.__get_sub_builders(datasets, spec.datasets, manager, ret)
   1269 elif isinstance(spec, DatasetSpec):

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1320, in ObjectMapper.__get_sub_builders(self, sub_builders, subspecs, manager, ret)
   1318     ret.update(self.__get_subspec_values(sub_builder, subspec, manager))
   1319 else:
-> 1320     ret[subspec] = manager.construct(sub_builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:282, in BuildManager.construct(self, **kwargs)
    280 if parent_builder is not None:
    281     parent = self._get_proxy_builder(parent_builder)
--> 282     result = self.__type_map.construct(builder, self, parent)
    283 else:
    284     # we are at the top of the hierarchy,
    285     # so it must be time to resolve parents
    286     result = self.__type_map.construct(builder, self, None)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:813, in TypeMap.construct(self, **kwargs)
    811     raise ValueError('No ObjectMapper found for builder of type %s' % dt)
    812 else:
--> 813     return obj_mapper.construct(builder, build_manager, parent)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1338, in ObjectMapper.construct(self, **kwargs)
   1336 cls = manager.get_cls(builder)
   1337 # gather all subspecs
-> 1338 subspecs = self.__get_subspec_values(builder, self.spec, manager)
   1339 # get the constructor argument that each specification corresponds to
   1340 const_args = dict()

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1268, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1266     # now process groups and datasets
   1267     self.__get_sub_builders(groups, spec.groups, manager, ret)
-> 1268     self.__get_sub_builders(datasets, spec.datasets, manager, ret)
   1269 elif isinstance(spec, DatasetSpec):
   1270     if not isinstance(builder, DatasetBuilder):  # pragma: no cover

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1320, in ObjectMapper.__get_sub_builders(self, sub_builders, subspecs, manager, ret)
   1318     ret.update(self.__get_subspec_values(sub_builder, subspec, manager))
   1319 else:
-> 1320     ret[subspec] = manager.construct(sub_builder)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:282, in BuildManager.construct(self, **kwargs)
    280 if parent_builder is not None:
    281     parent = self._get_proxy_builder(parent_builder)
--> 282     result = self.__type_map.construct(builder, self, parent)
    283 else:
    284     # we are at the top of the hierarchy,
    285     # so it must be time to resolve parents
    286     result = self.__type_map.construct(builder, self, None)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/manager.py:813, in TypeMap.construct(self, **kwargs)
    811     raise ValueError('No ObjectMapper found for builder of type %s' % dt)
    812 else:
--> 813     return obj_mapper.construct(builder, build_manager, parent)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/utils.py:578, in docval.<locals>.dec.<locals>.func_call(*args, **kwargs)
    576 def func_call(*args, **kwargs):
    577     pargs = _check_args(args, kwargs)
--> 578     return func(args[0], **pargs)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1338, in ObjectMapper.construct(self, **kwargs)
   1336 cls = manager.get_cls(builder)
   1337 # gather all subspecs
-> 1338 subspecs = self.__get_subspec_values(builder, self.spec, manager)
   1339 # get the constructor argument that each specification corresponds to
   1340 const_args = dict()

File ~/miniconda3/lib/python3.12/site-packages/hdmf/build/objectmapper.py:1273, in ObjectMapper.__get_subspec_values(self, builder, spec, manager)
   1270 if not isinstance(builder, DatasetBuilder):  # pragma: no cover
   1271     raise ValueError("__get_subspec_values - must pass DatasetBuilder with DatasetSpec")
   1272 if (spec.shape is None and getattr(builder.data, 'shape', None) == (1,) and
-> 1273         type(builder.data[0]) is not np.void):
   1274     # if a scalar dataset is expected and a 1-element non-compound dataset is given, then read the dataset
   1275     builder['data'] = builder.data[0]  # use dictionary reference instead of .data to bypass error
   1276 ret[spec] = self.__check_ref_resolver(builder.data)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/backends/hdf5/h5_utils.py:231, in AbstractH5TableDataset.__getitem__(self, arg)
    230 def __getitem__(self, arg):
--> 231     rows = copy(super().__getitem__(arg))
    232     if np.issubdtype(type(arg), np.integer):
    233         self.__swap_refs(rows)

File ~/miniconda3/lib/python3.12/site-packages/hdmf/query.py:20, in HDMFDataset.__getitem__(self, key)
     18 def __getitem__(self, key):
     19     idx = self.__evaluate_key(key)
---> 20     return self.dataset[idx]

File ~/miniconda3/lib/python3.12/site-packages/lindi/LindiH5pyFile/LindiH5pyDataset.py:180, in LindiH5pyDataset.__getitem__(self, args, new_dtype)
    178 if new_dtype is not None:
    179     raise Exception("new_dtype is not supported for zarr.Array")
--> 180 return self._get_item_for_zarr(self._zarr_array, args)

File ~/miniconda3/lib/python3.12/site-packages/lindi/LindiH5pyFile/LindiH5pyDataset.py:217, in LindiH5pyDataset._get_item_for_zarr(self, zarr_array, selection)
    215         return ret
    216     else:
--> 217         raise TypeError(
    218             f"Compound dataset {self.name} does not support selection with {selection}"
    219         )
    221 # We use zarr's slicing, except in the case of a scalar dataset
    222 if self.ndim == 0:
    223     # make sure selection is ()

TypeError: Compound dataset /general/intracellular_ephys/intracellular_recordings/stimuli/stimulus does not support selection with 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions