mmg_toolbox
Repository for useful python data analysis functions for the Diamond Magnetic Materials Group
| Source | https://github.com/DiamondLightSource/mmg_toolbox |
|---|---|
| PyPI | pip install mmg_toolbox |
| Documentation | https://diamondlightsource.github.io/mmg_toolbox |
| Releases | https://github.com/DiamondLightSource/mmg_toolbox/releases |
| Conda | https://github.com/conda-forge/hdfmap-feedstock |
Installation
Requires: Python >=3.10, Numpy, h5py, matplotlib, hdfmap, nexus2srs
python -m pip install mmg_toolbox
@DLS
mmg_toolbox is available via the module system:
$ module load mmg
(python)$ dataviewer
# OR
(python)$ create_notebooks
Usage - Read a NeXus scan file
Read data from a NeXus scan file in a python prompt or script
from mmg_toolbox import data_file_reader
scan = data_file_reader('12345.nxs', beamline='i16')
print(scan) # print a metadata string
scan.plot.plot() # plot defaults
scan.plot.show()
Usage - DataViewer
Start the dataviewer from a terminal
$ dataviewer
Or, to open the data viewer in the current folder:
$ dataviewer .
Or, to open the file viewer for a specific file:
dataviewer path/to/file.nxs
Usage - Scripting
mmg_toolbox contains many useful tools for data analysis in python scripts, for example:
import matplotlib.pyplot as plt
from mmg_toolbox import Experiment
exp = Experiment('/path/to/files')
# list scans
all_scans = exp.all_scan_numbers() # {scan_number: filename}
print('\n'.join(exp.scans_str(*all_scans)))
exp.plot(1108746, 1108747, 1108748)
scans = exp.scans(*range(-10, 0))
for scan in scans:
scan.plot()
axes, signal = scan.eval('axes, signal')
create_notebooks
the create_notebooks script is included as a simple way to get started and create some default scripts in your working directory. By default you will be prompted to provide a beamline and a directory or visit ID. The script can then start a Jupyter Lab instance in that directory.
| command | |
|---|---|
$ create_notebooks |
interactively create scripts and start jupyter |
$ create_notebooks -b i10-1 . |
create i10-1 specific scripts in the current directory |
$ create_notebooks --help |
additional options |
Dataviewer
mmg_toolbox contains a tkinter based dataviewer for viewing data in NeXus files. Various plotting and processing
capabilities are available.
Feedback
mmg_toolbox is still under development, so if you have any feedback, found any bugs or have any feature requests - please do let me know!
Metadata
Release files for mmg-toolbox 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mmg_toolbox-0.7.0.tar.gz | 254.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmg_toolbox-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 547.3 kB
Release files / mmg_toolbox-0.7.0.tar.gz
| Download URL | mmg_toolbox-0.7.0.tar.gz |
|---|---|
| Size | 254.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3f15867ef60cdd7f499a1319648fa9985ef8886be552629e90df0edee51d119
|
|
BLAKE2b-256 checksum How to use checksums |
4993294cbc1e770ee905e1f9255e9b82be4f879ca835877f2e9734b4f4772c0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / mmg_toolbox-0.7.0-py3-none-any.whl
| Download URL | mmg_toolbox-0.7.0-py3-none-any.whl |
|---|---|
| Size | 292.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
977eb9d9c6d56908dcc88fea36d05ec073e2fea6f258a14c24940244703a2ac0
|
|
BLAKE2b-256 checksum How to use checksums |
098637077972bdcc715abb00dac6928b1e1bf449bdb11f4d8381b65cd381f8b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for mmg-toolbox 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mmg_toolbox-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.