ionhop: ss-NMR lineshape and relaxation analysis made easy
ionhop is an open-source Python package for solid-state NMR data analysis. It merges two
previously separate tools into one install:
ionhop.lineshape— peak deconvolution and lineshape analysis for 1D spectra (formerly published asnmrlineshapeanalyser)ionhop.relaxometry— relaxation time analysis: T1, T1_rho and T2 (formerly published asrelaxometrynmr)
Both modules are compatible with Bruker's NMR data; the lineshape module also accepts spectrum data saved as CSV.
Why ionhop?
Lineshape analysis (ionhop.lineshape)
- easy and fast processing of either lineshape spectral analysis or peak deconvolution
- works directly from processed Bruker data, e.g.
data/single_peak/10/pdata/1 - for the optimisation, you only need to input the peak position(s), it does the rest
- freedom to fix or optimise position(s), amplitude, width, or eta (Gaussian/Lorentzian mixing) for each peak independently
- detailed Pseudo-Voigt fit statistics saved to a txt file
- peak deconvolution reports the percentage contribution of each peak
- exports fit and data as CSV and the fit as a publication-quality PNG
Relaxometry (ionhop.relaxometry)
- streamlines T1, T1_rho and T2 analysis and cuts analysis time by more than 50%
- built-in mono-, di-, tri-, and stretched-exponential models for simple to complex relaxation behaviour
- automatic delay-list detection (vdlist, vplist, vclist)
- zero-filling, 0th/1st-order phase correction, Gaussian apodisation
- trapezoid and Simpson's-rule numerical integration for peak area
- full-spectrum and zoomed-in views for context and detail
Install
pip install ionhop
Dependencies
nmrglue
numpy >= 1.26.0
scipy
matplotlib >= 3.9.0
pandas >= 2.2.0
mrsimulator == 1.0
A Single Peak Fitting Example (ionhop.lineshape)
from ionhop.lineshape import NMRProcessor
# create NMRProcessor object
processor = NMRProcessor()
# Load filepath: always include the trailing slash
filepath = r"../data/single_peak/10/pdata/1/"
# Load the data
processor.load_data(filepath)
# Select the region of interest
x_data, y_data = processor.select_region(512, 650)
# Normalize the data and return normalised y_axis and the corresponding x_axis
x_data, y_normalized = processor.normalize_data(x_data, y_data)
# define initial parameters for the fitting
# this example is for a single peak
# format: [x0, amplitude, width, eta, offset]
# x0 (position), amplitude, width, eta (mixing parameter), offset
# x0 has to be close to the peak position
# offset is shared across all peaks and must be in the normalized 0-1 scale
initial_params = [
581, 0.12, 40.51, 0.89, 0.0,
]
# Specify the number of peaks to be fitted
number_of_peaks = 1
# fixed_x0 controls whether peak positions should be fixed during fitting
# False means position can vary, True means position is fixed
fixed_x0 = [False] * number_of_peaks
# fixed_eta controls whether each peak's eta (Gaussian/Lorentzian mixing) is fixed
# False means eta is fitted freely (this is the default if fixed_eta is omitted)
# True fixes it at its initial_params value
fixed_eta = [False] * number_of_peaks
# Fit the data
popt, metrics, fitted = processor.fit_peaks(
x_data, y_normalized, initial_params, fixed_x0, fixed_eta=fixed_eta
)
# popt is the optimized parameters
# metrics is the metrics of the fitting
# fitted is the fitted curve data
# Plot and examine the results of the fitting
fig, axes, components = processor.plot_results(x_data, y_normalized, fitted, popt)
# Save the figure as a png file and the results as a csv file
processor.save_results(filepath, x_data, y_normalized, fitted, metrics, popt, components)
This generates a fit image and a metrics printout like:
Peak Fitting Results:
===================
Peak 1 (Position: 582.01 ± 0.01):
Amplitude: 0.993 ± 0.002
Width: 12.33 ± 0.03 in ppm
Width: 835.74 ± 2.36 in Hz
Eta: 1.00 ± 0.01
Offset: -0.004 ± 0.000
Gaussian Area: 0.00 ± 0.10
Lorentzian Area: 19.23 ± 0.16
Total Area: 19.23 ± 0.19
--------------------------------------------------
Peak 1 Percentage is 100.00% ± 1.39%
Overall Percentage is 100.00% ± 1.39%
A Relaxometry Example (ionhop.relaxometry)
from ionhop.relaxometry import T1Functions
t1 = T1Functions()
# see the User Guide notebooks in docs/user_guide_relaxometry for full T1, T1_rho and T2 workflows
Full worked examples for both modules are in the User Guide notebooks under docs/.
Migrating from nmrlineshapeanalyser or relaxometrynmr
Both packages still install, but they now just depend on ionhop and re-export it, so existing
imports keep working:
from nmrlineshapeanalyser.core import NMRProcessor # still works
from ionhop.lineshape import NMRProcessor # preferred
New code should target ionhop directly.
Contact
For questions and support, please open an issue in the GitHub repository.
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 ionhop-0.1.0.tar.gz.
File metadata
- Download URL: ionhop-0.1.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c86573a7acf363f7bd3a532005759f5ee91c363f3a2504a3daef6969d97cc18
|
|
| MD5 |
68efc61d777d9e10f29d41b42fa95d31
|
|
| BLAKE2b-256 |
7785d9ad92e507a0adb9aad97be2dadf88c54a10b87da11ef1a3c056b3862109
|
Provenance
The following attestation bundles were made for ionhop-0.1.0.tar.gz:
Publisher:
release.yml on BiffoQ/ionhop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ionhop-0.1.0.tar.gz -
Subject digest:
5c86573a7acf363f7bd3a532005759f5ee91c363f3a2504a3daef6969d97cc18 - Sigstore transparency entry: 2656942801
- Sigstore integration time:
-
Permalink:
BiffoQ/ionhop@c2334537f0a11b0dfeb7ab89fa2a6d6b9c40bf35 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BiffoQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2334537f0a11b0dfeb7ab89fa2a6d6b9c40bf35 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ionhop-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ionhop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2956ef607209a8c0a8aa880d479476e341875332712c6c16eda5fb31dccd8d6
|
|
| MD5 |
e95653798071570b9c56400fceab77c2
|
|
| BLAKE2b-256 |
760be9040490a2e07ebfa0cd28bdd97cc431063b255ba29188525ee7bda1ed96
|
Provenance
The following attestation bundles were made for ionhop-0.1.0-py3-none-any.whl:
Publisher:
release.yml on BiffoQ/ionhop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ionhop-0.1.0-py3-none-any.whl -
Subject digest:
c2956ef607209a8c0a8aa880d479476e341875332712c6c16eda5fb31dccd8d6 - Sigstore transparency entry: 2656942829
- Sigstore integration time:
-
Permalink:
BiffoQ/ionhop@c2334537f0a11b0dfeb7ab89fa2a6d6b9c40bf35 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/BiffoQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2334537f0a11b0dfeb7ab89fa2a6d6b9c40bf35 -
Trigger Event:
push
-
Statement type: