Read HDF5 data conforming to the NXmx application definition of the NeXus format
Project description
Read NXmx-flavour NeXus HDF5 data in Python
This package provides a neat and tidy Python interface for reading data from HDF5 files that are structured according to the NXmx application definition of the NeXus standard.
Installation
python-nxmx is available as nxmx on PyPI, so you just need Pip.
$ pip install nxmx
Getting started
If you have an HDF5 file in NXmx format, inspecting it with h5ls will look something like this:
$ h5ls -r my-nxmx-file.h5
/ Group
/entry Group
/entry/data Group
/entry/definition Dataset {SCALAR}
/entry/end_time Dataset {SCALAR}
/entry/end_time_estimated Dataset {SCALAR}
/entry/instrument Group
/entry/instrument/beam Group
/entry/instrument/beam/incident_beam_size Dataset {2}
/entry/instrument/beam/incident_wavelength Dataset {SCALAR}
/entry/instrument/beam/total_flux Dataset {SCALAR}
/entry/instrument/detector Group
... etc. ...
With nxmx, you can access the NXmx data in Python like this:
import h5py
import nxmx
with h5py.File("my-nxmx-file.h5") as f:
nxmx_data = nxmx.NXmx(f)
A slightly more detailed example
import h5py
import nxmx
with h5py.File("my-nxmx-file.h5") as f:
nxmx_data = nxmx.NXmx(f)
# Explore the NXmx data structure.
entry, *_ = nxmx_data.entries
print(entry.definition) # Prints "NXmx".
instrument, *_ = entry.instruments
detector, *_ = instrument.detectors
# Get the h5py object underlying an instance of a NX class.
entry_group = entry._handle # entry_group == f["entry"]
# Find instances of a given NX class in a h5py.Group.
beams = nxmx.find_class(instrument._handle, "NXbeam")
# The equivalent for more than one NX class.
beams, detectors = nxmx.find_classes(instrument._handle, "NXbeam", "NXdetector")
# Query attributes of an object in the normal h5py way.
# Suppose out detector has a transformation called "det_z".
transformations, *_ = nxmx.find_class(detector._handle, "NXtransformations")
attrs = transformations["det_z"].attrs # Get the attributes of the "det_z" dataset.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nxmx-0.0.5.tar.gz.
File metadata
- Download URL: nxmx-0.0.5.tar.gz
- Upload date:
- Size: 44.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb3310de9f74404c6b261cc213e5af1e4d7b148731111c17e89ab7695e551b81
|
|
| MD5 |
845fbef1da9d3a4db63d010626ca4a9c
|
|
| BLAKE2b-256 |
dcc8c425fb538cfacbb98f8b0692593278bc18f2f260354ac8b291a0ad7d8945
|
Provenance
The following attestation bundles were made for nxmx-0.0.5.tar.gz:
Publisher:
publish-to-pypi.yml on dials/nxmx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nxmx-0.0.5.tar.gz -
Subject digest:
eb3310de9f74404c6b261cc213e5af1e4d7b148731111c17e89ab7695e551b81 - Sigstore transparency entry: 217074106
- Sigstore integration time:
-
Permalink:
dials/nxmx@31353a6e326d32dd1e233c78225ef0c6ed2f1d5f -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/dials
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@31353a6e326d32dd1e233c78225ef0c6ed2f1d5f -
Trigger Event:
push
-
Statement type:
File details
Details for the file nxmx-0.0.5-py3-none-any.whl.
File metadata
- Download URL: nxmx-0.0.5-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d4aa037e3636c0515074b5821761d73ee2eaf19c18a9cc5e492ddde43e9d90a
|
|
| MD5 |
ec2798e8ab0dbcfce8921e5894ed7633
|
|
| BLAKE2b-256 |
485bb87bb6da816f08e537e1ebcd850f95c4a9c99ae61b17ff56af6161964b5f
|
Provenance
The following attestation bundles were made for nxmx-0.0.5-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on dials/nxmx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nxmx-0.0.5-py3-none-any.whl -
Subject digest:
5d4aa037e3636c0515074b5821761d73ee2eaf19c18a9cc5e492ddde43e9d90a - Sigstore transparency entry: 217074108
- Sigstore integration time:
-
Permalink:
dials/nxmx@31353a6e326d32dd1e233c78225ef0c6ed2f1d5f -
Branch / Tag:
refs/tags/v0.0.5 - Owner: https://github.com/dials
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@31353a6e326d32dd1e233c78225ef0c6ed2f1d5f -
Trigger Event:
push
-
Statement type: