Closed pgleeson closed 4 years ago
@ageorgou Any thoughts on this?
@pgleeson Looking into this now. The namespaces are cached in the file, but I think there is a bug in one of the custom types. Will update when fixed.
@pgleeson we have found a work-around at least:
io = NWBHDF5IO("C:\\Users\\Alessandro\\Documents\\UCL-projects\\silverlab\\Data\\nwb2\\sample_pointing_videos_161215_15_34_21.nwb" ,
'r', extensions = 'src\\silverlabnwb\\silverlab.namespace.yaml')
io.read()
this requires the path to an additional file "silverlab.namespace.yaml" found in the GitHub repo under src\\silverlabnwb\\
, which defines the custom silverlab extension. Remember to adapt the direction of the slashes "\","/" to your OS. Hope this helps!
@pgleeson Did the above workaround work for you? We've found this to also work (adjusting for where you're running it from):
from pynwb import get_class, load_namespaces, NWBHDF5IO
load_namespaces('src/silverlabnwb/silverlab.namespace.yaml')
get_class('ZplanePockelsDataset', 'silverlab_extended_schema')
io = NWBHDF5IO(nwb_file, 'r')
Essentially we need to load the definition of that one class first, or the namespace won't be reconstructed correctly. We're still trying to find out whether this is because we are doing something wrong or an issue with the extension mechanism.
@ageorgou Thanks, that new suggestion worked. I've managed to load one of your example NWB2 file locally and view it with a slightly modified NWBExplorer (see below). Will do some more tests on other files over the next few days, and then arrange a meeting together with @jonc125 for a general update.
Confirmed to be an issue with the pynwb backend. Will be fixed in hdmf-dev/hdmf#322.
Also see an alternative way of structuring the extension which should work with the current version of pynwb/hdmf.
Update: the resolution has been in the development version of hdmf
since March 26, but there hasn't been a new release yet, so it won't be automatically included even when installing the latest pynwb
(version 1.3).
The latest version requires pynwb 1.3.2
, which should read the stored namespaces directly without the workaround above. We'll make a release soon, but for now it's available in master
(currently 3c5816c87e23569002187b9ce096113487ef797b).
@pgleeson We'll wait for you to confirm that you can read the files before closing.
Great! Will try to try this out before our meeting next week on Friday
As mentioned on Friday, works fine for me with namespace cached. Thnaks.
Testing with latest generated examples on OneDrive. Should I be able to just load using:
I'm getting the following error: