Satellite-transition variable-angle spinning (ST-VAS)

The following classes are used when simulating a satellite-transition variable-angle spinning spectrum which correlates the frequencies from the satellite transitions to the central transition frequencies. The \(p\) and \(d\) pathways for the ST-VAS methods are

(79)\[\begin{split}p: &0 \rightarrow -1 \rightarrow -1 \\ d: &0 \rightarrow \pm d_0 \rightarrow 0\end{split}\]

where \(d_0 = m_f^2 - m_i^2\) for transition \(|m_i\rangle \rightarrow |m_f\rangle\). The value of \(n\) depends on the spin quantum number, \(I\), and is listed in Table 24.

Affine mapping

The resulting spectrum is sheared and scaled, such that the frequencies along indirect dimension are given as

(80)\[\langle \Omega\rangle_\text{ST-VAS} = \frac{1}{1+\kappa}\Omega_{m, m-1} + \frac{\kappa}{1+\kappa}\Omega_{1/2, -1/2}.\]

Here, \(\langle \Omega\rangle_\text{ST-VAS}\) is the average frequency along the indirect dimension, \(\Omega_{m, m-1}\) and \(\Omega_{1/2, -1/2}\) are the frequency contributions from the \(|m\rangle \rightarrow |m-1\rangle\) satellite transition and the central transition, respectively, and \(\kappa\) is the shear factor. The values of the shear factor for various satellite transitions are listed in Table 24.

Table 24 The table lists the satellite transitions associated with the spin \(I\), and the corresponding shear factor, \(\kappa\), used in affine mapping of the ST-VAS methods.

Spin

Satellite transitions

\(d_0\)

\(\kappa\)

3/2

\(\left(\frac{3}{2} \rightarrow \frac{1}{2}\right)\), \(\left(-\frac{1}{2} \rightarrow -\frac{3}{2}\right)\)

\(2\)

24/27

5/2

\(\left(-\frac{3}{2} \rightarrow -\frac{1}{2}\right)\), \(\left(\frac{1}{2} \rightarrow \frac{3}{2}\right)\)

\(2\)

21/72

5/2

\(\left(\frac{5}{2} \rightarrow \frac{3}{2}\right)\), \(\left(-\frac{3}{2} \rightarrow -\frac{5}{2}\right)\)

\(4\)

132/72

7/2

\(\left(-\frac{3}{2} \rightarrow -\frac{1}{2}\right)\), \(\left(\frac{1}{2} \rightarrow \frac{3}{2}\right)\)

\(2\)

84/135

7/2

\(\left(-\frac{5}{2} \rightarrow -\frac{3}{2}\right)\), \(\left(\frac{3}{2} \rightarrow \frac{5}{2}\right)\)

\(4\)

69/135

9/2

\(\left(-\frac{3}{2} \rightarrow -\frac{1}{2}\right)\), \(\left(\frac{1}{2} \rightarrow \frac{3}{2}\right)\)

\(2\)

165/216

9/2

\(\left(-\frac{5}{2} \rightarrow -\frac{3}{2}\right)\), \(\left(\frac{3}{2} \rightarrow \frac{5}{2}\right)\)

\(4\)

12/216

Inner satellite variable-angle spinning method

class mrsimulator.method.lib.ST1_VAS(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {'magnetic_flux_density': 'T', 'rotor_angle': 'rad', 'rotor_frequency': 'Hz'}, channels: List[Union[str, dict, Isotope]], spectral_dimensions: List[SpectralDimension] = [SpectralDimension(name=None, description=None, label=None, property_units={'spectral_width': 'Hz', 'reference_offset': 'Hz', 'origin_offset': 'Hz'}, count=1024, spectral_width=25000.0, reference_offset=0.0, origin_offset=None, reciprocal=None, events=[])], affine_matrix: List = None, simulation: Union[CSDM, ndarray] = None, experiment: Union[CSDM, ndarray] = None, magnetic_flux_density: ConstrainedFloatValue = 9.4, rotor_frequency: ConstrainedFloatValue = 1000000000000.0, rotor_angle: ConstrainedFloatValue = 0.9553166181245)

