.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/04_Tools/plot_01_larmor_frequency.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_04_Tools_plot_01_larmor_frequency.py: .. _plot_01_larmor_frequency: ======================================= Calculate/Plot Nuclear Larmor Frequency ======================================= This example demonstrates how to use the tool to calculate the nuclear Larmor frequency. .. GENERATED FROM PYTHON SOURCE LINES 13-26 Get Magnetic Resonance Properties ================================= DNPLab stores a dictionary called ``gmrProperties`` with magnetic resonance properties of all nuclei of the periodic table. The dictionary is modeled after the Matlab function *gmr* written, and implemented by |GMRFunctionMatlab|. For more details see the detailed documentation of the dictionary. The dictionary stores the following parameters: * Spin Quantum Number * Gyromagnetic Ratio (Hz/T) * Nuclear Quadrupole Moment (fm^2, 100 barns) * Isotope Natural Abundance (%) * Relative Sensitivity with Respect to 1H at same B_{0} (for nuclei with I > 1/2), and some more parameters. This dictionary can be used to provide nuclear properties in any calculation, it is also used by the DNPLab function ``mr_properties``. To get started, first, setup the python environment: .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: Python import dnplab as dnp import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 31-32 Let's query some of the parameters: .. GENERATED FROM PYTHON SOURCE LINES 34-35 **Proton Gyromagnetic Ratio** .. GENERATED FROM PYTHON SOURCE LINES 35-38 .. code-block:: Python print("v_L(1H) = ", dnp.mr_properties("1H"), "(Hz/T)") .. rst-class:: sphx-glr-script-out .. code-block:: none v_L(1H) = 42577469.05766274 (Hz/T) .. GENERATED FROM PYTHON SOURCE LINES 39-40 **Nirogen 14N nuclear spin quantum number** .. GENERATED FROM PYTHON SOURCE LINES 40-43 .. code-block:: Python print("I = ", dnp.mr_properties("14N", "spin")) .. rst-class:: sphx-glr-script-out .. code-block:: none I = 1 .. GENERATED FROM PYTHON SOURCE LINES 44-45 **Carbon 13 (13C) natural abundance** .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: Python print(dnp.mr_properties("13C", "natAbundance"), " %") .. rst-class:: sphx-glr-script-out .. code-block:: none 1.07 % .. GENERATED FROM PYTHON SOURCE LINES 49-50 **Plot Gyromagnetic Ratios for Elements in the Periodic Table** .. GENERATED FROM PYTHON SOURCE LINES 50-59 .. code-block:: Python gmr = [value[1] for value in dnp.gmrProperties.values()] plt.figure() plt.plot(gmr[1:-1]) plt.xlabel("Index") plt.ylabel("Gyromagnetic Ratio (10^7r/Ts)") plt.grid(True) plt.show() .. image-sg:: /auto_examples/04_Tools/images/sphx_glr_plot_01_larmor_frequency_001.png :alt: plot 01 larmor frequency :srcset: /auto_examples/04_Tools/images/sphx_glr_plot_01_larmor_frequency_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.087 seconds) .. _sphx_glr_download_auto_examples_04_Tools_plot_01_larmor_frequency.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_larmor_frequency.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_larmor_frequency.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_