.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/1D_simulation(macro_amorphous)/plot_0_protein_GB1.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(macro_amorphous)_plot_0_protein_GB1.py: Protein GB1, ¹³C and ¹⁵N (I=1/2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ¹³C/¹⁵N (I=1/2) spinning sideband simulation. .. GENERATED FROM PYTHON SOURCE LINES 9-15 The following is the spinning sideband simulation of a macromolecule, protein GB1. The :math:`^{13}\text{C}` and :math:`^{15}\text{N}` CSA tensor parameters were obtained from Hung `et al.` [#f1]_, which consists of 42 :math:`^{13}\text{C}\alpha`, 44 :math:`^{13}\text{CO}`, and 44 :math:`^{15}\text{NH}` tensors. In the following example, instead of creating 130 spin systems, we download the spin systems from a remote file and load it directly to the Simulator object. .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python import matplotlib.pyplot as plt from mrsimulator import Simulator from mrsimulator.method.lib import BlochDecaySpectrum from mrsimulator.method import SpectralDimension from mrsimulator import signal_processor as sp .. GENERATED FROM PYTHON SOURCE LINES 25-26 Create the Simulator object and load the spin systems from an external file. .. GENERATED FROM PYTHON SOURCE LINES 26-33 .. code-block:: Python sim = Simulator() host = "https://ssnmr.org/sites/default/files/mrsimulator/" filename = "protein_GB1_15N_13CA_13CO.mrsys" sim.load_spin_systems(host + filename) # load the spin systems. print(f"number of spin systems = {len(sim.spin_systems)}") .. rst-class:: sphx-glr-script-out .. code-block:: none number of spin systems = 130 .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python all_sites = sim.sites().to_pd() all_sites.head() .. raw:: html
isotope isotropic_chemical_shift shielding_symmetric.zeta shielding_symmetric.eta
0 15N 123.33333333333333 ppm -118.66666666666667 ppm 0.101124
1 15N 121.66666666666667 ppm -115.33333333333333 ppm 0.225434
2 15N 125.33333333333333 ppm -110.66666666666667 ppm 0.000000
3 15N 125.33333333333333 ppm -110.66666666666667 ppm 0.126506
4 15N 126.0 ppm -114.0 ppm 0.192982


.. GENERATED FROM PYTHON SOURCE LINES 38-39 Create a :math:`^{13}\text{C}` Bloch decay spectrum method. .. GENERATED FROM PYTHON SOURCE LINES 39-53 .. code-block:: Python method_13C = BlochDecaySpectrum( channels=["13C"], magnetic_flux_density=11.74, # in T rotor_frequency=3000, # in Hz spectral_dimensions=[ SpectralDimension( count=8192, spectral_width=5e4, # in Hz reference_offset=2e4, # in Hz label=r"$^{13}$C resonances", ) ], ) .. GENERATED FROM PYTHON SOURCE LINES 54-56 Since the spin systems contain both :math:`^{13}\text{C}` and :math:`^{15}\text{N}` sites, let's also create a :math:`^{15}\text{N}` Bloch decay spectrum method. .. GENERATED FROM PYTHON SOURCE LINES 56-70 .. code-block:: Python method_15N = BlochDecaySpectrum( channels=["15N"], magnetic_flux_density=11.74, # in T rotor_frequency=3000, # in Hz spectral_dimensions=[ SpectralDimension( count=8192, spectral_width=4e4, # in Hz reference_offset=7e3, # in Hz label=r"$^{15}$N resonances", ) ], ) .. GENERATED FROM PYTHON SOURCE LINES 71-72 Add the methods to the Simulator object and run the simulation .. GENERATED FROM PYTHON SOURCE LINES 72-83 .. code-block:: Python # Add the methods. sim.methods = [method_13C, method_15N] # Run the simulation. sim.run() # Get the simulation dataset from the respective methods. dataset_13C = sim.methods[0].simulation # method at index 0 is 13C Bloch decay method. dataset_15N = sim.methods[1].simulation # method at index 1 is 15N Bloch decay method. .. GENERATED FROM PYTHON SOURCE LINES 84-85 Add post-simulation signal processing. .. GENERATED FROM PYTHON SOURCE LINES 85-94 .. code-block:: Python processor = sp.SignalProcessor( operations=[sp.IFFT(), sp.apodization.Exponential(FWHM="10 Hz"), sp.FFT()] ) # apply post-simulation processing to dataset_13C processed_dataset_13C = processor.apply_operations(dataset=dataset_13C).real # apply post-simulation processing to dataset_15N processed_dataset_15N = processor.apply_operations(dataset=dataset_15N).real .. GENERATED FROM PYTHON SOURCE LINES 95-96 The plot of the simulation after signal processing. .. GENERATED FROM PYTHON SOURCE LINES 96-110 .. code-block:: Python fig, ax = plt.subplots( 1, 2, subplot_kw={"projection": "csdm"}, sharey=True, figsize=(9, 4) ) ax[0].plot(processed_dataset_13C, color="black", linewidth=0.5) ax[0].invert_xaxis() ax[1].plot(processed_dataset_15N, color="black", linewidth=0.5) ax[1].set_ylabel(None) ax[1].invert_xaxis() plt.tight_layout() plt.show() .. image-sg:: /examples/1D_simulation(macro_amorphous)/images/sphx_glr_plot_0_protein_GB1_001.png :alt: plot 0 protein GB1 :srcset: /examples/1D_simulation(macro_amorphous)/images/sphx_glr_plot_0_protein_GB1_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 111-116 .. [#f1] Hung I., Ge Y., Liu X., Liu M., Li C., Gan Z., Measuring :math:`^{13}\text{C}`/:math:`^{15}\text{N}` chemical shift anisotropy in [:math:`^{13}\text{C}`, :math:`^{15}\text{N}`] uniformly enriched proteins using CSA amplification, Solid State Nuclear Magnetic Resonance. 2015, **72**, 96-103. `DOI: 10.1016/j.ssnmr.2015.09.002 `_ .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.530 seconds) .. _sphx_glr_download_examples_1D_simulation(macro_amorphous)_plot_0_protein_GB1.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_0_protein_GB1.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_0_protein_GB1.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_