Package: hdfviewer
Overviewhdfvieweris a python3 package for inspecting HDF files in the context ofJupyter Labnotebook... overview-beginIt represents each group found in the HDF file as an accordion made of the following subitems:attributes: contains the HDF attributes of this groupgroups: contains the HDF subgroups of this groupdatasets: contains the HDF datasets of this groupIf one of these subitems is empty (e.g. no attributes defined for a given group) the corresponding subitem is omitted.
When one reaches a HDF dataset, informations about the dataset are collected (dimensionality, numeric type, attributes ...) and displayed in a Jupyter output widget. In case of 1D, 2D or 3D dataset, a view of the dataset is also displayed. Depending on the dimensionality of the dataset the display will consist in:1D: simple MatPlotLib 1D plot2D: matrix view of the dataset3D: matrix view of the datasetIn case of2Dand3Ddatasets, the matrix view is made of a 2D image of the selected frame of the dataset (always0for 2D datasets) with a 1D column-projection view of the dataset on its top and a 1D row-projection view of the dataset on its right. The matrix view is interactive with the following interactions:2D:toggle between cross and integration 1D potting mode. In cross plot mode, the 1D projection views represents resp. the row and column of the matrix image point left-clicked by the user. In integration plot mode, the 1D projection views represents the sum over resp. the row and column of the image. To switch between those two modes, press theikey.3D:toggle between cross and integration 1D potting mode. See above.go to the last frame by pressing thepgdnkey.go to the first frame by pressing thepgupkey.go to the next frame by pressing thedownor therightkeys or wheelingdownthe mouse wheelgo to the previous frame by pressing theupor theleftkeys or wheelingupthe mouse downgo the +n (n can be > 9) frame by pressingnnumber followed by thedownor therightkeysgo the -n (n can be > 9) frame by pressingnnumber followed by theupor theleftkeys.. overview-endUsage in a notebook.. usage-begin.. code-block:: python
:caption: Usage in a notebook%matplotlib ipympl

import h5py
from hdfviewer.widgets.HDFViewer import HDFViewer
from hdfviewer.widgets.PathSelector import PathSelector

path = PathSelector(extensions=[".hdf",".h5",".nxs"])
path.widget

if path.file:
    hdf5 = h5py.File(path.file,"r")
    display(HDFViewer(hdf5)).. usage-endPrerequesitespython3 + pipInstallationseehere <https://github.com/jupyter-widgets/ipywidgets/tree/master/packages/jupyterlab-manager>_ for complementary infocdto the directory where lies thesetup.pyfilepip3 install --user .TroubleshootingsYou running the widget on JupyterLab you may have get some text describing the widget instead of the actual widget. This means that you may have to install
thejupyterlab-managerandjupyter-matplotlibextensions. To check this please run the following command:jupyter labextension listIf none or only one of these extensions are mentionned, please run the following commands to install the missing one(s):jupyter labextension install @jupyter-widgets/jupyterlab-managerjupyter labextension install jupyter-matplotlib