.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/1D_simulation(crystalline)/plot_91_custom_isotope_general.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_1D_simulation(crystalline)_plot_91_custom_isotope_general.py: Using Custom Isotopes ^^^^^^^^^^^^^^^^^^^^^ Simulating spectra of custom isotopes. .. GENERATED FROM PYTHON SOURCE LINES 9-12 Mrsimulator includes the capability for simulating isotopes with user-defined attributes. In this example, we show how to define a custom isotopes and simulate spectra using custom isotopes. .. GENERATED FROM PYTHON SOURCE LINES 12-20 .. code-block:: Python from mrsimulator.spin_system.isotope import Isotope from mrsimulator import Site, SpinSystem, Simulator from mrsimulator.method import SpectralDimension from mrsimulator.method.lib import BlochDecayCTSpectrum import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 22-26 First, we register a new isotope symbol with custom attributes using the :py:meth:`~mrsimulator.spin_system.isotope.Isotope.register` method. The new symbol cannot match any real isotope symbols, and re-calling register on a custom symbol will update the stored attributes of that isotope. .. GENERATED FROM PYTHON SOURCE LINES 26-33 .. code-block:: Python Isotope.register( symbol="custom", spin_multiplicity=4, # Spin of I=3/2 gyromagnetic_ratio=12.3, quadrupole_moment=0.045, ) .. GENERATED FROM PYTHON SOURCE LINES 34-37 Create :py:class:`~mrsimulator.spin_system.Site` and :py:class:`~mrsimulator.method.Method` objects using the new isotope symbol. The syntax is the same as any other isotope. .. GENERATED FROM PYTHON SOURCE LINES 37-51 .. code-block:: Python site = Site( isotope="custom", isotropic_chemical_shift=-30, quadrupolar={"Cq": 1.3e6, "eta": 0.5}, ) sys = SpinSystem(sites=[site]) mth = BlochDecayCTSpectrum( channels=["custom"], spectral_dimensions=[ SpectralDimension(spectral_width=12e3, reference_offset=-3000) ], ) .. GENERATED FROM PYTHON SOURCE LINES 52-60 .. code-block:: Python sim = Simulator(spin_systems=[sys], methods=[mth]) sim.run() plt.figure(figsize=(4.25, 3)) plt.subplot(projection="csdm") plt.plot(sim.methods[0].simulation.real, color="black", linewidth=1) plt.tight_layout() plt.show() .. image-sg:: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_91_custom_isotope_general_001.png :alt: plot 91 custom isotope general :srcset: /examples/1D_simulation(crystalline)/images/sphx_glr_plot_91_custom_isotope_general_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.203 seconds) .. _sphx_glr_download_examples_1D_simulation(crystalline)_plot_91_custom_isotope_general.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_91_custom_isotope_general.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_91_custom_isotope_general.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_91_custom_isotope_general.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_