
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/ppm_2D.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_ppm_2D.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_ppm_2D.py:

PPM in 2D
=========

Show how :func:`to_ppm()` can apply to two dimensions!

.. GENERATED FROM PYTHON SOURCE LINES 6-32



.. rst-class:: sphx-glr-horizontal


    *

      .. image-sg:: /auto_examples/images/sphx_glr_ppm_2D_001.png
         :alt: the spectrum
         :srcset: /auto_examples/images/sphx_glr_ppm_2D_001.png, /auto_examples/images/sphx_glr_ppm_2D_001_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_ppm_2D_002.png
         :alt: after converting to ppm
         :srcset: /auto_examples/images/sphx_glr_ppm_2D_002.png, /auto_examples/images/sphx_glr_ppm_2D_002_2_00x.png 2.00x
         :class: sphx-glr-multi-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    1: the spectrum |||(None, None)
    2: after converting to ppm |||('ppm', 'ppm')







|

.. code-block:: Python

    from numpy import pi, r_, exp
    from pyspecdata import nddata, figlist_var

    # make peaks on a frequency axis
    x = nddata(r_[0:5:1024j], "t2")
    y = nddata(r_[0:5:1024j], "t1")

    # generate time-domain signal
    signal = 0 * x * y  # create an array of zeros that's the right shape
    for nu1, nu2 in [(25, -50), (-50, -50), (-2, -75), (-75, 25), (50, 72)]:
        signal += exp(
            +1j * 2 * pi * nu2 * x - x / 0.2 + 1j * 2 * pi * nu1 * y - y / 0.05
        )
    signal.ft("t2", shift=True)
    signal.ft("t1", shift=True)

    signal.set_prop("acq", {"SFO1": 300.196194352191})
    signal.set_prop("proc", {"OFFSET": 7.408084, "SF": 300})

    with figlist_var() as fl:
        fl.next("the spectrum")
        fl.image(signal)
        signal.to_ppm("t2")
        signal.to_ppm("t1")
        fl.next("after converting to ppm")
        fl.image(signal)


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 4.083 seconds)


.. _sphx_glr_download_auto_examples_ppm_2D.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: ppm_2D.ipynb <ppm_2D.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: ppm_2D.py <ppm_2D.py>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
