NeurodataWithoutBorders / nwbinspector

Tool to help inspect NWB files for compliance with NWB Best Practices
https://nwbinspector.readthedocs.io/
Other
17 stars 10 forks source link

[Bug]: NWB Inspector fails when NWB type description is a non-scalar. #534

Open ehennestad opened 4 days ago

ehennestad commented 4 days ago

What happened?

After running the most recent ecephys tutorial from pynwb and using nwb inspector on the resulting file, I get the following error message from nwb inspector:

    "Traceback (most recent call last):
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/_inspection.py", line 457, in run_checks
         output = robust_s3_read(command=check_function, command_args=[nwbfile_object])
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/utils/_utils.py", line 181, in robust_s3_read
         raise exc
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/utils/_utils.py", line 176, in robust_s3_read
         return command(*command_args, **command_kwargs)
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/_registration.py", line 58, in auto_parse_some_output
         output = check_function(*args, **kwargs)
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/checks/_general.py", line 24, in check_description
         if obj.description is None or obj.description.strip(" ") == "":
       File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/hdmf/utils.py", line 1152, in __getattr__
         return getattr(self.dset, name)
     AttributeError: 'Dataset' object has no attribute 'strip'
     "

The problem appears to be the following NWB type (FeatureExtraction): https://github.com/NeurodataWithoutBorders/pynwb/blob/54c655f072b2e4926d5106d9c3a528013977663e/docs/gallery/domain/ecephys.py#L393-L399

and the fact that description is added as a list.

The NWB schema for https://nwb-schema.readthedocs.io/en/latest/format.html#featureextraction defines the description with these attributes:

Description of features (eg, ‘’PC1’’) for each of the extracted features. Data Type: text Dimensions: [‘num_features’] Shape: [None] Name: description

The full inspector output for that entry is:

       message='Traceback (most recent call last):\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/_inspection.py", line 457, in run_checks\n    output = robust_s3_read(command=check_function, command_args=[nwbfile_object])\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/utils/_utils.py", line 181, in robust_s3_read\n    raise exc\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/utils/_utils.py", line 176, in robust_s3_read\n    return command(*command_args, **command_kwargs)\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/_registration.py", line 58, in auto_parse_some_output\n    output = check_function(*args, **kwargs)\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/nwbinspector/checks/_general.py", line 24, in check_description\n    if obj.description is None or obj.description.strip(" ") == "":\n  File "/Users/Eivind/Library/Python/3.9/lib/python/site-packages/hdmf/utils.py", line 1152, in __getattr__\n    return getattr(self.dset, name)\nAttributeError: \'Dataset\' object has no attribute \'strip\'\n',
        importance=<Importance.ERROR: 4>,
        severity=<Severity.LOW: 1>,
        check_function_name='check_description',
        object_type=None,
        object_name=None,
        location=None,
        file_path='/Users/Eivind/Code/MATLAB/Neuroscience/Repositories/NeurodataWithoutBorders/pynwb/ecephys_tutorial.nwb'

Operating System

macOS

Python Version

3.10

Were you streaming with ROS3?

No

Package Versions

Using NWB Inspector v0.5.2

Code of Conduct