I'm trying to use matnwb to read EEG-like signals from .nwb files in Brainstorm …(https://neuroimage.usc.edu/brainstorm).
One of our former collaborators used matnwb in early 2019 to import ECoG signals, but I can't use any of his work with more recent versions of matnwb...
Since we have users who are interested in processing NWB recordings in Brainstorm, I am taking over this work. We started a conversation on our user forum: https://neuroimage.usc.edu/forums/t/error-opening-nwb-files/21025/11
I tried to start fresh with the recent versions of the library (current github master, and v2.2.5.0) and the example datasets available on the NWB website (https://www.nwb.org/example-datasets/) and other websites (https://gui.dandiarchive.org/#/dandiset/000020/draft), but I'm facing many issues with almost all the datasets.
Below: a list of example files and the errors I obtain with the two versions of the library I tested.
Installation of the Github master branch (https://github.com/NeurodataWithoutBorders/matnwb/archive/master.zip):
```
>> cd C:\Users\franc\Downloads\matnwb-master
>> generateCore
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
>>
```
Installation of the v2.2.5.0 version (https://github.com/NeurodataWithoutBorders/matnwb/archive/v2.2.5.0.tar.gz):
```
>> cd C:\Users\franc\Downloads\matnwb-2.2.5.0
>> generateCore
>>
```
### nwb_an041_20140821_vM1_180um.nwb
matnwb-2.2.5.0:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\nwb_an041_20140821_vM1_180um.nwb')
Error using types.util.checkUnset (line 13)
Unexpected properties {source}.
Your schema version may be incompatible with the file. Consider checking the schema version of the file with
`util.getSchemaVersion(filename)` and comparing with the YAML namespace version present in nwb-schema/core/nwb.namespace.yaml
Error in types.core.TimeSeries (line 82)
types.util.checkUnset(obj, unique(varargin(1:2:end)));
Error in io.parseGroup (line 85)
parsed = eval([Type.typename '(kwargs{:})']);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in nwbRead (line 33)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
>>
>> nwb = util.getSchemaVersion('C:\Work\RawData\Test\NWB\nwb_an041_20140821_vM1_180um.nwb')
Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:
H5O_attr_open_by_name can't locate attribute: 'nwb_version'
H5Aopen unable to load attribute info from object header for attribute: 'nwb_version'
Error in H5A.open (line 34)
id = H5ML.hdf5lib2('H5Aopen', obj_id, attr_name, acpl_id);
Error in util.getSchemaVersion (line 3)
aid = H5A.open(fid, 'nwb_version');
```
matnwb-master:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\nwb_an041_20140821_vM1_180um.nwb')
Error using types.util.checkUnset (line 13)
Unexpected properties {help source}.
Your schema version may be incompatible with the file. Consider checking the schema version of the file
with `util.getSchemaVersion(filename)` and comparing with the YAML namespace version present in
nwb-schema/core/nwb.namespace.yaml
Error in types.core.TimeSeries (line 82)
types.util.checkUnset(obj, unique(varargin(1:2:end)));
Error in io.parseGroup (line 85)
parsed = eval([Type.typename '(kwargs{:})']);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in nwbRead (line 33)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
>>
>> nwb = util.getSchemaVersion('C:\Work\RawData\Test\NWB\nwb_an041_20140821_vM1_180um.nwb')
Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:
H5O_attr_open_by_name can't locate attribute: 'nwb_version'
H5Aopen unable to load attribute info from object header for attribute: 'nwb_version'
Error in H5A.open (line 34)
id = H5ML.hdf5lib2('H5Aopen', obj_id, attr_name, acpl_id);
Error in util.getSchemaVersion (line 3)
aid = H5A.open(fid, 'nwb_version');
```
### P9HMH_NOID5.nwb
matnwb-master:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\P9HMH_NOID5.nwb')
Unable to resolve the name types.core.VectorData.
Error in io.parseDataset (line 72)
parsed = eval([Type.typename '(kwargs{:})']);
Error in io.parseGroup (line 22)
dataset = io.parseDataset(filename, datasetInfo, fullPath, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in nwbRead (line 33)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
>>
```
matnwb-2.2.5.0:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\P9HMH_NOID5.nwb')
Error using eval
Unrecognized function or variable 'types.core.VectorData'.
Error in io.parseDataset (line 72)
parsed = eval([Type.typename '(kwargs{:})']);
Error in io.parseGroup (line 22)
dataset = io.parseDataset(filename, datasetInfo, fullPath, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in nwbRead (line 33)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
```
### Steinmetz2019_Cori_2016-12-14.nwb
matnwb-2.2.5.0:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\Steinmetz2019_Cori_2016-12-14.nwb')
The class 'types.hdmf_common.Container' is not a superclass of class 'types.core.NWBContainer', as required to invoke a superclass
constructor or method.
Error in types.core.NWBContainer (line 10)
obj = obj@types.hdmf_common.Container(varargin{:});
Error in types.core.NWBDataInterface (line 10)
obj = obj@types.core.NWBContainer(varargin{:});
Error in types.core.TimeSeries (line 45)
obj = obj@types.core.NWBDataInterface(varargin{:});
Error in io.parseGroup (line 85)
parsed = eval([Type.typename '(kwargs{:})']);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in io.parseGroup (line 38)
subg = io.parseGroup(filename, group, Blacklist);
Error in nwbRead (line 33)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
>>
```
matnwb-master: **WORKS**
### sub-626194774_ses-637919731_icephys.nwb
matnwb-2.2.5.0:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\sub-626194774_ses-637919731_icephys.nwb')
Dot indexing is not supported for variables of this type.
Error in file.fillExport>traverseRaw (line 120)
attrmatch = strcmp({raw.attributes.name}, propname);
Error in file.fillExport>traverseRaw (line 111)
res = traverseRaw(suffix, raw.datasets(i));
Error in file.fillExport (line 23)
pathProps = traverseRaw(pnm, raw);
Error in file.fillClass (line 93)
exporterFcns = file.fillExport(nonInherited, class, depnm);
Error in file.writeNamespace (line 22)
fwrite(fid, file.fillClass(className, Namespace, processed, ...
Error in nwbRead>tryWriteSpec (line 103)
file.writeNamespace(namespaceName);
Error in nwbRead>generateSpec (line 91)
if ~tryWriteSpec(name)
Error in nwbRead>checkEmbeddedSpec (line 44)
generateSpec(fid, h5info(filename, specLocation));
Error in nwbRead (line 27)
specLocation = checkEmbeddedSpec(filename);
>>
```
matnwb-master:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\sub-626194774_ses-637919731_icephys.nwb')
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Found "matnwb" root directory at: C:\Users\franc\Downloads\matnwb-master.
Found "namespaces" directory at: C:\Users\franc\Downloads\matnwb-master\namespaces.
Array indices must be positive integers or logical values.
Error in file.fillExport (line 24)
prop = pathProps{end};
Error in file.fillClass (line 93)
exporterFcns = file.fillExport(nonInherited, class, depnm);
Error in file.writeNamespace (line 22)
fwrite(fid, file.fillClass(className, Namespace, processed, ...
Error in nwbRead>tryWriteSpec (line 103)
file.writeNamespace(namespaceName);
Error in nwbRead>generateSpec (line 91)
if ~tryWriteSpec(name)
Error in nwbRead>checkEmbeddedSpec (line 44)
generateSpec(fid, h5info(filename, specLocation));
Error in nwbRead (line 27)
specLocation = checkEmbeddedSpec(filename);
>>
```
### YutaMouse20-140328.nwb
matnwb-2.2.5.0:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\YutaMouse20-140328.nwb')
Error using hdf5lib2
The filename specified was either not found on the MATLAB path or it contains unsupported characters.
Error in H5F.open (line 76)
file_id = H5ML.hdf5lib2('H5Fopen', filename, flags, fapl);
Error in nwbRead>checkEmbeddedSpec (line 40)
fid = H5F.open(filename);
Error in nwbRead (line 27)
specLocation = checkEmbeddedSpec(filename);
>>
>> exist('C:\Work\RawData\Test\NWB\YutaMouse20-140328.nwb')
ans =
2
```
matnwb-master:
```
>> nwb = nwbRead('C:\Work\RawData\Test\NWB\YutaMouse20-140328.nwb')
Error using hdf5lib2
The filename specified was either not found on the MATLAB path or it contains unsupported characters.
Error in H5F.open (line 76)
file_id = H5ML.hdf5lib2('H5Fopen', filename, flags, fapl);
Error in nwbRead>checkEmbeddedSpec (line 40)
fid = H5F.open(filename);
Error in nwbRead (line 27)
specLocation = checkEmbeddedSpec(filename);
>> exist('C:\Work\RawData\Test\NWB\YutaMouse20-140328.nwb')
ans =
2
```