ScippNexus#

An h5py-like utility for NeXus files with seamless Scipp integration

ScippNexus provides a link between the HDF5-based NeXus Data Format and scipp. This is possible since NeXus classes (a specification of an HDF5 group and the contained dataset) such as NXdata partially resemble Scipp’s DataArray.

h5py is a convenient and powerful tool for accessing groups, datasets, and attributes in an HDF5 file. However, it operates on a lower level than the NeXus class definitions, which typically treat an entire group as a distinct entity.

ScippNexus can obviate the need for lengthy low-level code. It provides an h5py-like API, but applies the paradigm at the NeXus-class level. This is especially powerful since a number of concepts of Scipp map well to concepts of NeXus:

  • NeXus classes such as NXdata define dimension scales, which correspond to coordinates in the Scipp terminology. From a user’s point of view we can thus treat an NXdata group in a file as an entity that can be loaded directly into a scipp.DataArray.

  • Labeled dimension can be used to selectively load slices of an entire NeXus class. This is modelled after h5py’s support for loading slices of datasets but provides the same convenience and safety as scipp’s slicing by requiring specification of the dimension to slice by its name, rather than plain axis order.

  • Physical units are stored with most datasets in a NeXus class and are loaded as unit of the scipp.DataArray values or coordinates.

News#

  • [November 2022] scippnexus-0.4.0 has been released. This provides and experimental mechanism for customizing reading and writing of data based on NeXus application definitions.

  • [September 2022] scippnexus-0.3.0 has been released.

  • [August 2022] scippnexus-0.2.0 has been released. This provides more convenient access to child groups based on the NX_class attribute.

Get in touch#

  • If you have questions that are not answered by these documentation pages, ask on GitHub discussions. Please include a self-contained reproducible example if possible.

  • Report bugs (including unclear, missing, or wrong documentation!), suggest features or view the source code on GitHub.