Open vilim opened 2 years ago
Hi @vilim ,
In your ndx-zebrafish.namespace.yaml
file, you have written that ZebrafishBehavior
is a neurodata type to include from the NWB core
namespace. However, this is a type that you define in your extension; it does not exist in the core
namespace.
To fix this, remove this line: https://github.com/nwb-zebrafish/ndx-zebrafish/blob/2f8b373b6cc93822ec71de651df11dc00c0bd530/src/spec/create_extension_spec.py#L29
When I removed this line and tried to import your extension, I found another error:
TypeError: NWBDatasetSpec.__init__: incorrect type for 'neurodata_type_inc' (got 'NWBGroupSpec', expected 'NWBDatasetSpec or str')
This is because your extension specifies datasets with the neurodata type "Orientation", "TailShape", and "Coordinates" which extend the neurodata type "SpatialSeries". However, "SpatialSeries" is a Group, not a Dataset, so these objects should be added to the "ZebrafishBehavior" neurodata type with the method add_group
, not add_dataset
.
Finally, we recommend as best practice, not defining a type in place where it is used - meaning do not use "neurodata_type_def" within add_group
or add_dataset
(I will add a warning to PyNWB to mention this anti-pattern). Instead, we recommend either:
NWBGroupSpec
, just like you did for "ZebrafishBehavior" and remove "neurodata_type_def" from add_dataset
(which should be changed to add_group
per the above)I would recommend option 2 here unless you plan to add additional attributes, datasets, groups, or links within "Orientation", "TailShape", and "Coordinates".
Please let me know if you have any questions.
What happened?
I am trying to follow the tutorial on creating new NWB extensions here however I am stuck after auto-generating the spec and creating the python module. When I try to import the module, the
load_namespaces
function fails to load the new type that I defined increate_extension_spec
and that generated the two yamls, which look exactly like all yamls I could see from all extensions.The extension I am trying to build is at: https://github.com/nwb-zebrafish/ndx-zebrafish the current state of the
main
branchSteps to Reproduce
Traceback
Operating System
Linux
Python Executable
Python
Python Version
3.8
Package Versions
No response
Code of Conduct