Note
Go to the end to download the full example code
Using the DNPLab autophase function
This example demonstrates how to use the DNPLab autophase function on a dnpdata object.
The following example shows how the autophase function can be conveniently used. To get started, first, setup the python environment:
import dnplab as dnp
Let's load some example data the data consists of 4 fid that are phase cycled (0-90-180-270)
data = dnp.load("../../data/prospa/water_phase_cycled/data.2d")
we are interested in the spectra and only the arbitrary part from -900 to -100 ppm
data = dnp.fourier_transform(data)["f2", (-900.0, -100.0)]
we look at the real part of the spectra
data_real = data.real
lets plot the spectrum for all 4 cycles
dnp.fancy_plot(data_real)
![plot 05 autophasing](../../_images/sphx_glr_plot_05_autophasing_001.png)
[<matplotlib.lines.Line2D object at 0x7f530246f160>, <matplotlib.lines.Line2D object at 0x7f530246f9a0>, <matplotlib.lines.Line2D object at 0x7f5307783940>, <matplotlib.lines.Line2D object at 0x7f5307783520>]
clearly the spectra are phase cycled, but we'd like to have them phased all the same we can use dnp.autophase for that:
data_phased = dnp.autophase(data)
dnp.fancy_plot(data_phased)
![plot 05 autophasing](../../_images/sphx_glr_plot_05_autophasing_002.png)
[<matplotlib.lines.Line2D object at 0x7f530013dd30>, <matplotlib.lines.Line2D object at 0x7f530013d160>, <matplotlib.lines.Line2D object at 0x7f530013d220>, <matplotlib.lines.Line2D object at 0x7f530013d0a0>]
Total running time of the script: (0 minutes 0.349 seconds)