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

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.1
File Size Uploaded Provenance Actions
mmg_toolbox-0.8.1.tar.gz 195.8 kB With provenance Details for mmg_toolbox-0.8.1.tar.gz

Built distribution (wheel)

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

Total release size: 397.1 kB

Release files / mmg_toolbox-0.8.1.tar.gz

Download URL mmg_toolbox-0.8.1.tar.gz
Size 195.8 kB
Tags Source
SHA-256 checksum
How to use checksums
85be5c15fb6e229b58b7b1547acb8a9defb3d97cf80f47cf302bca083108af9d
BLAKE2b-256 checksum
How to use checksums
ea1e8f3222ba2f26aa84c48975cf0c270d5fff21d361e2a52ce04ef711b858a3
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 30, 2026.

Transparency log

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

Download URL mmg_toolbox-0.8.1-py3-none-any.whl
Size 201.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e27bee15d42e10e65774ed001231254f2cadd797dfc16d2a96c7bce9e4b3e8b8
BLAKE2b-256 checksum
How to use checksums
fdb54fd2c2e5e611f99d930a13001b3119ede6f15005132ea7e9cb54047249a7
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 30, 2026.

Transparency log

Security for mmg-toolbox 0.8.1

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.1.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 30, 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