Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


pyNMR is a python module to import and analyze NMR data as generated by Bruker, TecMag, Magritek and Chemagnetics Consoles.

The module also provides basic processing routines.

offsetCorrection() - zeros the mean of the real and imaginary FID data

lineBroadening() - applies exponential linebroadening

fourierTransform() - complex fourier Transform

phase() - zero-order phase correction

autoPhase(0) - retunrs the zero-order phase that maximizes the real part of the spectrum in a specified frequency range

phaseFirstOrder() - first order phase correction

leftShift() - remove specified nubmer of points from beginning of the fid

zeroFilling() - fills the fid with zeros up to the specified number

getJoinedPartialSpectra() - concatenates spectral ranges from a 2D dataset (for plotting)

getPartialSpectrum() - returns part of the spectrum

integrateRealPart() - returns the integral of the real part over a specfied frequency range

integrateAllRealPart() - returns the integrals for all the spectra in a 2D dataset

getPeak() - get the maximum value of a spectrum

getCenterFrequency() - calculate the first moment of a spectrum in a specified range

getIndexFromFrequency() - get the index of a specified frequency from the frequency axis

getIndexFromPPM() - the same, but for a specified PPM value

getIndices() - get indices as above, but for an interval. scale may be specified as Hz or ppm

checkToPos() - internal function to create a position in .allFid

getPPMScale() - get PPM scale by specifying a reference frequeny and according shift value

export() - export ascii data

Core functionality

It provides a few basic routines for Fourier Transform. It is typically used in a IPython Notebook to interactively analyze NMR Data.

The data are stored in the allFid array. After import, the first FID of a 2D dataset (or the FID of a 1D dataset) is stored in nmrData.allFid[0]

When processing nmrData, the new data maybe stored at a position incremented by 1, using the `fromPos` and `toPos` attributes of the various functions.

A typical set of processing commands is

import nmrDataMod as ndm

data = ndm.nmrData(pathToData, "TopSpin")
data.leftShift(0, 1, 70)
data.lineBroadening(1, 2, 5)
data.fourierTransform(2, 3)
data.phase(3, 4, 45, degree = True)

Various functions exist to set a chemical shift scale or calculate integrals for all spectra in a 2D dataset.

Further modules

The modules listed below provide some NMR related utiliy functions. provides a table with the gamma values of the various nuclei. may be used to fit nmr data interactively and includes simple models to fit data from a few very basic NMR experiments. allows to calculate the full with at half maximum of a spectrum provides a routine to calculate thermal polarization as function of nucleus, field and temperature. implements a formula to estimate the π/2 pulse by specifying coil volume, circuit Q, Larmor frequency and RF power.


A python module to import NMR data stored in Bruker / TopSpin, TecMag / NTNMR, Magritek / Kea or Chemagnetics / Spinsight format




No releases published


No packages published