.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/1D_simulation(crystalline)/plot_1_PotassiumSulfate.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_1D_simulation(crystalline)_plot_1_PotassiumSulfate.py: Potassium Sulfate, ³³S (I=3/2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ³³S (I=3/2) quadrupolar spectrum simulation. .. GENERATED FROM PYTHON SOURCE LINES 9-12 The following example is the :math:`^{33}\text{S}` NMR spectrum simulation of potassium sulfate (:math:`\text{K}_2\text{SO}_4`). The quadrupole tensor parameters for :math:`^{33}\text{S}` is obtained from Moudrakovski `et al.` [#f3]_ .. GENERATED FROM PYTHON SOURCE LINES 12-21 .. code-block:: default import matplotlib.pyplot as plt from mrsimulator import Simulator, SpinSystem, Site from mrsimulator import signal_processor as sp from mrsimulator.method.lib import BlochDecayCTSpectrum from mrsimulator.spin_system.tensors import SymmetricTensor from mrsimulator.method import SpectralDimension .. GENERATED FROM PYTHON SOURCE LINES 23-24 **Step 1:** Create the spin system .. GENERATED FROM PYTHON SOURCE LINES 24-32 .. code-block:: default site = Site( name="33S", isotope="33S", isotropic_chemical_shift=335.7, # in ppm quadrupolar=SymmetricTensor(Cq=0.959e6, eta=0.42), # Cq is in Hz ) spin_system = SpinSystem(sites=[site]) .. GENERATED FROM PYTHON SOURCE LINES 33-34 **Step 2:** Create a central transition selective Bloch decay spectrum method. .. GENERATED FROM PYTHON SOURCE LINES 34-53 .. code-block:: default method = BlochDecayCTSpectrum( channels=["33S"], magnetic_flux_density=21.14, # in T rotor_frequency=14000, # in Hz spectral_dimensions=[ SpectralDimension( count=2048, spectral_width=5000, # in Hz reference_offset=22500, # in Hz label=r"$^{33}$S resonances", ) ], ) # A graphical representation of the method object. plt.figure(figsize=(4, 2.5)) method.plot() plt.show() .. image-sg:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_001.png :alt: BlochDecayCTSpectrum :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 54-55 **Step 3:** Create the Simulator object and add method and spin system objects. .. GENERATED FROM PYTHON SOURCE LINES 55-59 .. code-block:: default sim = Simulator() sim.spin_systems = [spin_system] # add the spin system sim.methods = [method] # add the method .. GENERATED FROM PYTHON SOURCE LINES 60-61 **Step 4:** Simulate the spectrum. .. GENERATED FROM PYTHON SOURCE LINES 61-71 .. code-block:: default sim.run() # The plot of the simulation before signal processing. plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") ax.plot(sim.methods[0].simulation.real, color="black", linewidth=1) ax.invert_xaxis() plt.tight_layout() plt.show() .. image-sg:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_002.png :alt: plot 1 PotassiumSulfate :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 72-73 **Step 5:** Add post-simulation signal processing. .. GENERATED FROM PYTHON SOURCE LINES 73-86 .. code-block:: default processor = sp.SignalProcessor( operations=[sp.IFFT(), sp.apodization.Exponential(FWHM="10 Hz"), sp.FFT()] ) processed_dataset = processor.apply_operations(dataset=sim.methods[0].simulation) # The plot of the simulation after signal processing. plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") ax.plot(processed_dataset.real, color="black", linewidth=1) ax.invert_xaxis() plt.tight_layout() plt.show() .. image-sg:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_003.png :alt: plot 1 PotassiumSulfate :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 87-91 .. [#f3] Moudrakovski, I., Lang, S., Patchkovskii, S., and Ripmeester, J. High field :math:`^{33}\text{S}` solid state NMR and first-principles calculations in potassium sulfates. J. Phys. Chem. A, 2010, **114**, *1*, 309–316. `DOI: 10.1021/jp908206c `_ .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.667 seconds) .. _sphx_glr_download_examples_1D_simulation(crystalline)_plot_1_PotassiumSulfate.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_1_PotassiumSulfate.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_1_PotassiumSulfate.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_