Bases: ST_VAS

Simulate a sheared and scaled inner satellite and central transition correlation spectrum.

Note

The attribute rotor_frequency cannot be modified for this method and is set to simulate an infinite speed spectrum.

Returns:

A Method instance.

Example

>>> method = ST1_VAS(
...     channels=["87Rb"],
...     magnetic_flux_density=9.4,  # in T
...     spectral_dimensions=[
...         {
...             "count": 128,
...             "spectral_width": 1e3,  # in Hz
...             "reference_offset": -5e3,  # in Hz
...             "label": "Isotropic dimension",
...         },
...         {
...             "count": 256,
...             "spectral_width": 1e4,  # in Hz
...             "reference_offset": -3e3,  # in Hz
...             "label": "MAS dimension",
...         },
...     ],
... )
>>> sys = SpinSystem(sites=[Site(isotope='87Rb')])
>>> pprint(method.get_transition_pathways(sys))
[|-1.5⟩⟨-0.5| ⟶ |-0.5⟩⟨0.5|, weight=(1+0j),
 |0.5⟩⟨1.5| ⟶ |-0.5⟩⟨0.5|, weight=(1+0j)]
classmethod check_event_objects_for_compatibility(default_dim, obj_dim, method_dict)

Checks Events for compatibility and sets global method attributes

Parameters:
  • default_dim (dict) – Dict representation of SpectralDimension in base method

  • obj_dim (SpectralDimension) – User-passed SpectralDimension object to check

  • method_dict (dict) – Dict representation of passed method

classmethod check_method_compatibility(py_dict)

Check for events attribute inside the spectral_dimensions. Events are not allowed for NamedMethods.

dict(**kwargs)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

get_symmetry_pathways(symmetry_element: str) List[SymmetryPathway]

Return a list of symmetry pathways of the method.

Parameters:

symmetry_element (str) – The symmetry element, ‘P’ or ‘D’.

Returns:

A list of SymmetryPathway objects.

Single channel example

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H'],
...     spectral_dimensions=[
...         {
...             "events": [
...                 {
...                     "fraction": 0.5,
...                     "transition_queries": [{"ch1": {"P": [1]}}]
...                 },
...                 {
...                     "fraction": 0.5,
...                     "transition_queries": [{"ch1": {"P": [0]}}]
...                 }
...             ],
...         },
...         {
...             "events": [
...                 {"transition_queries": [{"ch1": {"P": [-1]}}]},
...             ],
...         }
...     ]
... )
>>> pprint(method.get_symmetry_pathways("P"))
[SymmetryPathway(
    ch1(1H): [1] ⟶ [0] ⟶ [-1]
    total: 1.0 ⟶ 0.0 ⟶ -1.0
)]

Dual channels example

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H', '13C'],
...     spectral_dimensions=[
...         {
...             "events": [{
...                 "fraction": 0.5,
...                 "transition_queries": [
...                     {"ch1": {"P": [1]}},
...                     {"ch1": {"P": [-1]}},
...                 ]
...             },
...             {
...                 "fraction": 0.5,
...                 "transition_queries": [  # selecting double quantum
...                     {"ch1": {"P": [-1]}, "ch2": {"P": [-1]}},
...                     {"ch1": {"P": [1]}, "ch2": {"P": [1]}},
...                 ]
...             }],
...         },
...         {
...             "events": [{
...                 "transition_queries": [ # selecting single quantum
...                     {"ch1": {"P": [-1]}},
...                 ]
...             }],
...         }
...     ]
... )
>>> pprint(method.get_symmetry_pathways("P"))
[SymmetryPathway(
    ch1(1H): [1] ⟶ [-1] ⟶ [-1]
    ch2(13C): None ⟶ [-1] ⟶ None
    total: 1.0 ⟶ -2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [1] ⟶ [1] ⟶ [-1]
    ch2(13C): None ⟶ [1] ⟶ None
    total: 1.0 ⟶ 2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [-1] ⟶ [-1] ⟶ [-1]
    ch2(13C): None ⟶ [-1] ⟶ None
    total: -1.0 ⟶ -2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [-1] ⟶ [1] ⟶ [-1]
    ch2(13C): None ⟶ [1] ⟶ None
    total: -1.0 ⟶ 2.0 ⟶ -1.0
)]
get_transition_pathways(spin_system) List[TransitionPathway]

