.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_Analysis/plot_01_load_2D_calculate_DNP_enhancements.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_02_Analysis_plot_01_load_2D_calculate_DNP_enhancements.py: .. _plot_01_load_2D_calculate_DNP_enhancements: =================================================== Load a 2D dnpdata object and calculate enhancements =================================================== This example demonstrates how to import DNP-NMR data in form of a 2D dnpdata object from an hdf5 file, calculate the DNP enhancement factors and plot the enhancement vs. the applied microwave power. This example uses the 2D data object that was created in a previous tutorial (:ref:`plot_04_create_dnpdata_object_from_individual_files`). The sample is 10 mM TEMPO in Toluene measured at 14.5MHz (X-Band ODNP spectroscopy). .. GENERATED FROM PYTHON SOURCE LINES 13-18 Load NMR Spectra ---------------- In this example, we will calculate the DNP enhancement factor for each individual DNP spectrum and create a figure showing the DNP enhancement versus the applied microwave power. For this, we will import the 2D dnpdata object created in the previous sample. If you are not yet familiar with how to concatenate individual spectra into the 2D dnpdata object, check out this tutorial: :ref:`plot_04_create_dnpdata_object_from_individual_files`. First, load the 2D dnplab data object: .. GENERATED FROM PYTHON SOURCE LINES 18-26 .. code-block:: Python import dnplab as dnp from dnplab.processing.integration import integrate sampleTag = "10 mM TEMPO in Toluene" file_name_path = "../../data/h5/PowerBuildUp.h5" data = dnp.load(file_name_path) .. GENERATED FROM PYTHON SOURCE LINES 27-30 Calculate DNP Enhancement Factors --------------------------------- DNPLab provides a convenient way to calculate the DNP enhancement factors by using the ``calculate_enhancement`` function. Enhancement factors are calculated using integrals. Integrals can be calculated over the entire spectrum, multiple regions, or can be just a single point. However, without calculating integrals first, the ``calculate_enhancement`` function will return an error. .. GENERATED FROM PYTHON SOURCE LINES 30-34 .. code-block:: Python integrals = dnp.integrate(data) enhancements = dnp.calculate_enhancement(integrals) .. GENERATED FROM PYTHON SOURCE LINES 35-36 In this case, the integral is calculated over the entire spectrum followed by calculating the enhancement factors. .. GENERATED FROM PYTHON SOURCE LINES 38-40 .. note:: The default behavior of the ``calculate_enhancement`` function is to use the first spectrum as the Off signal. If this is the case, the argument ``off_spectrum`` is not necessary. If you want to specify a particular spectrum that contains the off signal, use the ``off_spectrum`` argument. .. GENERATED FROM PYTHON SOURCE LINES 40-44 .. code-block:: Python # # The ``calculate_enhancement``` function can also calculate the enhancement for specific regions of the spectrum. THis behavior will be discussed in the next example (:ref:`07_align_nmr_spectra`). .. GENERATED FROM PYTHON SOURCE LINES 45-48 Plot Enhancement Data --------------------- Finally, we can plot the enhancement data versus the microwave power. .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python dnp.fancy_plot(enhancements, title=sampleTag + ", ODNP Enhancements") dnp.plt.show() .. image-sg:: /auto_examples/02_Analysis/images/sphx_glr_plot_01_load_2D_calculate_DNP_enhancements_001.png :alt: 10 mM TEMPO in Toluene, ODNP Enhancements :srcset: /auto_examples/02_Analysis/images/sphx_glr_plot_01_load_2D_calculate_DNP_enhancements_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.115 seconds) .. _sphx_glr_download_auto_examples_02_Analysis_plot_01_load_2D_calculate_DNP_enhancements.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_load_2D_calculate_DNP_enhancements.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_load_2D_calculate_DNP_enhancements.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_