.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/2D_simulation(crystalline)/plot_8_MAF.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_examples_2D_simulation(crystalline)_plot_8_MAF.py: Wollastonite, ²⁹Si (I=1/2), MAF ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ²⁹Si (I=1/2) magic angle flipping. .. GENERATED FROM PYTHON SOURCE LINES 9-13 Wollastonite is a high-temperature calcium-silicate, :math:`\beta−\text{Ca}_3\text{Si}_3\text{O}_9`, with three distinct :math:`^{29}\text{Si}` sites. The :math:`^{29}\text{Si}` tensor parameters were obtained from Hansen `et al.` [#f1]_ .. GENERATED FROM PYTHON SOURCE LINES 13-22 .. code-block:: default import matplotlib.pyplot as plt import numpy as np from mrsimulator import Simulator, SpinSystem, Site from mrsimulator import signal_processor as sp from mrsimulator.spin_system.tensors import SymmetricTensor from mrsimulator.method import Method, SpectralDimension, SpectralEvent, MixingEvent .. GENERATED FROM PYTHON SOURCE LINES 24-25 Create the sites and spin systems .. GENERATED FROM PYTHON SOURCE LINES 25-45 .. code-block:: default sites = [ Site( isotope="29Si", isotropic_chemical_shift=-89.0, # in ppm shielding_symmetric=SymmetricTensor(zeta=59.8, eta=0.62), # zeta in ppm ), Site( isotope="29Si", isotropic_chemical_shift=-89.5, # in ppm shielding_symmetric=SymmetricTensor(zeta=52.1, eta=0.68), # zeta in ppm ), Site( isotope="29Si", isotropic_chemical_shift=-87.8, # in ppm shielding_symmetric=SymmetricTensor(zeta=69.4, eta=0.60), # zeta in ppm ), ] spin_systems = [SpinSystem(sites=[s]) for s in sites] .. GENERATED FROM PYTHON SOURCE LINES 46-55 Use the generic method, `Method`, to simulate a 2D Magic-Angle Flipping (MAF) spectrum by customizing the method parameters, as shown below. Here we include the special `MixingEvent` with query ``NoMixing`` to tell the MAF method to not connect any of the transitions between the first and second `SpectralEvent`. A query of ``NoMixing`` is equivalent to a rotational query where each channel has a phase and angle of 0. Since all spin systems in this example have a single site, defining no mixing between the two spectral events is superfluous, but we include it so this method may be used with multi-site spin systems. .. GENERATED FROM PYTHON SOURCE LINES 55-94 .. code-block:: default maf = Method( name="Magic Angle Flipping", channels=["29Si"], magnetic_flux_density=14.1, # in T rotor_frequency=np.inf, spectral_dimensions=[ SpectralDimension( count=128, spectral_width=2e4, # in Hz label="Anisotropic dimension", events=[ SpectralEvent( rotor_angle=90 * 3.14159 / 180, # in rads transition_queries=[{"ch1": {"P": [-1], "D": [0]}}], ), MixingEvent(query="NoMixing"), ], ), SpectralDimension( count=128, spectral_width=3e3, # in Hz reference_offset=-1.05e4, # in Hz label="Isotropic dimension", events=[ SpectralEvent( rotor_angle=54.735 * 3.14159 / 180, # in rads transition_queries=[{"ch1": {"P": [-1], "D": [0]}}], ) ], ), ], affine_matrix=[[1, -1], [0, 1]], ) # A graphical representation of the method object. plt.figure(figsize=(5, 2.5)) maf.plot() plt.show() .. image-sg:: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_8_MAF_001.png :alt: Magic Angle Flipping :srcset: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_8_MAF_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 95-97 Create the Simulator object, add the method and spin system objects, and run the simulation. .. GENERATED FROM PYTHON SOURCE LINES 97-102 .. code-block:: default sim = Simulator() sim.spin_systems = spin_systems # add the spin systems sim.methods = [maf] # add the method sim.run() .. GENERATED FROM PYTHON SOURCE LINES 103-104 Add post-simulation signal processing. .. GENERATED FROM PYTHON SOURCE LINES 104-116 .. code-block:: default csdm_dataset = sim.methods[0].simulation processor = sp.SignalProcessor( operations=[ sp.IFFT(dim_index=(0, 1)), sp.apodization.Gaussian(FWHM="50 Hz", dim_index=0), sp.apodization.Gaussian(FWHM="50 Hz", dim_index=1), sp.FFT(dim_index=(0, 1)), ] ) processed_dataset = processor.apply_operations(dataset=csdm_dataset).real processed_dataset /= processed_dataset.max() .. GENERATED FROM PYTHON SOURCE LINES 117-118 The plot of the simulation after signal processing. .. GENERATED FROM PYTHON SOURCE LINES 118-127 .. code-block:: default plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") cb = ax.imshow(processed_dataset.T, 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_8_MAF_002.png :alt: plot 8 MAF :srcset: /examples/2D_simulation(crystalline)/images/sphx_glr_plot_8_MAF_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 128-133 .. [#f1] Hansen, M. R., Jakobsen, H. J., Skibsted, J., :math:`^{29}\text{Si}` Chemical Shift Anisotropies in Calcium Silicates from High-Field :math:`^{29}\text{Si}` MAS NMR Spectroscopy, Inorg. Chem. 2003, **42**, *7*, 2368-2377. `DOI: 10.1021/ic020647f `_ .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.623 seconds) .. _sphx_glr_download_examples_2D_simulation(crystalline)_plot_8_MAF.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: plot_8_MAF.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_8_MAF.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_