Skip to content

Invalid annotation error when trying to read .nwb file #1413

Open
@Idavr

Description

@Idavr

Greetings everyone!
I hope someone here can help with solving a very basic issue.

Currently I am trying to read a .nwb file using NWBIO like this:

from pynwb import NWBFile, NWBHDF5IO
from neo.io import NWBIO

file = '/745606_20231213-probe0.nwb'

reader = NWBIO(file)
data_neo = reader.read()
print(data_neo)

/home/idavalik/anaconda3/envs/elephant/lib/python3.8/site-packages/hdmf/utils.py:668: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.2.0 because version 1.8.0 is already loaded.
  return func(args[0], **pargs)
/home/idavalik/anaconda3/envs/elephant/lib/python3.8/site-packages/hdmf/utils.py:668: UserWarning: Ignoring cached namespace 'core' version 2.2.5 because version 2.6.0-alpha is already loaded.
 return func(args[0], **pargs)

Traceback (most recent call last):
  File "/home/idavalik/Documents/elephant/elephant/assembly_detection.py", line 18, in <module>
    data_neo = reader.read()
  File "/home/idavalik/Documents/elephant/elephant/neo/io/baseio.py", line 133, in read
    return self.read_all_blocks(lazy=lazy, **kargs)
  File "/home/idavalik/Documents/elephant/elephant/neo/io/nwbio.py", line 271, in read_all_blocks
    self._read_stimulus_group(lazy)
  File "/home/idavalik/Documents/elephant/elephant/neo/io/nwbio.py", line 390, in _read_stimulus_group
    self._read_timeseries_group("stimulus", lazy)
  File "/home/idavalik/Documents/elephant/elephant/neo/io/nwbio.py", line 351, in _read_timeseries_group
    segment = self._get_segment(block_name, segment_name)
  File "/home/idavalik/Documents/elephant/elephant/neo/io/nwbio.py", line 291, in _get_segment
    block = Block(name=block_name, **self.global_block_metadata)
  File "/home/idavalik/Documents/elephant/elephant/neo/core/block.py", line 96, in __init__
    super().__init__(name=name, description=description, file_origin=file_origin, **annotations)
  File "/home/idavalik/Documents/elephant/elephant/neo/core/container.py", line 204, in __init__
    super().__init__(name=name, description=description, file_origin=file_origin, **annotations)
  File "/home/idavalik/Documents/elephant/elephant/neo/core/baseneo.py", line 273, in __init__
    _check_annotations(annotations)
  File "/home/idavalik/Documents/elephant/elephant/neo/core/baseneo.py", line 49, in _check_annotations
    _check_annotations(element)
  File "/home/idavalik/Documents/elephant/elephant/neo/core/baseneo.py", line 54, in _check_annotations
    raise ValueError(f"Invalid annotation. Annotations of type {type(value)} are not" f"allowed")
ValueError: Invalid annotation. Annotations of type <class 'h5py._hl.dataset.Dataset'> are notallowed

Environment:

  • OS: Linux/Ubuntu
  • Python version: 3.8
  • Neo version: 0.13.1.dev0
  • NumPy version: 1.24.3
  • pynwb version: 2.5.0

I saw some previous issues with reading .nwb files, but not with this exact ValueError. Any assistance in very much appreciated!

Best,

Idavr

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions