.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/2D_simulation(crystalline)/plot_4_DAS_Coesite.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_examples_2D_simulation(crystalline)_plot_4_DAS_Coesite.py: Coesite, ¹⁷O (I=5/2) DAS ^^^^^^^^^^^^^^^^^^^^^^^^^ ¹⁷O (I=5/2) Dynamic-angle spinning (DAS) simulation. .. GENERATED FROM PYTHON SOURCE LINES 9-12 The following is a Dynamic Angle Spinning (DAS) simulation of Coesite. Coesite has five crystallographic :math:`^{17}\text{O}` sites. In the following, we use the :math:`^{17}\text{O}` EFG tensor information from Grandinetti `et al.` [#f1]_ .. GENERATED FROM PYTHON SOURCE LINES 12-20 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from mrsimulator import Simulator from mrsimulator import signal_processor as sp from mrsimulator.method import Method, SpectralDimension, SpectralEvent, MixingEvent .. GENERATED FROM PYTHON SOURCE LINES 22-23 Create the Simulator object and load the spin systems database or url address. .. GENERATED FROM PYTHON SOURCE LINES 23-29 .. code-block:: Python sim = Simulator() # load the spin systems from url. filename = "https://ssnmr.org/sites/default/files/mrsimulator/coesite_0.mrsys" sim.load_spin_systems(filename) .. GENERATED FROM PYTHON SOURCE LINES 30-32 Use the generic `Method` class to simulate a 2D DAS spectrum by customizing the method parameters, as shown below. .. GENERATED FROM PYTHON SOURCE LINES 32-80 .. code-block:: Python das = Method( name="Dynamic Angle Spinning", channels=["17O"], magnetic_flux_density=11.74, # in T rotor_frequency=np.inf, spectral_dimensions=[ SpectralDimension( count=256, spectral_width=5e3, # in Hz reference_offset=0, # in Hz label="DAS isotropic dimension", events=[ SpectralEvent( fraction=0.5, rotor_angle=37.38 * np.pi / 180, # in rads transition_queries=[{"ch1": {"P": [-1], "D": [0]}}], ), MixingEvent(query="NoMixing"), SpectralEvent( fraction=0.5, rotor_angle=79.19 * np.pi / 180, # in rads transition_queries=[{"ch1": {"P": [-1], "D": [0]}}], ), MixingEvent(query="NoMixing"), ], ), # The last spectral dimension block is the direct-dimension SpectralDimension( count=256, spectral_width=2e4, # in Hz reference_offset=0, # in Hz label="MAS dimension", events=[ SpectralEvent( rotor_angle=54.735 * np.pi / 180, # in rads transition_queries=[{"ch1": {"P": [-1], "D": [0]}}], ) ], ), ], ) sim.methods = [das] # add the method # A graphical representation of the method object. plt.figure(figsize=(5, 2.5)) das.plot() plt.show() .. image-sg:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_001.png :alt: Dynamic Angle Spinning :srcset: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 81-82 Run the simulation .. GENERATED FROM PYTHON SOURCE LINES 82-84 .. code-block:: Python sim.run() .. GENERATED FROM PYTHON SOURCE LINES 85-86 The plot of the simulation. .. GENERATED FROM PYTHON SOURCE LINES 86-97 .. code-block:: Python dataset = sim.methods[0].simulation plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") cb = ax.imshow(dataset.real / dataset.real.max(), aspect="auto", cmap="gist_ncar_r") plt.colorbar(cb) ax.invert_xaxis() ax.invert_yaxis() plt.tight_layout() plt.show() .. image-sg:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_002.png :alt: plot 4 DAS Coesite :srcset: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 98-99 Add post-simulation signal processing. .. GENERATED FROM PYTHON SOURCE LINES 99-111 .. code-block:: Python processor = sp.SignalProcessor( operations=[ # Gaussian convolution along both dimensions. sp.IFFT(dim_index=(0, 1)), sp.apodization.Gaussian(FWHM="0.3 kHz", dim_index=0), sp.apodization.Gaussian(FWHM="0.15 kHz", dim_index=1), sp.FFT(dim_index=(0, 1)), ] ) processed_dataset = processor.apply_operations(dataset=dataset) processed_dataset /= processed_dataset.max() .. GENERATED FROM PYTHON SOURCE LINES 112-113 The plot of the simulation after signal processing. .. GENERATED FROM PYTHON SOURCE LINES 113-122 .. code-block:: Python plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") cb = ax.imshow(processed_dataset.real, cmap="gist_ncar_r", aspect="auto") plt.colorbar(cb) ax.invert_xaxis() ax.invert_yaxis() plt.tight_layout() plt.show() .. image-sg:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_003.png :alt: plot 4 DAS Coesite :srcset: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 123-129 .. [#f1] Grandinetti, P. J., Baltisberger, J. H., Farnan, I., Stebbins, J. F., Werner, U. and Pines, A. Solid-State :math:`^{17}\text{O}` Magic-Angle and Dynamic-Angle Spinning NMR Study of the :math:`\text{SiO}_2` Polymorph Coesite, J. Phys. Chem. 1995, **99**, *32*, 12341-12348. `DOI: 10.1021/j100032a045 `_ .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.090 seconds) .. _sphx_glr_download_examples_2D_simulation(crystalline)_plot_4_DAS_Coesite.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_4_DAS_Coesite.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_4_DAS_Coesite.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_