.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/1D_simulation(crystalline)/plot_4_satellite_transition_sim.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_4_satellite_transition_sim.py: Arbitrary spin transition (single-quantum) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ²⁷Al (I=5/2) quadrupolar spectrum simulation. .. GENERATED FROM PYTHON SOURCE LINES 9-14 The mrsimulator built-in library methods, BlochDecaySpectrum and BlochDecayCTSpectrum, simulate spectrum from single quantum transitions or central transition selective transition, respectively. In this example, we show how you can simulate any arbitrary transition using the generic Method object. .. GENERATED FROM PYTHON SOURCE LINES 14-22 .. code-block:: default import matplotlib.pyplot as plt import numpy as np from mrsimulator import Simulator, SpinSystem, Site from mrsimulator.method import Method, SpectralDimension, SpectralEvent from mrsimulator.spin_system.tensors import SymmetricTensor .. GENERATED FROM PYTHON SOURCE LINES 24-25 Create a single-site arbitrary spin system. .. GENERATED FROM PYTHON SOURCE LINES 25-33 .. code-block:: default site = Site( name="27Al", isotope="27Al", isotropic_chemical_shift=35.7, # in ppm quadrupolar=SymmetricTensor(Cq=5.959e6, eta=0.32), # Cq is in Hz ) spin_system = SpinSystem(sites=[site]) .. GENERATED FROM PYTHON SOURCE LINES 34-49 Selecting spin transitions for simulation ----------------------------------------- The arguments of the Method object are the same as the arguments of the BlochDecaySpectrum method; however, unlike a BlochDecaySpectrum method, the :ref:`spectral_dim_api` object in Method contains an additional argument---`events`. The :ref:`event_api` object is a collection of attributes, which are local to the event. It is here where we define `transition_queries` to select one or more transitions for simulating the spectrum. Recall, a TransitionQuery object holds a channel wise SymmetryQuery. For more information, refer to the :ref:`transition_query_documentation`. In this example, we use the ``P=-1`` and ``D=2`` attributes of SymmetryQuery, to select the satellite transition, :math:`|-1/2\rangle\rightarrow|-3/2\rangle`. .. GENERATED FROM PYTHON SOURCE LINES 49-75 .. code-block:: default method = Method( name="Inner Satellite Spectrum", channels=["27Al"], magnetic_flux_density=21.14, # in T rotor_frequency=np.inf, # in Hz spectral_dimensions=[ SpectralDimension( count=1024, spectral_width=1e4, # in Hz reference_offset=1e4, # in Hz events=[ SpectralEvent( transition_queries=[ {"ch1": {"P": [-1], "D": [2]}}, # inner satellite ] ) ], ) ], ) # 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_4_satellite_transition_sim_001.png :alt: Inner Satellite Spectrum :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_4_satellite_transition_sim_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 76-77 Create the Simulator object and add the method and the spin system object. .. GENERATED FROM PYTHON SOURCE LINES 77-81 .. 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 82-83 Simulate the spectrum. .. GENERATED FROM PYTHON SOURCE LINES 83-93 .. 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_4_satellite_transition_sim_002.png :alt: plot 4 satellite transition sim :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_4_satellite_transition_sim_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 94-101 Selecting both inner and outer-satellite transitions ---------------------------------------------------- Similarly, you may add another transition query to select to select additional transitions. Consider the following transitions with respective P and D values. - :math:`|-1/2\rangle\rightarrow|-3/2\rangle ~~ (P=-1, D=2)` - :math:`|-3/2\rangle\rightarrow|-5/2\rangle ~~ (P=-1, D=4)` .. GENERATED FROM PYTHON SOURCE LINES 101-128 .. code-block:: default method2 = Method( name="Satellite Spectrum", channels=["27Al"], magnetic_flux_density=21.14, # in T rotor_frequency=np.inf, # in Hz spectral_dimensions=[ SpectralDimension( count=1024, spectral_width=1e4, # in Hz reference_offset=1e4, # in Hz events=[ SpectralEvent( transition_queries=[ {"ch1": {"P": [-1], "D": [2]}}, # inter satellite {"ch1": {"P": [-1], "D": [4]}}, # outer satellite ] ) ], ) ], ) # A graphical representation of the method object. plt.figure(figsize=(4, 2.5)) method2.plot() plt.show() .. image-sg:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_4_satellite_transition_sim_003.png :alt: Satellite Spectrum :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_4_satellite_transition_sim_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 129-131 .. code-block:: default sim.methods[0] = method2 .. GENERATED FROM PYTHON SOURCE LINES 132-133 Simulate the spectrum. .. GENERATED FROM PYTHON SOURCE LINES 133-142 .. 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_4_satellite_transition_sim_004.png :alt: plot 4 satellite transition sim :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_4_satellite_transition_sim_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.788 seconds) .. _sphx_glr_download_examples_1D_simulation(crystalline)_plot_4_satellite_transition_sim.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_4_satellite_transition_sim.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_4_satellite_transition_sim.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_