Skip to main content

PyPI version Python Version Downloads License: MIT

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:

Documentation: spinlaboratory.com


Features

  • Universal data import — load data from 13 spectrometer formats with automatic format detection
  • N-dimensional data objects — the SpinData object 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 figuresfancy_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 SpinData objects 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:

spinlaboratory.com


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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spinlab-1.1.4.tar.gz (106.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spinlab-1.1.4-py3-none-any.whl (129.1 kB view details)

Uploaded Python 3

File details

Details for the file spinlab-1.1.4.tar.gz.

File metadata

  • Download URL: spinlab-1.1.4.tar.gz
  • Upload date:
  • Size: 106.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for spinlab-1.1.4.tar.gz
Algorithm Hash digest
SHA256 c4b2e2ea8b7eaa8f86807f6b9f7258b005c1836c9dae948b86f961a8d5e5cbd7
MD5 bc58e249301e04c692e71db250910acd
BLAKE2b-256 84e9675f2fb636d1a79eaa3d98253545aa39aab8ed139e7b97cd9f7f43bfcc8b

See more details on using hashes here.

File details

Details for the file spinlab-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: spinlab-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 129.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for spinlab-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3e5bcf7172c7911be62cbaa98dc795e681e8a46f318c22a242a07201594553da
MD5 a787df644f1492c71a93e0be39ed4acf
BLAKE2b-256 56483d61fc833645470f874898ed7383e53a09036725433cea7309b236192162

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 files

1.1.3

2 files

1.1.2

2 files

1.1.0

2 files

1.0.0

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 files

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