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]: Validation error when passing a "0" integer #393

Open
rettigl opened this issue Jul 28, 2024 · 0 comments
Open

[Bug]: Validation error when passing a "0" integer #393

rettigl opened this issue Jul 28, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@rettigl
Copy link
Collaborator

rettigl commented Jul 28, 2024

Contact Details

[email protected]

What happened?

When a field with type "NX_FLOAT" gets filled by a "0" integer (rather than "0.0" float), the checking routine reports this key as undocumented. Specifically, the value is converted to float here:

return accepted_types[0](value)

This returns 0, which in turn makes this check fail:
if is_documented(not_visited_key, tree):

and hence the value ends up in undocumented.
This is tested on the multi-format-reader, but should apply to main as well.

Relevant log output

This is output from the Tutorial 3 of the sed package, which uses the mpes reader and pynxtools converter internally:

Input:
sp.binned.attrs["metadata"]["energy_calibration"]["tof"] = 0
sp.save(data_path + "/binned.nxs")

Output:
Using mpes reader to convert the given files:  
• ../sed/config/NXmpes_config.json
Field /ENTRY[entry]/PROCESS_MPES[process]/energy_calibration/original_axis written without documentation.
The output file generated: /mnt/pcshare/users/Laurenz/AreaB/sed/sed/tutorial/datasets/WSe2/binned.nxs.

Input: 
sp.binned.attrs["metadata"]["energy_calibration"]["tof"] = 0.0
sp.save(data_path + "/binned.nxs")

Output:
Using mpes reader to convert the given files:  
• ../sed/config/NXmpes_config.json
The output file generated: /mnt/pcshare/users/Laurenz/AreaB/sed/sed/tutorial/datasets/WSe2/binned.nxs.
@rettigl rettigl added the bug Something isn't working label Jul 28, 2024
@lukaspie lukaspie added the good first issue Good for newcomers label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants