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

Improve warning for types.util.checkUnset #592

Closed
ehennestad opened this issue Sep 12, 2024 · 0 comments · Fixed by #593
Closed

Improve warning for types.util.checkUnset #592

ehennestad opened this issue Sep 12, 2024 · 0 comments · Fixed by #593

Comments

@ehennestad
Copy link
Collaborator

ehennestad commented Sep 12, 2024

The warning which is raised in types.util.checkUnset could be improved and should be different depending on context:

  1. When creating types with properties that are not part of the schema:
types.hdmf_common.VectorIndex('test', 1)
Warning: Unexpected properties {test}.

Your schema version may be incompatible with the file.  Consider checking the schema version of the file with
`util.getSchemaVersion(filename)` and comparing with the YAML namespace version present in nwb-schema/core/nwb.namespace.yaml 
> In types.util.checkUnset (line 18)
In types.hdmf_common.VectorIndex (line 27) 

ans = 

  VectorIndex with properties:

         target: []
    description: ''
           data: []

In this case the issue is not related to the schema version so this warning message is misleading.

  1. When reading a file:
>> nwbRead('~/sub-mouse-INETJ_ses-20200407-sample-10_slice-20200407-slice-1_cell-20200407-sample-10_icephys.nwb')
Warning: Unexpected properties {description}.

Your schema version may be incompatible with the file.  Consider checking the schema version of the file with
`util.getSchemaVersion(filename)` and comparing with the YAML namespace version present in nwb-schema/core/nwb.namespace.yaml 
> In types.util.checkUnset (line 18)
In types.hdmf_common.VectorIndex (line 23)
In io.parseDataset (line 81)
In io.parseGroup (line 22)
In io.parseGroup (line 38)
In io.parseGroup (line 38)
In io.parseGroup (line 38)
In nwbRead (line 79) 

This warning message very little information about which dataset the read operation failed and is difficult to debug.

Suggestion:
Make warning message that:

  1. Clearly states which data type the mentioned property does not belong to.
  2. When reading, state which location in the file the warning is relevant for.
  3. Only mention schema version if file is being read
ehennestad added a commit that referenced this issue Sep 12, 2024
bendichter pushed a commit that referenced this issue Sep 13, 2024
* Adress issue #592

* Update docstring and comments for io.createParsedType

* Add unittest for io.createParsedType

* Update createParsedType.m

Fix: avoid showing warning twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant