.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/phaseCycNoise_example.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_phaseCycNoise_example.py: Phase Cycling Noise =================== A demo of the correlation alignment on a dataset with a lot of phase cycling noise .. GENERATED FROM PYTHON SOURCE LINES 7-47 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_phaseCycNoise_example_001.png :alt: raw data FIR_27dBm :srcset: /auto_examples/images/sphx_glr_phaseCycNoise_example_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_phaseCycNoise_example_002.png :alt: Correlation Diagnostic, before correlation sig. energy=1.54363e+09, correlation function (t), after apod, correlation function (v), after apod, after correlation before ph0 restore, after correlation ph0 restored sig. energy=1.54363e+09 :srcset: /auto_examples/images/sphx_glr_phaseCycNoise_example_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_phaseCycNoise_example_003.png :alt: correlation convergence :srcset: /auto_examples/images/sphx_glr_phaseCycNoise_example_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none You didn't set units for t2 before saving the data!!! [(12, 'vd'), (2, 'ph2'), (2, 'ph1'), (2048, 't2')] 1: raw data FIR_27dBm |||(None, None) 2: Correlation Diagnostics |||(None, None) 3: correlation convergence |||(None, None) | .. code-block:: Python from pyspecdata import figlist_var, find_file from pyspecProcScripts import correl_align from numpy import exp, pi save_fig = False this_figsize = (9, 5.56) with figlist_var() as fl: for date, id_string, node_name in [ ("210607", "TEMPOL_100mM_cap_probe_DNP", "FIR_27dBm"), ]: filename = date + "_" + id_string + ".h5" nodename = "signal" nodename = node_name s = find_file(filename, expno=nodename, exp_type="ODNP_NMR_comp/ODNP") s = s["nScans", 0] print(s.shape) s.reorder(["ph2", "ph1", "vd", "t2"]) s.setaxis("vd", "#") s.ft(["ph1", "ph2"]) fl.next("raw data %s" % node_name) s["vd", 0] *= -1 s.setaxis("t2", lambda x: x - 1.06e-3) s.ft("t2", shift=True) s.ift(["ph1", "ph2"]) s *= exp(s.fromaxis("ph2") * 2 * pi * 1j) fl.image(s) s.ift("t2") s /= exp(s.fromaxis("ph2") * 2 * pi * 1j) s.ft(["ph1", "ph2"]) s.ift(["ph1", "ph2"]) signal_pathway = {"ph1": 0, "ph2": 1} s.ft("t2") opt_shift, sigma, mask_func = correl_align( s, indirect_dim="vd", signal_pathway=signal_pathway, sigma=3000 / 2.355, max_shift=300, fl=fl, ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.721 seconds) .. _sphx_glr_download_auto_examples_phaseCycNoise_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: phaseCycNoise_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: phaseCycNoise_example.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_