Skip to content

Commit

Permalink
update extension tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Dec 23, 2024
1 parent 0d4a40b commit a021475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions docs/gallery/general/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
ns_builder = NWBNamespaceBuilder(
"Extension for use in my Lab", "mylab", version="0.1.0"
)

ns_builder.include_type("ElectricalSeries", namespace="core")
ns_builder.include_namespace("core")

ext = NWBGroupSpec(
"A custom ElectricalSeries for my lab",
Expand Down Expand Up @@ -264,7 +263,7 @@ def __init__(self, **kwargs):
ext_source = name + ".extensions.yaml"

ns_builder = NWBNamespaceBuilder(name + " extensions", name, version="0.1.0")
ns_builder.include_type("NWBDataInterface", namespace="core")
ns_builder.include_namespace("core")

potato = NWBGroupSpec(
neurodata_type_def="Potato",
Expand Down
4 changes: 3 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def validate_nwbs():
is_family_nwb_file = False
try:
with pynwb.NWBHDF5IO(nwb, mode='r') as io:
errors = validate(io, use_cached_namespaces=False) # previously io did not validate against cached namespaces
errors = validate(io, use_cached_namespaces=False)
errors.extend(validate(io, use_cached_namespaces=True))
except OSError as e:
# if the file was created with the family driver, need to use the family driver to open it
if 'family driver should be used' in str(e):
Expand All @@ -180,6 +181,7 @@ def validate_nwbs():
with h5py.File(filename_pattern, mode='r', driver='family', memb_size=memb_size) as f:
with pynwb.NWBHDF5IO(file=f, manager=None, mode='r') as io:
errors = validate(io, use_cached_namespaces=False)
errors.extend(validate(io, use_cached_namespaces=True))
else:
raise e

Expand Down

0 comments on commit a021475

Please sign in to comment.