ConfigSimulator

class mrsimulator.simulator.ConfigSimulator(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {}, number_of_sidebands: ConstrainedIntValue = 64, integration_volume: Literal['octant', 'hemisphere'] = 'octant', integration_density: ConstrainedIntValue = 70, decompose_spectrum: Literal['none', 'spin_system'] = 'none', isotropic_interpolation: Literal['linear', 'gaussian'] = 'linear')

Bases: Parseable

The configurable attributes for the Simulator class used in simulation.

number_of_sidebands

The value is the requested number of sidebands that will be computed in the simulation. The value cannot be zero or negative. The default value is 64.

Type:

int (optional).

integration_volume

The value is the volume over which the solid-state spectral frequency integration is performed. The valid literals of this enumeration are

  • octant (default), and

  • hemisphere

Type:

enum (optional).

integration_density

The value represents the integration density or equivalently the number of orientations over which the frequency integration is performed within a given volume. If \(n\) is the integration_density, then the total number of orientation is given as

(69)\[n_\text{octants} \frac{(n+1)(n+2)}{2},\]

where \(n_\text{octants}\) is the number of octants in the given volume. The default value is 70.

Type:

int (optional).

decompose_spectrum

The value specifies how a simulation result is decomposed into an array of spectra. The valid literals of this enumeration are

  • none (default): When the value is none, the resulting simulation is a single spectrum, which is an integration of the spectra over all spin systems.

  • spin_system: When the value is spin_system, the resulting simulation is an array of spectra, where each spectrum arises from a spin system within the Simulator object.

Type:

enum (optional).

isotropic_interpolation

Interpolation scheme for isotropic binning. The valid literals are

  • linear (default): linear interpolation.

  • gaussian: Gaussian interpolation with sigma=0.25*bin_width.

Type:

enum (optional).

Example

>>> a = Simulator()
>>> a.config.number_of_sidebands = 128
>>> a.config.integration_density = 96
>>> a.config.integration_volume = 'hemisphere'
>>> a.config.decompose_spectrum = 'spin_system'
get_orientations_count()

Return the total number of orientations.

Example

>>> a = Simulator()
>>> a.config.integration_density = 20
>>> a.config.integration_volume = 'hemisphere'
>>> a.config.get_orientations_count() # (4 * 21 * 22 / 2) = 924
924
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(json_dict: dict)

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

Parameters:

json_dict (dict) – A required python 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.