Return a list of transition pathways from the given spin system that satisfy the query selection criterion of the method.

Parameters:

spin_system (SpinSystem) – A SpinSystem object.

Returns:

A list of TransitionPathway objects. Each TransitionPathway object is an ordered collection of Transition objects.

Example

>>> from mrsimulator import SpinSystem
>>> from mrsimulator.method.lib import ThreeQ_VAS
>>> sys = SpinSystem(sites=[{'isotope': '27Al'}, {'isotope': '29Si'}])
>>> method = ThreeQ_VAS(channels=['27Al'])
>>> pprint(method.get_transition_pathways(sys))
[|1.5, -0.5⟩⟨-1.5, -0.5| ⟶ |-0.5, -0.5⟩⟨0.5, -0.5|, weight=(1+0j),
 |1.5, -0.5⟩⟨-1.5, -0.5| ⟶ |-0.5, 0.5⟩⟨0.5, 0.5|, weight=(1+0j),
 |1.5, 0.5⟩⟨-1.5, 0.5| ⟶ |-0.5, -0.5⟩⟨0.5, -0.5|, weight=(1+0j),
 |1.5, 0.5⟩⟨-1.5, 0.5| ⟶ |-0.5, 0.5⟩⟨0.5, 0.5|, weight=(1+0j)]
json(units=True) dict

Parse the class object to a JSON compliant python dictionary object.

Parameters:

units – If true, the attribute value is a physical quantity expressed as a string with a number and a unit, else a float.

Returns: dict

classmethod parse_dict_with_units(py_dict)

Parse the physical quantity from a dictionary representation of the Method object, where the physical quantity is expressed as a string with a number and a unit.

Parameters:

py_dict (dict) – A python dict representation of the Method object.

Returns:

A Method object.

plot(df=None, include_legend=False) figure

Creates a diagram representing the method. By default, only parameters which vary throughout the method are plotted. Figure can be finley adjusted using matplotlib rcParams.

Parameters:
  • df (DataFrame) – DataFrame to plot data from. By default DataFrame is calculated from summary() and will show only parameters which vary throughout the method plus ‘p’ symmetry pathway and ‘d’ symmetry pathway if it is not none or defined

  • include_legend (bool) – Optional argument to include a key for event colors. Default is False and no key will be included in figure

Returns:

matplotlib.pyplot.figure

Example

>>> from mrsimulator.method.lib import BlochDecaySpectrum
>>> method = BlochDecaySpectrum(channels=["13C"])
>>> fig = method.plot()

Adjusting Figure Size rcParams

>>> import matplotlib as mpl
>>> from mrsimulator.method.lib import FiveQ_VAS
>>> mpl.rcParams["figure.figsize"] = [14, 10]
>>> mpl.rcParams["font.size"] = 14
>>> method = FiveQ_VAS(channels=["27Al"])
>>> fig = method.plot(include_legend=True)

Plotting all Parameters, including Constant

>>> from mrsimulator.method.lib import FiveQ_VAS
>>> method = FiveQ_VAS(channels=["27Al"])
>>> df = method.summary(drop_constant_columns=False)
>>> fig = method.plot(df=df)
reduced_dict(exclude={}) dict

Returns a reduced dictionary representation of the class object by removing all key-value pair corresponding to keys listed in the exclude argument, and keys with value as None.

Parameters:

exclude – A list of keys to exclude from the dictionary.

Return: A dict.

shape() tuple

The shape of the method’s spectral dimension array.

Returns:

tuple

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H'],
...     spectral_dimensions=[{'count': 40}, {'count': 10}]
... )
>>> method.shape()
(40, 10)
summary(drop_constant_columns=True) DataFrame

