Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Automatic phase correction of NMR spectra

This notebook demonstrates Automatic Phase Correction algorithms implemented for nmrglue. Two standard algorithms are implemented:

  • ACME algorithm by Chen Li et al. Journal of Magnetic Resonance 158 (2002) 164-168

  • Naive peak minima minimisation

The outputs for the two algorithms are shown below. Automatic Phase correction can be used through the addition of an autops function to the proc_base set alongside the algorithm name to employ for scoring of phase. Custom algorithms can be provided via the same parameter.

In [1]:
import nmrglue as ng

dic, data = ng.bruker.read("/Users/mxf793/Data/THPNH/Extract/1d/103/")
data = ng.bruker.remove_digital_filter(dic, data)
In [2]:
%matplotlib inline
In [3]:
import matplotlib.pyplot as plt
plt.figure(figsize=(10,4))
plt.plot(data)
/usr/local/lib/python2.7/site-packages/numpy/core/numeric.py:462: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
Out[3]:
[]
In [4]:
data_fft = ng.proc_base.fft(data)
plt.figure(figsize=(10,4))
plt.plot(data_fft)
Out[4]:
[]
In [5]:
data_pc_pm = ng.proc_base.autops(data_fft,'peak_minima')
Optimization terminated successfully.
         Current function value: 0.000037
         Iterations: 90
         Function evaluations: 165
In [6]:
plt.figure(figsize=(10,4))
plt.plot(data_pc_pm)
Out[6]:
[]
In [7]:
data_pc_acme = ng.proc_base.autops(data_fft,'acme')
Warning: Maximum number of function evaluations has been exceeded.
In [8]:
plt.figure(figsize=(


This post first appeared on Martin Fitzpatrick – Python Coder, Postgraduate, please read the originial post: here

Share the post

Automatic phase correction of NMR spectra

×

Subscribe to Martin Fitzpatrick – Python Coder, Postgraduate

Get updates delivered right to your inbox!

Thank you for your subscription

×