NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

can't load NWB file from a directory outside of main matnwb directory #362

Closed cechava closed 2 years ago

cechava commented 2 years ago

trying to read in a file from outside of matnwb file produces the following error:

>> readFile = nwbRead('test_export.nwb');
28  if any(saveDirMask)
Error using save
Cannot create 'core.mat' because 'namespaces' does not
exist.

Error in spec.saveCache (line 10)
save(cachePath, '-struct', 'NamespaceInfo');

Error in nwbRead>generateSpec (line 123)
    spec.saveCache(Namespace, saveDir);

Error in nwbRead (line 54)
        generateSpec(filename, h5info(filename,
        specLocation), 'savedir', saveDir);

I verified that the namespaces folder is in my MATLAB search path (abridged below for readability)

>> path

        MATLABPATH

    /Users/cesar/Repositories/matnwb/external_packages/datenum8601
    /Users/cesar/Repositories/matnwb
    /Users/cesar/Repositories/matnwb/.git
    /Users/cesar/Repositories/matnwb/.git/hooks
    /Users/cesar/Repositories/matnwb/.git/info
    /Users/cesar/Repositories/matnwb/.git/logs
    /Users/cesar/Repositories/matnwb/.git/logs/refs
    /Users/cesar/Repositories/matnwb/.git/logs/refs/heads
    /Users/cesar/Repositories/matnwb/.git/logs/refs/remotes
    /Users/cesar/Repositories/matnwb/.git/logs/refs/remotes/origin
    /Users/cesar/Repositories/matnwb/.git/objects
    /Users/cesar/Repositories/matnwb/.git/objects/00
    /Users/cesar/Repositories/matnwb/.git/objects/02
    /Users/cesar/Repositories/matnwb/.git/objects/04
    /Users/cesar/Repositories/matnwb/.git/objects/05
    /Users/cesar/Repositories/matnwb/.git/objects/06
    /Users/cesar/Repositories/matnwb/.git/objects/07
....
    /Users/cesar/Repositories/matnwb/.git/objects/info
    /Users/cesar/Repositories/matnwb/.git/objects/pack
    /Users/cesar/Repositories/matnwb/.git/refs
    /Users/cesar/Repositories/matnwb/.git/refs/heads
    /Users/cesar/Repositories/matnwb/.git/refs/remotes
    /Users/cesar/Repositories/matnwb/.git/refs/remotes/origin
    /Users/cesar/Repositories/matnwb/.git/refs/tags
    /Users/cesar/Repositories/matnwb/doc
    /Users/cesar/Repositories/matnwb/external_packages
    /Users/cesar/Repositories/matnwb/external_packages/fastsearch
    /Users/cesar/Repositories/matnwb/installer
    /Users/cesar/Repositories/matnwb/jar
    /Users/cesar/Repositories/matnwb/namespaces
    /Users/cesar/Repositories/matnwb/nwb-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.0.2
    /Users/cesar/Repositories/matnwb/nwb-schema/2.0.2/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.1.0
    /Users/cesar/Repositories/matnwb/nwb-schema/2.1.0/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.0
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.0/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.0/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.0/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.1
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.1/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.1/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.1/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.2
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.2/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.2/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.2/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.3
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.3/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.3/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.3/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.4
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.4/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.4/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.4/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.5
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.5/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.5/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.2.5/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.3.0
    /Users/cesar/Repositories/matnwb/nwb-schema/2.3.0/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.3.0/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.3.0/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/nwb-schema/2.4.0
    /Users/cesar/Repositories/matnwb/nwb-schema/2.4.0/core
    /Users/cesar/Repositories/matnwb/nwb-schema/2.4.0/hdmf-common-schema
    /Users/cesar/Repositories/matnwb/nwb-schema/2.4.0/hdmf-common-schema/common
    /Users/cesar/Repositories/matnwb/tutorials
    /Users/cesar/Repositories/matnwb/tutorials/html
    /Users/cesar/Repositories/matnwb/utilities
    /Users/cesar/Repositories/matnwb/utilities/maintenance
    /Users/cesar/Documents/MATLAB
....
cechava commented 2 years ago

Probably a result from one of the recent merges since this used to work without problem.

lawrence-mbf commented 2 years ago

Can't quite reproduce it but I do have a fix for nwbRead not using your core namespace directory. MatNWB usage should only require adding the root matnwb directory to path.