Skip to content
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

[Bug]: Schema are not cached in NWB file #673

Open
2 tasks done
rly opened this issue Feb 28, 2025 · 3 comments · May be fixed by #674
Open
2 tasks done

[Bug]: Schema are not cached in NWB file #673

rly opened this issue Feb 28, 2025 · 3 comments · May be fixed by #674

Comments

@rly
Copy link
Contributor

rly commented Feb 28, 2025

What happened?

I think this is new behavior, but if I create an NWB file without calling generateCore, the schema is not cached in the file.

Image

The specifications group is empty. The schema should be cached by default.

The tutorial instructions do not say to call generateCore.

See also NeurodataWithoutBorders/pynwb#2046 (comment)

Steps to Reproduce

Following abbreviated steps from https://matnwb.readthedocs.io/en/latest/pages/tutorials/intro.html

1. git clone matnwb from github

addpath(genpath(pwd));
nwb = NwbFile( ...
    'session_description', 'mouse in open exploration',...
    'identifier', 'Mouse5_Day3', ...
    'session_start_time', datetime(2018, 4, 25, 2, 30, 3, 'TimeZone', 'local'));
nwbExport(nwb, 'empty_nwbfile.nwb')

Error Message

Operating System

macOS

Matlab Version

R2024b

Code of Conduct

@ehennestad
Copy link
Collaborator

ehennestad commented Mar 1, 2025

Hi Ryan,

You are right, this is new behavior (following this PR: #615).

The old behavior was that all cached namespace schemas were embedded in the file, even though available namespaces types were not in use.

The PR changed the mechanism of embedding so that only namespace specifications of types that are included within the file are embedded.

What you are observing is the case where the file does not have any neurodata types included, and thus no specifications are embedded (running generateCore would not change this behavior).

We considered an empty file without any neurodata types to be an edge-case which does not happen in the real world. I could change the rule of embedding specifications to also consider the NwbFile itself, what do you think?

@rly
Copy link
Contributor Author

rly commented Mar 1, 2025

Interesting. I think the NwbFile itself should be included, so that all NWB files have core and hdmf-common always cached by default.

ehennestad added a commit that referenced this issue Mar 1, 2025
@ehennestad
Copy link
Collaborator

ehennestad commented Mar 5, 2025

Realizing that there are two different bugs here.

  1. PR Change: Only embed specs/namespaces for types that are included in NWB file on export #615 introduced a change where namespace specs are not embedded in an NWB file which is "empty", i.e does not have any included neurodata types.

  2. When running nwbExport, the specifications are embedded from a "namespace cache" which is only present after running generateCore. If someone makes a fresh clone from GitHub without running generateCore, the specs are not embedded.

This commit should fix point 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants