SymmetricTensor¶
- class mrsimulator.spin_system.tensors.SymmetricTensor(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {'Cq': 'Hz', 'D': 'Hz', 'alpha': 'rad', 'beta': 'rad', 'gamma': 'rad', 'zeta': 'ppm'}, zeta: float = None, Cq: float = None, D: float = None, eta: mrsimulator.spin_system.tensors.ConstrainedFloatValue = None, alpha: float = None, beta: float = None, gamma: float = None)¶
Bases:
mrsimulator.utils.parseable.Parseable
Base SymmetricTensor class representing the traceless symmetric part of an irreducible second-rank tensor.
- zeta¶
The anisotropy parameter of the nuclear shielding tensor, in ppm, expressed using the Haeberlen convention. The default value is None.
Example
>>> shielding = SymmetricTensor() >>> shielding.zeta = 10
- Type
float (optional).
- Cq¶
The quadrupolar coupling constant, in Hz, derived from the electric field gradient tensor. The default value is None.
Example
>>> efg = SymmetricTensor() >>> efg.Cq = 10e6
- Type
float (optional).
- eta¶
The asymmetry parameter of the SymmetricTensor expressed using the Haeberlen convention. The default value is None.
Example
>>> shielding.eta = 0.1 >>> efg.eta = 0.5
- Type
float (optional).
- alpha¶
Euler angle, \(\alpha\), in radians. The default value is None.
Example
>>> shielding.alpha = 0.15 >>> efg.alpha = 1.5
- Type
float (optional).
- beta¶
Euler angle, \(\beta\), in radians. The default value is None.
Example
>>> shielding.beta = 3.1415 >>> efg.beta = 1.1451
- Type
float (optional).
- gamma¶
Euler angle, \(\gamma\), in radians. The default value is None.
Example
>>> shielding.gamma = 2.1 >>> efg.gamma = 0
- Type
float (optional).
Example
>>> shielding = SymmetricTensor(zeta=10, eta=0.1, alpha=0.15, beta=3.14, gamma=2.1) >>> efg = SymmetricTensor(Cq=10e6, eta=0.5, alpha=1.5, beta=1.1451, gamma=0)
- 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.
- rotate(euler_angles: list) None ¶
Rotate the tensor by the given list of Euler angle rotations. Euler angles are given as a list of (alpha, beta, gamma) tuples, and rotations happen in the Haeberlen (ZYZ) convention.
- Parameters
euler_angles ((list)) – An ordered list of angle tuples (alpha, beta, gamma) to rotate through.
Example
>>> tensor = SymmetricTensor(zeta=10, eta=0.3, alpha=1, beta=1, gamma=1) >>> angles = [(3.1415, 0, -3.1415), (1.5701, 1.5701, 1.5701)] >>> tensor.rotate(angles)