.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/proc_nutation.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_proc_nutation.py: Process nutation data ===================== `py proc_nutation.py NODENAME FILENAME EXP_TYPE` Fourier transforms (and any needed data corrections for older data) are performed according to the `postproc_type` attribute of the data node. This script plots the result as well as examines the phase variation along the indirect dimension. Finally, the data is integrated and fit to a sin**3 function to find the optimal beta_ninety. Tested with: ``py proc_nutation.py nutation_1 240805_amp0p1_27mM_TEMPOL_nutation.h5 ODNP_NMR_comp/nutation`` .. GENERATED FROM PYTHON SOURCE LINES 19-98 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_proc_nutation_001.png :alt: autoslicing! :srcset: /auto_examples/images/sphx_glr_proc_nutation_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_proc_nutation_002.png :alt: 240805_amp0p1_27mM_TEMPOL_nutation.h5, extract signal pathway, check phase variation along indirect, FID sliced, phased, and aligned, Integrated and fit :srcset: /auto_examples/images/sphx_glr_proc_nutation_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_proc_nutation_003.png :alt: power terms :srcset: /auto_examples/images/sphx_glr_proc_nutation_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_proc_nutation_004.png :alt: check covariance test :srcset: /auto_examples/images/sphx_glr_proc_nutation_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_proc_nutation_005.png :alt: residual after shift :srcset: /auto_examples/images/sphx_glr_proc_nutation_005.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none 1: autoslicing! 2: Raw Data with averaged scans 3: power terms |||ms 4: check covariance test 5: residual after shift |||('Hz', 'μs√W') | .. code-block:: Python import pyspecdata as psd import pyspecProcScripts as prscr import sympy as sp import sys, os from numpy import r_ # even though the following comes from pint, import the instance from # pyspecdata, because we might want to mess with it. from pyspecdata import Q_ if ( "SPHINX_GALLERY_RUNNING" in os.environ and os.environ["SPHINX_GALLERY_RUNNING"] == "True" ): sys.argv = [ sys.argv[0], "nutation_1", "240805_amp0p1_27mM_TEMPOL_nutation.h5", "ODNP_NMR_comp/nutation", ] slice_expansion = 5 assert len(sys.argv) == 4 s = psd.find_file( sys.argv[2], exp_type=sys.argv[3], expno=sys.argv[1], lookup=prscr.lookup_table, ) with psd.figlist_var() as fl: frq_center, frq_half = prscr.find_peakrange(s, fl=fl) signal_range = tuple(slice_expansion * r_[-1, 1] * frq_half + frq_center) if "nScans" in s.dimlabels: s.mean("nScans") s.set_plot_color( "g" ) # this affects the 1D plots, but not the images, etc. # {{{ generate the table of integrals and fit s, ax_last = prscr.rough_table_of_integrals( s, signal_range, fl=fl, title=sys.argv[2], echo_like=True ) prefactor_scaling = 10 ** psd.det_unit_prefactor(s.get_units("beta")) A, R, beta_ninety, beta = sp.symbols("A R beta_ninety beta", real=True) s = psd.lmfitdata(s) s.functional_form = ( A * sp.exp(-R * beta) * sp.sin(beta / beta_ninety * sp.pi / 2) ** 3 ) s.set_guess( A=dict( value=s.data.max(), min=s.data.max() * 0.8, max=s.data.max() * 1.5, ), R=dict( value=1e3 * prefactor_scaling, min=0, max=3e4 * prefactor_scaling ), beta_ninety=dict( value=20e-6 / prefactor_scaling, min=0, max=1000e-6 / prefactor_scaling, ), ) s.fit() # }}} # {{{ show the fit and the β₉₀ fit = s.eval(500) psd.plot(fit, ax=ax_last, alpha=0.5) ax_last.set_title("Integrated and fit") beta_90 = s.output("beta_ninety") ax_last.axvline(beta_90, color="b") ax_last.text( beta_90 + 5, 5e4, r"$\beta_{90} = " + f"{Q_(beta_90,s.get_units('beta')):0.1f~L}$", color="b", ) # }}} ax_last.grid() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.550 seconds) .. _sphx_glr_download_auto_examples_proc_nutation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: proc_nutation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: proc_nutation.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_