Returns a DataFrame giving a summary of the Method. A user can specify optional attributes to include which appear as columns in the DataFrame. A user can also ask to leave out attributes which remain constant throughout the method. Invalid attributes for an Event will be replaced with NAN.

Parameters:

drop_constant_columns ((bool)) – Removes constant properties if True. Default is True.

Returns:

Event number as row and property as column. Invalid properties for an

event type are filled with np.nan

Columns

  • (str) type: Event type

  • (int) spec_dim_index: Index of spectral dimension which event belongs to

  • (str) label: Event label

  • (float) duration: Duration of the DelayEvent

  • (float) fraction: Fraction of the SpectralEvent

  • (MixingQuery) query: MixingQuery object of the MixingEvent

  • (float) magnetic_flux_density: Magnetic flux density during event in Tesla

  • (float) rotor_frequency: Rotor frequency during event in Hz

  • (float) rotor_angle: Rotor angle during event converted to Degrees

  • (FrequencyEnum) freq_contrib: Frequency

Return type:

pd.DataFrame df

Example

All Possible Columns

>>> from mrsimulator.method.lib import ThreeQ_VAS
>>> method = ThreeQ_VAS(channels=["17O"])
>>> df = method.summary(drop_constant_columns=False)
>>> pprint(list(df.columns))
['type',
 'spec_dim_index',
 'spec_dim_label',
 'label',
 'duration',
 'fraction',
 'query',
 'magnetic_flux_density',
 'rotor_frequency',
 'rotor_angle',
 'freq_contrib',
 'p',
 'd']

Second to inner satellite variable-angle spinning method

class mrsimulator.method.lib.ST2_VAS(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {'magnetic_flux_density': 'T', 'rotor_angle': 'rad', 'rotor_frequency': 'Hz'}, channels: List[Union[str, dict, Isotope]], spectral_dimensions: List[SpectralDimension] = [SpectralDimension(name=None, description=None, label=None, property_units={'spectral_width': 'Hz', 'reference_offset': 'Hz', 'origin_offset': 'Hz'}, count=1024, spectral_width=25000.0, reference_offset=0.0, origin_offset=None, reciprocal=None, events=[])], affine_matrix: List = None, simulation: Union[CSDM, ndarray] = None, experiment: Union[CSDM, ndarray] = None, magnetic_flux_density: ConstrainedFloatValue = 9.4, rotor_frequency: ConstrainedFloatValue = 1000000000000.0, rotor_angle: ConstrainedFloatValue = 0.9553166181245)

Bases: ST_VAS

Simulate a sheared and scaled second to inner satellite and central transition correlation spectrum.

Note

The attribute rotor_frequency cannot be modified for this method and is set to simulate an infinite speed spectrum.

Returns:

A Method instance.

Example

>>> method = ST2_VAS(
...     channels=["17O"],
...     magnetic_flux_density=9.4,  # in T
...     spectral_dimensions=[
...         {
...             "count": 256,
...             "spectral_width": 4e3,  # in Hz
...             "reference_offset": -5e3,  # in Hz
...             "label": "Isotropic dimension",
...         },
...         {
...             "count": 512,
...             "spectral_width": 1e4,  # in Hz
...             "reference_offset": -4e3,  # in Hz
...             "label": "MAS dimension",
...         },
...     ],
... )
>>> sys = SpinSystem(sites=[Site(isotope='17O')])
>>> pprint(method.get_transition_pathways(sys))
[|-2.5⟩⟨-1.5| ⟶ |-0.5⟩⟨0.5|, weight=(1+0j),
 |1.5⟩⟨2.5| ⟶ |-0.5⟩⟨0.5|, weight=(1+0j)]
classmethod check_event_objects_for_compatibility(default_dim, obj_dim, method_dict)

Checks Events for compatibility and sets global method attributes

Parameters:
  • default_dim (dict) – Dict representation of SpectralDimension in base method

  • obj_dim (SpectralDimension) – User-passed SpectralDimension object to check

  • method_dict (dict) – Dict representation of passed method

classmethod check_method_compatibility(py_dict)

