.. 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_1D_simulation(crystalline)_plot_1_PotassiumSulfate.py: Potassium Sulfate, 33S (I=3/2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 33S (I=3/2) quadrupolar spectrum simulation. 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]_ .. 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, SpinSystem, Site from mrsimulator.methods import BlochDecayCentralTransitionSpectrum # global plot configuration mpl.rcParams["figure.figsize"] = [4.5, 3.0] **Step 1:** Create the spin system .. code-block:: python site = Site( name="33S", isotope="33S", isotropic_chemical_shift=335.7, # in ppm quadrupolar={"Cq": 0.959e6, "eta": 0.42}, # Cq is in Hz ) spin_system = SpinSystem(sites=[site]) **Step 2:** Create a central transition selective Bloch decay spectrum method. .. code-block:: python method = BlochDecayCentralTransitionSpectrum( channels=["33S"], magnetic_flux_density=21.14, # in T rotor_frequency=14000, # in Hz spectral_dimensions=[ { "count": 2048, "spectral_width": 5000, # in Hz "reference_offset": 22500, # in Hz "label": r"$^{33}$S resonances", } ], ) **Step 3:** Create the Simulator object and add method and spin system objects. .. code-block:: python sim = Simulator() sim.spin_systems += [spin_system] # add the spin system sim.methods += [method] # add the method **Step 4:** Simulate the spectrum. .. code-block:: python sim.run() # The plot of the simulation before signal processing. 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:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_001.png :alt: plot 1 PotassiumSulfate :class: sphx-glr-single-img **Step 5:** Add post-simulation signal processing. .. code-block:: python processor = sp.SignalProcessor( operations=[sp.IFFT(), apo.Exponential(FWHM="10 Hz"), sp.FFT()] ) processed_data = processor.apply_operations(data=sim.methods[0].simulation) # The plot of the simulation after signal processing. ax = plt.subplot(projection="csdm") ax.plot(processed_data.real, color="black", linewidth=1) ax.invert_xaxis() plt.tight_layout() plt.show() .. image:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_1_PotassiumSulfate_002.png :alt: plot 1 PotassiumSulfate :class: sphx-glr-single-img .. [#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.409 seconds) .. _sphx_glr_download_examples_1D_simulation(crystalline)_plot_1_PotassiumSulfate.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/1D_simulation(crystalline)/plot_1_PotassiumSulfate.ipynb :alt: Launch binder :width: 150 px .. 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 `_