.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_2D_simulation(crystalline)_plot_4_DAS_Coesite.py: Coesite, 17O (I=5/2) DAS ^^^^^^^^^^^^^^^^^^^^^^^^^ 17O (I=5/2) Dynamic-angle spinning (DAS) simulation. 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]_ .. code-block:: python import matplotlib as mpl import matplotlib.pyplot as plt import mrsimulator.signal_processing as sp import mrsimulator.signal_processing.apodization as apo from mrsimulator import Simulator from mrsimulator.methods import Method2D # global plot configuration font = {"size": 9} mpl.rc("font", **font) mpl.rcParams["figure.figsize"] = [4.25, 3.0] Create the Simulator object and load the spin systems database or url address. .. code-block:: python sim = Simulator() # load the spin systems from url. filename = "https://sandbox.zenodo.org/record/687656/files/coesite.mrsys" sim.load_spin_systems(filename) Use the generic 2D method, `Method2D`, to simulate a DAS spectrum by customizing the method parameters, as shown below. Note, the Method2D method simulates an infinite spinning speed spectrum. .. code-block:: python das = Method2D( channels=["17O"], magnetic_flux_density=11.7, # in T spectral_dimensions=[ { "count": 256, "spectral_width": 5e3, # in Hz "reference_offset": 0, # in Hz "label": "DAS isotropic dimension", "events": [ {"fraction": 0.5, "rotor_angle": 37.38 * 3.14159 / 180}, {"fraction": 0.5, "rotor_angle": 79.19 * 3.14159 / 180}, ], }, # The last spectral dimension block is the direct-dimension { "count": 256, "spectral_width": 2e4, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", "events": [{"rotor_angle": 54.735 * 3.14159 / 180}], }, ], ) sim.methods = [das] # add the method. Run the simulation .. code-block:: python sim.run() The plot of the simulation. .. code-block:: python data = sim.methods[0].simulation ax = plt.subplot(projection="csdm") cb = ax.imshow(data / data.max(), aspect="auto", cmap="gist_ncar_r") plt.colorbar(cb) ax.invert_xaxis() ax.invert_yaxis() plt.tight_layout() plt.show() .. image:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_001.png :alt: plot 4 DAS Coesite :class: sphx-glr-single-img Add post-simulation signal processing. .. code-block:: python processor = sp.SignalProcessor( operations=[ # Gaussian convolution along both dimensions. sp.IFFT(dim_index=(0, 1)), apo.Gaussian(FWHM="0.3 kHz", dim_index=0), apo.Gaussian(FWHM="0.15 kHz", dim_index=1), sp.FFT(dim_index=(0, 1)), ] ) processed_data = processor.apply_operations(data=data) processed_data /= processed_data.max() The plot of the simulation after signal processing. .. code-block:: python ax = plt.subplot(projection="csdm") cb = ax.imshow(processed_data.real, cmap="gist_ncar_r", aspect="auto") plt.colorbar(cb) ax.invert_xaxis() ax.invert_yaxis() plt.tight_layout() plt.show() .. image:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_4_DAS_Coesite_002.png :alt: plot 4 DAS Coesite :class: sphx-glr-single-img .. [#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.269 seconds) .. _sphx_glr_download_examples_2D_simulation(crystalline)_plot_4_DAS_Coesite.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/DeepanshS/mrsimulator/master?urlpath=lab/tree/docs/_build/html/../../notebooks/examples/2D_simulation(crystalline)/plot_4_DAS_Coesite.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_4_DAS_Coesite.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_4_DAS_Coesite.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_