Check for events attribute inside the spectral_dimensions. Events are not allowed for NamedMethods.

dict(**kwargs)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

get_symmetry_pathways(symmetry_element: str) List[SymmetryPathway]

Return a list of symmetry pathways of the method.

Parameters:

symmetry_element (str) – The symmetry element, ‘P’ or ‘D’.

Returns:

A list of SymmetryPathway objects.

Single channel example

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H'],
...     spectral_dimensions=[
...         {
...             "events": [
...                 {
...                     "fraction": 0.5,
...                     "transition_queries": [{"ch1": {"P": [1]}}]
...                 },
...                 {
...                     "fraction": 0.5,
...                     "transition_queries": [{"ch1": {"P": [0]}}]
...                 }
...             ],
...         },
...         {
...             "events": [
...                 {"transition_queries": [{"ch1": {"P": [-1]}}]},
...             ],
...         }
...     ]
... )
>>> pprint(method.get_symmetry_pathways("P"))
[SymmetryPathway(
    ch1(1H): [1] ⟶ [0] ⟶ [-1]
    total: 1.0 ⟶ 0.0 ⟶ -1.0
)]

Dual channels example

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H', '13C'],
...     spectral_dimensions=[
...         {
...             "events": [{
...                 "fraction": 0.5,
...                 "transition_queries": [
...                     {"ch1": {"P": [1]}},
...                     {"ch1": {"P": [-1]}},
...                 ]
...             },
...             {
...                 "fraction": 0.5,
...                 "transition_queries": [  # selecting double quantum
...                     {"ch1": {"P": [-1]}, "ch2": {"P": [-1]}},
...                     {"ch1": {"P": [1]}, "ch2": {"P": [1]}},
...                 ]
...             }],
...         },
...         {
...             "events": [{
...                 "transition_queries": [ # selecting single quantum
...                     {"ch1": {"P": [-1]}},
...                 ]
...             }],
...         }
...     ]
... )
>>> pprint(method.get_symmetry_pathways("P"))
[SymmetryPathway(
    ch1(1H): [1] ⟶ [-1] ⟶ [-1]
    ch2(13C): None ⟶ [-1] ⟶ None
    total: 1.0 ⟶ -2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [1] ⟶ [1] ⟶ [-1]
    ch2(13C): None ⟶ [1] ⟶ None
    total: 1.0 ⟶ 2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [-1] ⟶ [-1] ⟶ [-1]
    ch2(13C): None ⟶ [-1] ⟶ None
    total: -1.0 ⟶ -2.0 ⟶ -1.0
),
 SymmetryPathway(
    ch1(1H): [-1] ⟶ [1] ⟶ [-1]
    ch2(13C): None ⟶ [1] ⟶ None
    total: -1.0 ⟶ 2.0 ⟶ -1.0
)]
get_transition_pathways(spin_system) List[TransitionPathway]

Return a list of transition pathways from the given spin system that satisfy the query selection criterion of the method.

Parameters:

spin_system (SpinSystem) – A SpinSystem object.

Returns:

A list of TransitionPathway objects. Each TransitionPathway object is an ordered collection of Transition objects.

Example

>>> from mrsimulator import SpinSystem
>>> from mrsimulator.method.lib import ThreeQ_VAS
>>> sys = SpinSystem(sites=[{'isotope': '27Al'}, {'isotope': '29Si'}])
>>> method = ThreeQ_VAS(channels=['27Al'])
>>> pprint(method.get_transition_pathways(sys))
[|1.5, -0.5⟩⟨-1.5, -0.5| ⟶ |-0.5, -0.5⟩⟨0.5, -0.5|, weight=(1+0j),
 |1.5, -0.5⟩⟨-1.5, -0.5| ⟶ |-0.5, 0.5⟩⟨0.5, 0.5|, weight=(1+0j),
 |1.5, 0.5⟩⟨-1.5, 0.5| ⟶ |-0.5, -0.5⟩⟨0.5, -0.5|, weight=(1+0j),
 |1.5, 0.5⟩⟨-1.5, 0.5| ⟶ |-0.5, 0.5⟩⟨0.5, 0.5|, weight=(1+0j)]
