NeurodataWithoutBorders / pynwb

A Python API for working with Neurodata stored in the NWB Format
https://pynwb.readthedocs.io
Other
178 stars 84 forks source link

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

Closed lnett99 closed 3 months ago

lnett99 commented 9 months ago

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

ehennestad commented 9 months ago

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.

lawrence-mbf commented 9 months ago

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.

stephprince commented 3 months ago

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