NeurodataWithoutBorders / nwbwidgets

Explore the hierarchical structure of NWB 2.0 files and visualize data with Jupyter widgets.
https://nwb-widgets.readthedocs.io/en/latest/
Other
48 stars 21 forks source link

exported NWB file reads experimenter as bytes in pyNWB #106

Closed bichanw closed 4 years ago

bichanw commented 4 years ago

When an NWB file is exported from MatNWB, pyNWB will read its experimenter information as bytes instead of string, causing nwbwidgets error: TypeError: sequence item 0: expected str instance, bytes found.

So, in detail, if I define an NWB in matNWB (...'general_experimenter', 'input later'...) or (...'general_experimenter', {'input later'}...)

And reads it in pyNWB, print nwb.experimenter, it will show: (b'input later',)

Consequently if I run nwb2widget(nwb), I get an error message: TypeError: sequence item 0: expected str instance, bytes found

For a sample data that works in nwbwidgets, if I read it in matNWB, and run disp(nwb.general_experimenter), it will show

DataStub with properties:

    filename: '/Users/bichanwu/Desktop/nwb workshop/Steinmetz2019_Cori_2016-12-14.nwb'
        path: '/general/experimenter'
        dims: 1

For a matNWB defined nwb file, it'll show just string or cell. After exporting and reading, it becomes a dataStub as well, but pynwb still reads it as bytes.

bendichter commented 4 years ago

This has been fixed in the latest release