Events

class mrsimulator.method.SpectralEvent(*, name: str = None, description: str = None, label: str = None, property_units: ~typing.Dict = {'magnetic_flux_density': 'T', 'rotor_angle': 'rad', 'rotor_frequency': 'Hz'}, magnetic_flux_density: ~mrsimulator.method.event.ConstrainedFloatValue = None, rotor_frequency: ~mrsimulator.method.event.ConstrainedFloatValue = None, rotor_angle: ~mrsimulator.method.event.ConstrainedFloatValue = None, freq_contrib: ~typing.List[~typing.Union[~mrsimulator.method.frequency_contrib.FrequencyEnum, str]] = [<FrequencyEnum.Shielding1_0: 'Shielding1_0'>, <FrequencyEnum.Shielding1_2: 'Shielding1_2'>, <FrequencyEnum.Quad1_2: 'Quad1_2'>, <FrequencyEnum.Quad2_0: 'Quad2_0'>, <FrequencyEnum.Quad2_2: 'Quad2_2'>, <FrequencyEnum.Quad2_4: 'Quad2_4'>, <FrequencyEnum.J1_0: 'J1_0'>, <FrequencyEnum.J1_2: 'J1_2'>, <FrequencyEnum.D1_2: 'D1_2'>, <FrequencyEnum.Quad_Shielding_cross_0: 'Quad_Shielding_cross_0'>, <FrequencyEnum.Quad_Shielding_cross_2: 'Quad_Shielding_cross_2'>, <FrequencyEnum.Quad_Shielding_cross_4: 'Quad_Shielding_cross_4'>, <FrequencyEnum.Quad_J_cross_0: 'Quad_J_cross_0'>, <FrequencyEnum.Quad_J_cross_2: 'Quad_J_cross_2'>, <FrequencyEnum.Quad_J_cross_4: 'Quad_J_cross_4'>, <FrequencyEnum.Quad_Dipolar_cross_0: 'Quad_Dipolar_cross_0'>, <FrequencyEnum.Quad_Dipolar_cross_2: 'Quad_Dipolar_cross_2'>, <FrequencyEnum.Quad_Dipolar_cross_4: 'Quad_Dipolar_cross_4'>], transition_queries: ~typing.List[~mrsimulator.method.query.TransitionQuery] = [TransitionQuery(name=None, description=None, label=None, property_units={}, ch1=SymmetryQuery(name=None, description=None, label=None, property_units={}, P=[0], D=None, F=None, transitions=None), ch2=None, ch3=None)], fraction: float = 1.0)

Bases: BaseEvent

Base SpectralEvent class defines the spin environment and the transition query for a segment of the transition pathway.

fraction

The weight of the frequency contribution from the event. The default is 1.

Type:

float

magnetic_flux_density

The macroscopic magnetic flux density, \(H_0\), of the applied external magnetic field during the event in units of T. The default value is 9.4.

Type:

float

rotor_frequency

The sample spinning frequency \(\nu_r\), during the event in units of Hz. The default value is 0.

Type:

float

rotor_angle

The angle between the sample rotation axis and the applied external magnetic field vector, \(\theta\), during the event in units of rad. The default value is 0.9553166, i.e. the magic angle.

Type:

float

freq_contrib

A list of FrequencyEnum enumeration. The default is all frequency enumerations.

Type:

List[Union[mrsimulator.method.frequency_contrib.FrequencyEnum, str]]

transition_queries

A TransitionQuery or an equivalent dict object listing the queries used in selecting the active transitions during the event. Only the active transitions from this query will contribute to the net frequency.

Type:

List[mrsimulator.method.query.TransitionQuery]

combination(isotopes, channels)

All possible combinations of the event queries over the given channels and list of isotopes.

Parameters:
  • isotopes ((list)) – List of isotopes in the spin system.

  • channels ((list)) – List of method channels.

dict(**kwargs) dict

Return a JSON compliant dictionary of the instance of the event.

filter_transitions(all_transitions, isotopes, channels)

Filter transitions based on the transition query.

Parameters:
  • all_transitions ((list)) – List of all transitions from the spin system.

  • isotopes ((list)) – List of isotopes in the spin system.

  • channels ((list)) – List of method channels.

json(exclude={}, units=True) dict

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

Parameters:
  • exclude – Set of keys that will be excluded from the result.

  • 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: dict)

Parse the physical quantities of an Event object from a python dictionary object.

Parameters:

py_dict (dict) – Dict object

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.

