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[~mrsimulator.method.frequency_contrib.FrequencyEnum] = [<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'>], transition_query: ~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[mrsimulator.method.frequency_contrib.FrequencyEnum]

transition_query

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]

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

permutation(isotopes, channels)

Permutate 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.

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