.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/1D_simulation(crystalline)/plot_6_dipolar_coupled.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_6_dipolar_coupled.py: Coupled spin-1/2 (Static dipolar spectrum) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ¹³C-¹H static dipolar coupling simulation. .. GENERATED FROM PYTHON SOURCE LINES 9-18 .. code-block:: default import matplotlib.pyplot as plt from mrsimulator import Simulator, SpinSystem, Site, Coupling from mrsimulator.method.lib import BlochDecaySpectrum from mrsimulator import signal_processor as sp from mrsimulator.spin_system.tensors import SymmetricTensor from mrsimulator.method import SpectralDimension .. GENERATED FROM PYTHON SOURCE LINES 20-23 **Spin Systems** Create a 13C-1H coupled spin system. .. GENERATED FROM PYTHON SOURCE LINES 23-30 .. code-block:: default spin_system = SpinSystem( sites=[ Site(isotope="13C", isotropic_chemical_shift=0.0), Site(isotope="1H", isotropic_chemical_shift=0.0), ], couplings=[Coupling(site_index=[0, 1], dipolar=SymmetricTensor(D=-2e4))], ) .. GENERATED FROM PYTHON SOURCE LINES 31-34 **Methods** Create a BlochDecaySpectrum method. .. GENERATED FROM PYTHON SOURCE LINES 34-40 .. code-block:: default method = BlochDecaySpectrum( channels=["13C"], magnetic_flux_density=9.4, # in T spectral_dimensions=[SpectralDimension(count=2048, spectral_width=8.0e4)], ) .. GENERATED FROM PYTHON SOURCE LINES 41-44 **Simulator** Create the Simulator object and add the method and the spin system object. .. GENERATED FROM PYTHON SOURCE LINES 44-49 .. code-block:: default sim = Simulator() sim.spin_systems = [spin_system] # add the spin system. sim.methods = [method] # add the method. sim.run() .. GENERATED FROM PYTHON SOURCE LINES 50-53 **Post-Simulation Processing** Add post-simulation signal processing. .. GENERATED FROM PYTHON SOURCE LINES 53-62 .. code-block:: default processor = sp.SignalProcessor( operations=[ sp.IFFT(), sp.apodization.Exponential(FWHM="500 Hz"), sp.FFT(), ] ) processed_dataset = processor.apply_operations(dataset=sim.methods[0].simulation) .. GENERATED FROM PYTHON SOURCE LINES 63-65 **Plot** .. GENERATED FROM PYTHON SOURCE LINES 65-71 .. code-block:: default 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_6_dipolar_coupled_001.png :alt: plot 6 dipolar coupled :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_6_dipolar_coupled_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.225 seconds) .. _sphx_glr_download_examples_1D_simulation(crystalline)_plot_6_dipolar_coupled.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_6_dipolar_coupled.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_6_dipolar_coupled.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_