class mrsimulator.method.DelayEvent(*, name: str = None, description: str = None, label: str = None, property_units: ~typing.Dict = {'duration': 's', 'magnetic_flux_density': 'T', 'rotor_angle': 'rad', 'rotor_frequency': 'Hz'}, magnetic_flux_density: ~mrsimulator.method.event.ConstrainedFloatValue = None, rotor_frequency: ~mrsimulator.method.event.ConstrainedFloatValue = None, rotor_angle: ~mrsimulator.method.event.ConstrainedFloatValue = None, freq_contrib: ~typing.List[~typing.Union[~mrsimulator.method.frequency_contrib.FrequencyEnum, str]] = [<FrequencyEnum.Shielding1_0: 'Shielding1_0'>, <FrequencyEnum.Shielding1_2: 'Shielding1_2'>, <FrequencyEnum.Quad1_2: 'Quad1_2'>, <FrequencyEnum.Quad2_0: 'Quad2_0'>, <FrequencyEnum.Quad2_2: 'Quad2_2'>, <FrequencyEnum.Quad2_4: 'Quad2_4'>, <FrequencyEnum.J1_0: 'J1_0'>, <FrequencyEnum.J1_2: 'J1_2'>, <FrequencyEnum.D1_2: 'D1_2'>, <FrequencyEnum.Quad_Shielding_cross_0: 'Quad_Shielding_cross_0'>, <FrequencyEnum.Quad_Shielding_cross_2: 'Quad_Shielding_cross_2'>, <FrequencyEnum.Quad_Shielding_cross_4: 'Quad_Shielding_cross_4'>, <FrequencyEnum.Quad_J_cross_0: 'Quad_J_cross_0'>, <FrequencyEnum.Quad_J_cross_2: 'Quad_J_cross_2'>, <FrequencyEnum.Quad_J_cross_4: 'Quad_J_cross_4'>, <FrequencyEnum.Quad_Dipolar_cross_0: 'Quad_Dipolar_cross_0'>, <FrequencyEnum.Quad_Dipolar_cross_2: 'Quad_Dipolar_cross_2'>, <FrequencyEnum.Quad_Dipolar_cross_4: 'Quad_Dipolar_cross_4'>], transition_queries: ~typing.List[~mrsimulator.method.query.TransitionQuery] = [TransitionQuery(name=None, description=None, label=None, property_units={}, ch1=SymmetryQuery(name=None, description=None, label=None, property_units={}, P=[0], D=None, F=None, transitions=None), ch2=None, ch3=None)], duration: float)

Bases: BaseEvent

Base DelayEvent class defines the spin environment and the transition query for a segment of the transition pathway. The frequency from this event contribute to the spectrum as complex amplitude modulations.

duration

The duration of the event in units of s. The default is 0.

Type:

float

magnetic_flux_density

The macroscopic magnetic flux density, \(H_0\), of the applied external magnetic field during the event in units of T. The default value is 9.4.

Type:

float

rotor_frequency

The sample spinning frequency \(\nu_r\), during the event in units of Hz. The default value is 0.

Type:

float

rotor_angle

The angle between the sample rotation axis and the applied external magnetic field vector, \(\theta\), during the event in units of rad. The default value is 0.9553166, i.e. the magic angle.

Type:

float

freq_contrib

A list of FrequencyEnum enumeration. The default is all frequency enumerations.

Type:

List[Union[mrsimulator.method.frequency_contrib.FrequencyEnum, str]]

transition_queries

A TransitionQuery or an equivalent dict object listing the queries used in selecting the active transitions during the event. Only the active transitions from this query will contribute to the net frequency.

Type:

List[mrsimulator.method.query.TransitionQuery]

combination(isotopes, channels)

All possible combinations of the event queries over the given channels and list of isotopes.

Parameters:
  • isotopes ((list)) – List of isotopes in the spin system.

  • channels ((list)) – List of method channels.

dict(**kwargs) dict

Return a JSON compliant dictionary of the instance of the event.

filter_transitions(all_transitions, isotopes, channels)

Filter transitions based on the transition query.

Parameters:
  • all_transitions ((list)) – List of all transitions from the spin system.

  • isotopes ((list)) – List of isotopes in the spin system.

  • channels ((list)) – List of method channels.

json(exclude={}, units=True) dict

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

Parameters:
  • exclude – Set of keys that will be excluded from the result.

  • 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: dict)

Parse the physical quantities of an Event object from a python dictionary object.

Parameters:

py_dict (dict) – Dict object

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.

class mrsimulator.method.MixingEvent(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {}, query: Union[MixingQuery, MixingEnum])

Bases: Parseable

Transition mixing class

query

The transition mixing query.

Type:

Union[mrsimulator.method.query.MixingQuery, mrsimulator.method.query.MixingEnum]

classmethod parse_dict_with_units(py_dict)

Parse the physical quantity from a dictionary representation of the MixingEvent 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 MixingEvent object.

Returns:

A MixingEvent.

classmethod validate_query(v, **kwargs)

Validator which tries to convert query to a MixingEnum if query is string