Repository for useful python data analysis functions for the Diamond Magnetic Materials Group
Project description
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
# 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!
Project details
Release history Release notifications | RSS feed
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 mmg_toolbox-0.6.2.tar.gz.
File metadata
- Download URL: mmg_toolbox-0.6.2.tar.gz
- Upload date:
- Size: 213.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b7bedde279fb4a270fe6d350b274da2ee5125c10d2674e5751810a6d36695fa
|
|
| MD5 |
f4acff8445fcf7b025d1b6db4ad3a72c
|
|
| BLAKE2b-256 |
c1009f8d4e2ab0c29abbaaf8ebddfc922f4409d6239b107722540bdf908cd668
|
Provenance
The following attestation bundles were made for mmg_toolbox-0.6.2.tar.gz:
Publisher:
pypi-publish.yml on DiamondLightSource/mmg_toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mmg_toolbox-0.6.2.tar.gz -
Subject digest:
1b7bedde279fb4a270fe6d350b274da2ee5125c10d2674e5751810a6d36695fa - Sigstore transparency entry: 1309392548
- Sigstore integration time:
-
Permalink:
DiamondLightSource/mmg_toolbox@1aaa48d63f33e7764fc7c8981183e1efad065e75 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/DiamondLightSource
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1aaa48d63f33e7764fc7c8981183e1efad065e75 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mmg_toolbox-0.6.2-py3-none-any.whl.
File metadata
- Download URL: mmg_toolbox-0.6.2-py3-none-any.whl
- Upload date:
- Size: 245.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1ad59315a956db3a1c0e6afb126d41a5ce6c0bc37948361800c61feaed2ca89
|
|
| MD5 |
217357b7ef428445aee686fd097c41ec
|
|
| BLAKE2b-256 |
67c2bc14550fac406aaae682794c162bfccfd825808d8ec8a00bf741bf2f0441
|
Provenance
The following attestation bundles were made for mmg_toolbox-0.6.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on DiamondLightSource/mmg_toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mmg_toolbox-0.6.2-py3-none-any.whl -
Subject digest:
e1ad59315a956db3a1c0e6afb126d41a5ce6c0bc37948361800c61feaed2ca89 - Sigstore transparency entry: 1309392608
- Sigstore integration time:
-
Permalink:
DiamondLightSource/mmg_toolbox@1aaa48d63f33e7764fc7c8981183e1efad065e75 -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/DiamondLightSource
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1aaa48d63f33e7764fc7c8981183e1efad065e75 -
Trigger Event:
push
-
Statement type: