Skip to main content

PyPI License

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, scipy, lmfit, 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

The DataViewer has now been moved out of mmg_toolbox and into a separate repository. See mmg_tk_dataviewer.

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. mmg_dataviewer

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.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmg-toolbox 0.8.0
File Size Uploaded Provenance Actions
mmg_toolbox-0.8.0.tar.gz 192.6 kB With provenance Details for mmg_toolbox-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mmg-toolbox 0.8.0
File Interpreter ABI Platform Actions
mmg_toolbox-0.8.0-py3-none-any.whl Python 3 none any Details for mmg_toolbox-0.8.0-py3-none-any.whl

Total release size: 391.6 kB

Release files / mmg_toolbox-0.8.0.tar.gz

Download URL mmg_toolbox-0.8.0.tar.gz
Size 192.6 kB
Tags Source
SHA-256 checksum
How to use checksums
50e06e20228e3019c42c7307148322fa9dfc2888e2bcd7addeceab8570a8ddb3
BLAKE2b-256 checksum
How to use checksums
2c4c8f620b4271ecb9e2605e303c72e091b42afe930dfedf18e2aa64333d5c12
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 Nov 25, 2026.

Transparency log

Release files / mmg_toolbox-0.8.0-py3-none-any.whl

Download URL mmg_toolbox-0.8.0-py3-none-any.whl
Size 199.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73fbfa93f955293b99475de3a3d5a1ca96a18ed9aa4eaa4384bee7b80a3c6dc1
BLAKE2b-256 checksum
How to use checksums
446c46771623e3b0a04c0ce542b34bf52d4f0499c620e9f36af98f747fdb8ab6
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 Nov 25, 2026.

Transparency log

Security for mmg-toolbox 0.8.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mmg_toolbox-0.8.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 Nov 25, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page