
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/temp.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_temp.py>`
        to download the full example code

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

.. _sphx_glr_auto_examples_temp.py:


Calculation of the Covariance Matrix
====================================
After rescaling plots, the covariance matrix is calculated
and then plotted for a 2D Field experiment (spectra as a function
of field with multiple collections or "Times")

.. GENERATED FROM PYTHON SOURCE LINES 9-41



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


    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_001.png
         :alt: fast conversion raw data
         :srcset: /auto_examples/images/sphx_glr_temp_001.png, /auto_examples/images/sphx_glr_temp_001_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_002.png
         :alt: fast conversion covariance in B domain
         :srcset: /auto_examples/images/sphx_glr_temp_002.png, /auto_examples/images/sphx_glr_temp_002_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_003.png
         :alt: fast conversion Covariance in U domain
         :srcset: /auto_examples/images/sphx_glr_temp_003.png, /auto_examples/images/sphx_glr_temp_003_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_004.png
         :alt: slow conversion raw data
         :srcset: /auto_examples/images/sphx_glr_temp_004.png, /auto_examples/images/sphx_glr_temp_004_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_005.png
         :alt: slow conversion covariance in B domain
         :srcset: /auto_examples/images/sphx_glr_temp_005.png, /auto_examples/images/sphx_glr_temp_005_2_00x.png 2.00x
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /auto_examples/images/sphx_glr_temp_006.png
         :alt: slow conversion Covariance in U domain
         :srcset: /auto_examples/images/sphx_glr_temp_006.png, /auto_examples/images/sphx_glr_temp_006_2_00x.png 2.00x
         :class: sphx-glr-multi-img


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

 .. code-block:: none

    1: fast conversion raw data |||('s', 'mT')
    2: fast conversion covariance in B domain |||('mT', 'mT')
    3: fast conversion Covariance in U domain |||('kcyc · (T)$^{-1}$', 'kcyc · (T)$^{-1}$')
    4: slow conversion raw data |||('s', 'mT')
    5: slow conversion covariance in B domain |||('mT', 'mT')
    6: slow conversion Covariance in U domain |||('kcyc · (T)$^{-1}$', 'kcyc · (T)$^{-1}$')







|

.. code-block:: Python


    from pyspecdata import *
    from pylab import *

    fieldaxis = "$B_0$"
    exp_type = "francklab_esr/romana"
    with figlist_var() as fl:
        for filenum, (thisfile, fl.basename) in enumerate([
            (
                re.escape("250123_TEMPOL_100uM_AG_Covariance_2D.DSC"),
                "fast conversion",
            ),
            (
                re.escape("250123_TEMPOL_100uM_AG_Covariance_2D_cc12.DSC"),
                "slow conversion",
            ),
        ]):
            d = find_file(thisfile, exp_type=exp_type)["harmonic", 0]
            d.set_units(fieldaxis, "T").setaxis(fieldaxis, lambda x: x * 1e-4)
            d.rename("Time", "observations")
            d.reorder([fieldaxis,"observations"])
            fl.next("raw data")
            fl.image(d)
            fl.next("covariance in B domain")
            # we do this first, because if we were to ift to go to u domain and
            # then ft back, we would introduce a complex component to our data
            fl.image(d.C.cov_mat("observations"))
            d.ift(fieldaxis, shift=True)
            fl.next("Covariance in U domain")
            fl.image(
                d.cov_mat("observations").run(abs)
            )  # this time, do not spin up an extra copy of the data


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

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


.. _sphx_glr_download_auto_examples_temp.py:

.. only:: html

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

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

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

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

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


.. only:: html

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

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