Skip to content

DiamondLightSource/mmg_toolbox

Repository files navigation

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

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

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')

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!

About

Repository for useful python data analysis functions for the Diamond Magnetic Materials Group

Resources

License

Stars

Watchers

Forks

Packages

No packages published