.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/03_Advanced/plot_05_autophasing.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_03_Advanced_plot_05_autophasing.py: .. _plot_05_autophasing: =================================== Using the DNPLab autophase function =================================== This example demonstrates how to use the DNPLab autophase function on a dnpdata object. .. GENERATED FROM PYTHON SOURCE LINES 13-15 The following example shows how the autophase function can be conveniently used. To get started, first, setup the python environment: .. GENERATED FROM PYTHON SOURCE LINES 15-18 .. code-block:: Python import dnplab as dnp .. GENERATED FROM PYTHON SOURCE LINES 19-21 Let's load some example data the data consists of 4 fid that are phase cycled (0-90-180-270) .. GENERATED FROM PYTHON SOURCE LINES 21-24 .. code-block:: Python data = dnp.load("../../data/prospa/water_phase_cycled/data.2d") .. GENERATED FROM PYTHON SOURCE LINES 25-27 we are interested in the spectra and only the arbitrary part from -900 to -100 ppm .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: Python data = dnp.fourier_transform(data)["f2", (-900.0, -100.0)] .. GENERATED FROM PYTHON SOURCE LINES 31-32 we look at the real part of the spectra .. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: Python data_real = data.real .. GENERATED FROM PYTHON SOURCE LINES 36-37 lets plot the spectrum for all 4 cycles .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python dnp.fancy_plot(data_real) .. image-sg:: /auto_examples/03_Advanced/images/sphx_glr_plot_05_autophasing_001.png :alt: plot 05 autophasing :srcset: /auto_examples/03_Advanced/images/sphx_glr_plot_05_autophasing_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [, , , ] .. GENERATED FROM PYTHON SOURCE LINES 41-43 clearly the spectra are phase cycled, but we'd like to have them phased all the same we can use dnp.autophase for that: .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: Python data_phased = dnp.autophase(data) dnp.fancy_plot(data_phased) .. image-sg:: /auto_examples/03_Advanced/images/sphx_glr_plot_05_autophasing_002.png :alt: plot 05 autophasing :srcset: /auto_examples/03_Advanced/images/sphx_glr_plot_05_autophasing_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [, , , ] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.347 seconds) .. _sphx_glr_download_auto_examples_03_Advanced_plot_05_autophasing.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_autophasing.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_autophasing.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_