ConfigSimulator¶
- class mrsimulator.simulator.ConfigSimulator(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {}, number_of_sidebands: mrsimulator.simulator.config.ConstrainedIntValue = 64, number_of_gamma_angles: mrsimulator.simulator.config.ConstrainedIntValue = 1, integration_volume: typing_extensions.Literal[octant, hemisphere] = 'octant', integration_density: mrsimulator.simulator.config.ConstrainedIntValue = 70, decompose_spectrum: typing_extensions.Literal[none, spin_system] = 'none', isotropic_interpolation: typing_extensions.Literal[linear, gaussian] = 'linear')¶
Bases:
mrsimulator.utils.parseable.Parseable
The configurable attributes for the Simulator class used in simulation.
- number_of_sidebands¶
Number of sidebands to evaluate in the simulation. The default value is 64. Value cannot be negative or zero.
- Type
int (optional).
- number_of_gamma_angles¶
Number of gamma angles averages in the simulation. The default value is 1. Value cannot be negative or zero.
- Type
int (optional).
- integration_volume¶
The spatial volume over which the spectral frequency integration/averaging is performed. The valid literals of this enumeration are
octant
(default), andhemisphere
- Type
enum (optional).
- integration_density¶
The integration/sampling density or equivalently the number of (alpha, beta) orientations over which the frequency spatial averaging is performed within the 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} n_\gamma,\]where \(n_\text{octants}\) is the number of octants in the given volume and \(n_\gamma\) is the number of gamma angles. 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.number_of_gamma_angles = 10 >>> 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.