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

Support visualizing enum datasets and signals #1688

Merged
merged 6 commits into from
Aug 1, 2024
Merged

Support visualizing enum datasets and signals #1688

merged 6 commits into from
Aug 1, 2024

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Aug 1, 2024

A bunch of commits to make enum datasets first-class citizens and fix #1498.

I've made separate commits, but the gist is that I now treat enum datasets as "numeric-like", just like I did witth booleans. All providers already return numeric values anyway, so it was relatively easy.

In addition to supporting enum datasets in Line/Heatmap, and enum signals/auxiliaries in NX Line/Heatmap, I also add enum support to the Matrix and Scalar vis. In these two visualizations, I even display the enum key rather than the numeric value.

image

image

image

image

@axelboc
Copy link
Contributor Author

axelboc commented Aug 1, 2024

/approve

@axelboc axelboc requested a review from loichuder August 1, 2024 13:25
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

But I wonder: you assume that enums always have numeric underlying values. Is that always the case ? Can HDF5 enum have string values ?

packages/shared/src/hdf5-models.ts Outdated Show resolved Hide resolved
@loichuder
Copy link
Member

But I wonder: you assume that enums always have numeric underlying values. Is that always the case ? Can HDF5 enum have string values ?

Apparently it is always integers: https://docs.hdfgroup.org/hdf5/v1_12/group___e_n_u_m.html ?

@axelboc
Copy link
Contributor Author

axelboc commented Aug 1, 2024

Apparently it is always integers: https://docs.hdfgroup.org/hdf5/v1_12/group___e_n_u_m.html ?

Yeah I remember seeing that it's typically uint8 but allowed to be signed or unsigned int. No floats, strings, etc.

@axelboc axelboc merged commit 9f11603 into main Aug 1, 2024
8 checks passed
@axelboc axelboc deleted the enum-support branch August 1, 2024 14:50
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 this pull request may close these issues.

Need H5Web to support plot True/False and Enum signals
2 participants