json(units=True) dict

Parse the class object to a JSON compliant python dictionary object.

Parameters:

units – If true, the attribute value is a physical quantity expressed as a string with a number and a unit, else a float.

Returns: dict

classmethod parse_dict_with_units(py_dict)

Parse the physical quantity from a dictionary representation of the Method object, where the physical quantity is expressed as a string with a number and a unit.

Parameters:

py_dict (dict) – A python dict representation of the Method object.

Returns:

A Method object.

plot(df=None, include_legend=False) figure

Creates a diagram representing the method. By default, only parameters which vary throughout the method are plotted. Figure can be finley adjusted using matplotlib rcParams.

Parameters:
  • df (DataFrame) – DataFrame to plot data from. By default DataFrame is calculated from summary() and will show only parameters which vary throughout the method plus ‘p’ symmetry pathway and ‘d’ symmetry pathway if it is not none or defined

  • include_legend (bool) – Optional argument to include a key for event colors. Default is False and no key will be included in figure

Returns:

matplotlib.pyplot.figure

Example

>>> from mrsimulator.method.lib import BlochDecaySpectrum
>>> method = BlochDecaySpectrum(channels=["13C"])
>>> fig = method.plot()

Adjusting Figure Size rcParams

>>> import matplotlib as mpl
>>> from mrsimulator.method.lib import FiveQ_VAS
>>> mpl.rcParams["figure.figsize"] = [14, 10]
>>> mpl.rcParams["font.size"] = 14
>>> method = FiveQ_VAS(channels=["27Al"])
>>> fig = method.plot(include_legend=True)

Plotting all Parameters, including Constant

>>> from mrsimulator.method.lib import FiveQ_VAS
>>> method = FiveQ_VAS(channels=["27Al"])
>>> df = method.summary(drop_constant_columns=False)
>>> fig = method.plot(df=df)
reduced_dict(exclude={}) dict

Returns a reduced dictionary representation of the class object by removing all key-value pair corresponding to keys listed in the exclude argument, and keys with value as None.

Parameters:

exclude – A list of keys to exclude from the dictionary.

Return: A dict.

shape() tuple

The shape of the method’s spectral dimension array.

Returns:

tuple

Example

>>> from mrsimulator.method import Method
>>> method = Method(
...     channels=['1H'],
...     spectral_dimensions=[{'count': 40}, {'count': 10}]
... )
>>> method.shape()
(40, 10)
summary(drop_constant_columns=True) DataFrame

Returns a DataFrame giving a summary of the Method. A user can specify optional attributes to include which appear as columns in the DataFrame. A user can also ask to leave out attributes which remain constant throughout the method. Invalid attributes for an Event will be replaced with NAN.

Parameters:

drop_constant_columns ((bool)) – Removes constant properties if True. Default is True.

Returns:

Event number as row and property as column. Invalid properties for an

event type are filled with np.nan

Columns

  • (str) type: Event type

  • (int) spec_dim_index: Index of spectral dimension which event belongs to

  • (str) label: Event label

  • (float) duration: Duration of the DelayEvent

  • (float) fraction: Fraction of the SpectralEvent

  • (MixingQuery) query: MixingQuery object of the MixingEvent

  • (float) magnetic_flux_density: Magnetic flux density during event in Tesla

  • (float) rotor_frequency: Rotor frequency during event in Hz

  • (float) rotor_angle: Rotor angle during event converted to Degrees

  • (FrequencyEnum) freq_contrib: Frequency

Return type:

pd.DataFrame df

Example

All Possible Columns

>>> from mrsimulator.method.lib import ThreeQ_VAS
>>> method = ThreeQ_VAS(channels=["17O"])
>>> df = method.summary(drop_constant_columns=False)
>>> pprint(list(df.columns))
['type',
 'spec_dim_index',
 'spec_dim_label',
 'label',
 'duration',
 'fraction',
 'query',
 'magnetic_flux_density',
 'rotor_frequency',
 'rotor_angle',
 'freq_contrib',
 'p',
 'd']