pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

Naming Discrepancy: 'general' Prefix in MATLAB vs Python NWB File Format

Open lnett99 opened this issue 1 year ago • 2 comments

What would you like changed or added to the documentation and why?

Hello, I am currently exploring the NWB file format using the pynwb library in Python and noticed a naming difference compared to the MATLAB version.

In Python, names such as experiment_description do not include the "general" prefix, whereas in MATLAB, the corresponding fields are named with the prefix, such as general_experiment_description. I'm curious about the reasoning behind this distinction and whether it reflects a design choice or if there is a specific rationale behind it.

Do you have any interest in helping write or edit the documentation?

No.

Code of Conduct

lnett99 avatar Feb 05 '24 08:02 lnett99

Hi,

This is a difference in the API and I don't know the rationale behind it, but the experiment description is part of the general root group of the NWB file. In MATLAB, the hierarchical organisation of groups in the NWB file is presented as a flattened list of properties in the NwbFile object, with the group- and subgroup-names joined with an underscore, so general_experiment_description just indicates the the experiment_description is part of the general group. This should have no practical difference when the NWB file is created/written to. Perhaps @lawrence-mbf could elaborate on why the matnwb package has a different implementation.

ehennestad avatar Feb 14 '24 12:02 ehennestad

The flattening of the MatNWB structure was so that users did not also need to handle generic HDF5 "group" object types which would make configuration even more complicated. Instead, the necessary groups are identified and generated on export. The reason for the property prefixes is partially for the user but also for other file generation tasks that require searching through the schema's group hierarchy without actually having knowledge of the full schema. You can see a simplified version of this in the io.resolvePath function which is also used by NwbFile's resolve method.

lawrence-mbf avatar Feb 14 '24 14:02 lawrence-mbf

I believe this question was answered and will close this issue for now. Please reopen if you have any further questions!

stephprince avatar Jul 25 '24 23:07 stephprince