-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overridden dataset dtype and shape are not passed from parent to child #320
Comments
I encountered this while doing some validator testing. This also applies when the datasets are defined with specific inheritance, eg:
Only the attribute It looks like the default inheritance passes down specification elements defined on the dictionary accessible via It looks like the current implementation of #321 treats this by passing down the shape, etc of child attributes when a parent is inherited (e.g.
It looks like #321 might be a bit stale, so maybe a lot has changed between then and hdmf 2.5.1. And I'm not entirely sure I'm clear on how everything is supposed to happen with spec inheritance, so maybe there's something I did wrong with my tests. But it'd be good to validate that #321 does resolve the above situation. |
To be a bit more clear, here's a test case I was working from:
import os
from hdmf.spec import NamespaceBuilder, export_spec, AttributeSpec, DatasetSpec, GroupSpec
namespace_name = 'foo'
ns_builder = NamespaceBuilder(doc='Test namespace', name=namespace_name, version='0.1.0')
d1_spec = DatasetSpec(doc='d1', data_type_def='D1', shape=[None, None], dims=['dim1', 'dim2'], dtype='numeric',
attributes=[AttributeSpec(name='foo', doc='an attribute', dtype='text')])
d2_spec = DatasetSpec(doc='d2', data_type_def='D2', data_type_inc='D1')
g1_spec = GroupSpec(doc='g1', data_type_def='G1', datasets=[d2_spec])
output_dir = 'test-spec'
if not os.path.exists(output_dir):
os.mkdir(output_dir)
export_spec(ns_builder, [d1_spec, d2_spec, g1_spec], str(output_dir))
from hdmf import common
common.load_namespaces(os.path.join(output_dir, f'{namespace_name}.namespace.yaml'))
ns_catalog = common.get_manager().namespace_catalog
ns = ns_catalog.get_namespace(name=namespace_name)
print(ns.get_spec('D1'))
print(ns.get_spec('D2'))
print(ns.get_spec('G1')) Output:
I would expect |
If a schema has two groups, e.g.,
PatchClampSeries
andCurrentClampSeries
defined as such:where the
'data'
dataset inCurrentClampSeries
overrides the'data'
dataset in the parentPatchClampSeries
, then thedtype
,dims
, andshape
keys of the parentPatchClampSeries
'data'
dataset are not inherited by the childCurrentClampSeries
'data'
dataset.Is this intended behavior? @oruebel @ajtritt
If so, the NWB schema needs to be amended in a few places.
The text was updated successfully, but these errors were encountered: