SpinLab — Bringing the Power of Python to MR Spectroscopy
SpinLab is an open-source, object-oriented Python package for importing, processing, and analyzing data from:
- Electron Paramagnetic Resonance (EPR) spectroscopy
- Nuclear Magnetic Resonance (NMR) spectroscopy
- Dynamic Nuclear Polarization (DNP) spectroscopy
Documentation: spinlaboratory.com
Features
- Universal data import — load data from 13 spectrometer formats with automatic format detection
- N-dimensional data objects — the
SpinDataobject keeps data, axes, and experimental parameters together at all times - Comprehensive processing — apodization (7 window functions), Fourier transform with zero-filling, phase correction, baseline removal, alignment, integration, and more
- Analysis tools — relaxation fitting, peak finding, DNP enhancement profile simulation
- Publication-quality figures —
fancy_plot()automatically applies axis labels and formatting based on the experiment type - Processing audit log — every processing step is automatically recorded with its parameters for full reproducibility
- HDF5 save/load — store complete
SpinDataobjects including axes, attributes, and audit log
Supported File Formats
| Spectrometer / Software | Extension |
|---|---|
| Bruker Xepr / Elexsys (BES3T) | .DSC, .DTA |
| Bruker WinEPR / ESP | .par, .spc |
| Bruker TopSpin | experiment directory |
| Varian / Agilent VnmrJ | .fid directory |
| JEOL Delta | .jdf |
| Magritek Prospa | .1d, .2d, .3d, .4d |
| FeMi SpecMan4EPR | .d01, .exp |
| Tecmag TNMR | .tnt |
| RS2D | .xml, .dat |
| VNA (S-parameters) | .s1p, .s2p |
| SpinLab HDF5 | .h5 |
| CSV | (via sl.load_csv()) |
Quick Start
import spinlab as sl
# Load data — format detected automatically
data = sl.load("spectrum.DTA")
# Inspect the data object
print(data)
# Plot
sl.plt.figure()
sl.plot(data)
sl.plt.show()
NMR processing workflow:
import spinlab as sl
data = sl.load("experiment/1/") # load TopSpin FID
data = sl.apodize(data, kind="exponential", lw=5) # line broadening
data = sl.fourier_transform(data, zero_fill_factor=2) # FFT with zero-filling
data = sl.phase(data, p0=12.5) # phase correction
data = sl.remove_background(data, deg=1) # baseline correction
sl.plt.figure()
sl.plot(data)
sl.plt.show()
sl.save(data, "processed.h5") # save result
Installation
SpinLab requires Python 3.10 or higher.
pip install spinlab
To upgrade an existing installation:
pip install --upgrade spinlab
Documentation
Full documentation including user guides, processing reference, and API reference is available at:
Development
Contributions are welcome! See the Contributing Guide for details on setting up a development environment, running tests, and opening pull requests.
git clone https://github.com/SpinLab/spinlab
cd spinlab
pip install -e spinlab
python -m pytest
Citing SpinLab
If you use SpinLab to process data for a publication, please add a reference to the SpinLab documentation in your Materials and Methods section.
Authors
Current maintainers: Timothy Keller, Yen-Chun Huang, Thorsten Maly
SpinLab originally started as DNPLab, created by:
License
SpinLab is released under the MIT License.
Metadata
Release files for spinlab 1.1.5
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 | Actions |
|---|---|---|---|---|
| spinlab-1.1.5.tar.gz | 119.6 kB | Without provenance | Details for spinlab-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spinlab-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for spinlab-1.1.5-py3-none-any.whl |
Total release size: 265.0 kB
Release files / spinlab-1.1.5.tar.gz
| Download URL | spinlab-1.1.5.tar.gz |
|---|---|
| Size | 119.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea6d99610864170a315b60570e999ac06fee546e61ac92aac8add4db17c136f2
|
|
BLAKE2b-256 checksum How to use checksums |
97326852af3363b43c369ae83076560e30547bda58f6ec4a2c87bc32e5c64f75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / spinlab-1.1.5-py3-none-any.whl
| Download URL | spinlab-1.1.5-py3-none-any.whl |
|---|---|
| Size | 145.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d4b1c9b218f23ccc3c3a62073dd8f97b8f26d83833e54e0b4dbab92d7d42ce5
|
|
BLAKE2b-256 checksum How to use checksums |
baa033200eea636f4fe53c4fba24d1302d66e1c197385ef3b298aa4f96e5765b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for spinlab 1.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.