.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/03_Advanced/plot_04_phase_cycling.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_04_phase_cycling.py: .. _plot_04_phase_cycling: ======================================= Using the dnplab phase cycling function ======================================= This example demonstrates how to use the phase cycling function on dnpdata objects. .. GENERATED FROM PYTHON SOURCE LINES 12-18 .. code-block:: Python # The following example shows how and when the phase_cycle function can be conveniently used. # # To get started, first, setup the python environment: 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_04_phase_cycling_001.png :alt: plot 04 phase cycling :srcset: /auto_examples/03_Advanced/images/sphx_glr_plot_04_phase_cycling_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [, , , ] .. GENERATED FROM PYTHON SOURCE LINES 41-44 clearly the spectra are phase cycled, but we'd like to have them phased all the same we can use dnp.phase_cycle for that: Note that [0(X),1(Y),2(-X),3(-Y)] gives the phase cycle Axes. .. GENERATED FROM PYTHON SOURCE LINES 44-47 .. code-block:: Python data_phased = dnp.phase_cycle(data, "Average", [0, 1, 2, 3]) dnp.fancy_plot(data_phased) .. image-sg:: /auto_examples/03_Advanced/images/sphx_glr_plot_04_phase_cycling_002.png :alt: plot 04 phase cycling :srcset: /auto_examples/03_Advanced/images/sphx_glr_plot_04_phase_cycling_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.247 seconds) .. _sphx_glr_download_auto_examples_03_Advanced_plot_04_phase_cycling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_04_phase_cycling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_04_phase_cycling.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_