Skip to content

SpinPlots provides functionality to easily plot fits of NMR data done using DMfit.

Plotting 1D fits

To use Spinplots functions, you first need to export your 1D DMFit data, as follows:

  1. Navigate to the menu: Decomposition → Export spec, model with all lines → Export as Ascii File.
  2. Important: Ensure the file extension is either .hz (for data in Hz) or .ppm (for data in ppm).

The example below used data exported from a DMFit example showing a 31P NMR spectrum showing overlapping peaks.

from __future__ import annotations
import warnings
warnings.filterwarnings("ignore", category=UserWarning)

from spinplots.io import read_nmr

dmfit_data = read_nmr("../../data/DMFit/overlapping_spe_fit.ppm",
                      provider="dmfit")
dmfit_data.plot(xlim=(120, -70))
No description has been provided for this image
dmfit_data.plot(
    xlim=(120, -70),
    xaxislabel="$^{31}$P (ppm)",    # Add a label to the x-axis
    linewidth=2,                    # Increase with of spectrum
    model_linewidth=3,              # Increase with of model
    model_linestyle='-.',           # Change the linestyle of the model
    model_color='orange',           # Change the color of the model
    model_alpha=0.8,                # Transparency of the model
    deconv_show=False,              # Hide the deconvolution curves
    deconv_alpha=0,                 # Transparency of the deconvolution
    labels=["Spectrum", "Model"],  # Add a legend
)
No description has been provided for this image

Plot 2D Fits

DMFit also allows fitting of 2D NMR spectra such as this \(^1\)H-\(^{31}\)P HETCOR example. To use such data in SpinPlots, you need to export the 2D spectrum and the model fit in DMFit as .ppm files.

# Read a 2D 1H-31P HETCOR spectrum and fit
hector = read_nmr(
    ['../../data/DMFit/hetcor_spectrum.ppm', 
     '../../data/DMFit/hetcor_model.ppm'],
    provider="dmfit",
    tags=["spectrum", "fit"],   
)

hector.plot(
    contour_start=10,
    contour_num=25,
    contour_factor=1.5,
    colors=['black', 'red'],
    xlim=(38, 24),
    ylim=(22, 16),
    xaxislabel="$^{31}$P $\delta$ / ppm",
    yaxislabel="$^{1}$H $\delta$ / ppm",
)
No description has been provided for this image