.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/calculate_ODNP.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_calculate_ODNP.py: calculate ODNP using DNPLab =========================== This example demonstrates how to use the dnplab.dnpHydration module .. GENERATED FROM PYTHON SOURCE LINES 12-13 First import dnplab and numpy, .. GENERATED FROM PYTHON SOURCE LINES 13-16 .. code-block:: default import dnplab import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 19-20 To use the dnpHydration module first create a dictionary with the necessary inputs. Start by creating a workspace and assinging an inputs dictionary to the key **'hydration_inputs'**. For example, .. GENERATED FROM PYTHON SOURCE LINES 20-38 .. code-block:: default Enhancements = [] # list of signal enhancements Enhancement_powers = [] # list of powers in Watts corresponding to Enhancements T1s = [] # list of T1 values in seconds T1_powers = [] # list of powers in Watts corresponding to T1s inputs = { 'E_array' : np.array(Enhancements), 'E_powers' : np.array(Enhancement_powers), 'T1_array' : np.array(T1s), 'T1_powers' : np.array(T1_powers), 'T10': 2.0, # T1 measured with power=0 'T100': 2.5, # T1 measured with SL=0 and power=0 'spin_C': 100, # spin concentration in micromolar 'field': 350, # magnetic field in mT 'smax_model': 'tethered', # choice of smax model 'interpolate_method': 'second_order' # choice of interpolation method } .. GENERATED FROM PYTHON SOURCE LINES 41-42 Now you can either create a workspace and add the dictionary under the key **'hydration_inputs'**, .. GENERATED FROM PYTHON SOURCE LINES 42-43 .. code-block:: default workspace = dnplab.create_workspace('hydration_inputs', inputs) .. GENERATED FROM PYTHON SOURCE LINES 46-47 Or add to an existing workspace, .. GENERATED FROM PYTHON SOURCE LINES 47-48 .. code-block:: default workspace.add('hydration_inputs', inputs) .. GENERATED FROM PYTHON SOURCE LINES 51-52 In rare cases the bulk water or second order T1 interpolation constants may need to be altered. This is not necessary for the odnp module to operate, but if needed this can be done by adding the dictionary **'hydration_constants'** to the workspace. For example, .. GENERATED FROM PYTHON SOURCE LINES 52-65 .. code-block:: default constants = { 'ksigma_bulk': 95.4, # bulk ksigma value 'krho_bulk': 353.4, # bulk krho value 'klow_bulk': 366, # bulk klow value 'tcorr_bulk': 54, # bulk tcorr value 'D_H2O': 2.3e-9, # bulk water diffusivity 'D_SL': 4.1e-10, # diffusivity of spin probe in bulk water 'delta_T1_water': 1, # change in water proton T1 due to microwaves 'T1_water': 2.5, # T1 of bulk water protons 'macro_C': 100, # concentration of macromolecule in uM } workspace.add('hydration_constants', constants) .. GENERATED FROM PYTHON SOURCE LINES 68-69 Next, pass the workspace to dnplab.dnpHydration.hydration to perform calculations using, .. GENERATED FROM PYTHON SOURCE LINES 69-70 .. code-block:: default hydration_results = dnplab.dnpHydration.hydration(workspace) .. GENERATED FROM PYTHON SOURCE LINES 73-74 or operate in-place with: .. GENERATED FROM PYTHON SOURCE LINES 74-75 .. code-block:: default dnplab.dnpHydration.hydration(workspace) .. GENERATED FROM PYTHON SOURCE LINES 79-80 For use without creating a DNPLab workspace simply skip the above steps and pass the dictionaries to dnpHydration directly, .. GENERATED FROM PYTHON SOURCE LINES 80-81 .. code-block:: default hydration_results = dnplab.dnpHydration.odnp(inputs=inputs, constants=constants) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_calculate_ODNP.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: calculate_ODNP.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: calculate_ODNP.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_