-
Notifications
You must be signed in to change notification settings - Fork 16
Use ExternalImage.data instead of file_path #623
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
Conversation
|
I see.
Question: Lines 1 to 4 in 5105b00
And And I am not sure where, when and how is the constrained declared. |
|
Because the type is a dataset spec and not a group spec, the type automatically has a required data element as well as |
|
A different way to say this is that a dataset spec defines a data array |
|
Thanks, would it be fair that is enforced by the schema language? It is just that I don't see anywhere where this is written explicitly: https://hdmf-schema-language.readthedocs.io/en/latest/description.html#sec-dataset-spec Not questioning this of course, just wondering if we should better document this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for moving this forward. I still think that file_path is a better name for this but this should work.
I guess another option would to leave data as an empty string and still use the attribute somehow? but maybe that has problems as well and some redundancy.
What do you mean by this? I agree - we could be more clear in the schema docs. I created hdmf-dev/hdmf-schema-language#46 to track that improvement.
Yes that is an option but it feels a bit redundant / messy. |
I might be a bit confused, but I think what I'm trying to say is the following: Here: Lines 29 to 33 in 5105b00
the schema enforces that there must be a name attribute. And here: nwb-schema/core/nwb.ecephys.yaml Lines 17 to 27 in 5105b00
the schema enforces that there must be a dataset named data, including its dtype and shape. So I think my confusion comes from expecting something like this:
Right, I trust your instinct on this kind of thing. |
|
I see. Yes, this is enforced or declared by the schema language itself. In the same way that this yaml within a group spec declares a dataset named "data" with a specific dtype and shape, nwb-schema/core/nwb.ecephys.yaml Lines 17 to 27 in 5105b00
This yaml declares a dataset without a name but with a neurodata type "BaseImage" with default dtype and shape: datasets:
- neurodata_type_def: BaseImage
neurodata_type_inc: NWBData
doc: An abstract base type for image data. Parent type for Image and ExternalImage types.
attributes:
- name: description
dtype: text
doc: Description of the image.
required: falseDataset data types are not used often (mostly Image and VectorData subtypes). I admit that how they work sometimes confuses me too. |
Co-authored-by: Steph Prince <[email protected]>
Summary of changes
From #604: the new
BaseImagetype is a dataset where the data has no constraints on dtype or shape but is required. The newExternalImagehas an attribute forfile_pathbut because it inherits fromBaseImage, it is also a dataset and therefore has a required data value. @oruebel and I think thatExternalImage.datashould be used to store the scalar string file path instead of the attribute.We cannot yet specify that
ExternalImage.datamust be a scalar, so we leave the shape to be Any shape.shape: scalarwill be supported in the new 2.0 schema language.Checklist
For all schema changes:
docs/format/source/format_release_notes.rst.hdmf-common-schemapoints to the latest release and not the latest commit on themainbranch.If this is the first schema change after a schema release (i.e., the version string in
core/nwb.namespace.yamldoes notend in "-alpha"), then:
core/nwb.namespace.yamlandcore/nwb.file.yamlto the next major/minor/patchversion with the suffix "-alpha". For example, if the current version is 2.4.0 and this is a minor change, then the
new version string should be "2.5.0-alpha".
versionvariable indocs/format/source/conf.pyto the next version without thesuffix "-alpha", e.g., "2.5.0".
releasevariable indocs/format/source/conf.pyto the next version with the suffix"-alpha", e.g., "2.5.0-alpha".
docs/format/source/format_release_notes.rstfor the new versionwith the date "Upcoming" in parentheses.