silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
195 stars 19 forks source link

Support visualizing enum datasets and signals #1688

Closed axelboc closed 4 months ago

axelboc commented 4 months ago

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 commented 4 months ago

/approve

loichuder commented 4 months ago

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 commented 4 months ago

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.