Site¶
- class mrsimulator.Site(*, name: str = None, description: str = None, label: str = None, property_units: Dict = {'isotropic_chemical_shift': 'ppm'}, isotope: Union[str, dict, Isotope] = '1H', isotropic_chemical_shift: float = 0.0, shielding_symmetric: SymmetricTensor = None, shielding_antisymmetric: AntisymmetricTensor = None, quadrupolar: SymmetricTensor = None)¶
Bases:
ParseableBase class representing a single-site nuclear spin interaction tensor parameters. The single-site nuclear spin interaction tensors include the nuclear shielding and the electric quadrupolar tensor.
Attribute Documentation
- isotope¶
A string expressed as an atomic number followed by an isotope symbol, eg., ‘13C’, ‘17O’. The default value is ‘1H’.
Example
>>> site = Site(isotope='2H')
- Type:
str (optional).
- isotropic_chemical_shift¶
The isotropic chemical shift of the site in ppm. The default value is 0.
Example
>>> site.isotropic_chemical_shift = 43.3
- Type:
float (optional).
- shielding_symmetric¶
The attribute represents the parameters of the irreducible second-rank traceless symmetric part of the nuclear shielding tensor. The default value is None.
The allowed attributes of the SymmetricTensor class for shielding_symmetric are
zeta,eta,alpha,beta, andgamma, wherezetais the shielding anisotropy, in ppm, andetais the shielding asymmetry parameter defined using the Haeberlen convention. The Euler anglesalpha,beta, andgammaare in radians.Example
>>> site.shielding_symmetric = {'zeta': 10, 'eta': 0.5}
>>> # or equivalently >>> site.shielding_symmetric = SymmetricTensor(zeta=10, eta=0.5)
- Type:
SymmetricTensor or equivalent dict object (optional).
- shielding_antisymmetric¶
The attribute represents the parameters of the irreducible first-rank antisymmetric part of the nuclear shielding tensor. The default value is None.
The allowed attributes of the AntisymmetricTensor class for shielding_antisymmetric are
zeta,alpha, andbeta, wherezetais the anisotropy parameter, in ppm, of the anti-symmetric first-rank tensor. The anglesalphaandbetaare in radians.Example
>>> site.shielding_antisymmetric = {'zeta': 20}
>>> # or equivalently >>> site.shielding_antisymmetric = AntisymmetricTensor(zeta=20)
- Type:
AntisymmetricTensor or equivalent dict object (optional).
- quadrupolar¶
The attribute represents the parameters of the traceless irreducible second-rank symmetric part of the electric-field gradient tensor. The default value is None.
The allowed attributes of the SymmetricTensor class for quadrupolar are
Cq,eta,alpha,beta, andgamma, whereCqis the quadrupolar coupling constant, in Hz, andetais the quadrupolar asymmetry parameter. The Euler anglesalpha,beta, andgammaare in radians.Example
>>> site.quadrupolar = {'Cq': 3.2e6, 'eta': 0.52}
>>> # or equivalently >>> site.quadrupolar = SymmetricTensor(Cq=3.2e6, eta=0.52)
- Type:
SymmetricTensor or equivalent dict object (optional).
- name¶
The name or id of the site. The default value is None.
Example
>>> site.name = '2H-0' >>> site.name '2H-0'
- Type:
str (optional).
- label¶
The label for the site. The default value is None.
Example
>>> site.label = 'Quad site' >>> site.label 'Quad site'
- Type:
str (optional).
- description¶
A description of the site. The default value is None.
Example
>>> site.description = 'An example Quadrupolar site.' >>> site.description 'An example Quadrupolar site.'
- Type:
str (optional).
Example
The following are a few examples of the site object.
>>> site1 = Site( ... isotope='33S', ... isotropic_chemical_shift=20, # in ppm ... shielding_symmetric={ ... "zeta": 10, # in ppm ... "eta": 0.5 ... }, ... quadrupolar={ ... "Cq": 5.1e6, # in Hz ... "eta": 0.5 ... } ... )
Using SymmetricTensor objects.
>>> site1 = Site( ... isotope='13C', ... isotropic_chemical_shift=20, # in ppm ... shielding_symmetric=SymmetricTensor(zeta=10, eta=0.5), ... )
- 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 quantity from a dictionary representation of the Site object, where the physical quantity is expressed as a string with a number and a unit.
- Parameters:
py_dict (dict) – A required python dict object.
- Returns:
Site object.
Example
>>> site_dict = { ... "isotope": "13C", ... "isotropic_chemical_shift": "20 ppm", ... "shielding_symmetric": {"zeta": "10 ppm", "eta":0.5} ... } >>> site1 = Site.parse_dict_with_units(site_dict)
- reduced_dict(exclude={}) dict¶
Returns a reduced dictionary representation of the class object by removing all key-value pairs corresponding to keys listed in the exclude argument, and keys with a value of None.
- Parameters:
exclude – A list of keys to exclude from the dictionary.
Return: A dict.
- rotate(euler_angles: list) None¶
Rotate the site tensors (shielding, quadrupolar) 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 each tensor through.
Example
>>> site = Site(isotope="13C", shielding_symmetric={"zeta": 5, "eta": 0.2}) >>> angles = [(3.1415, 0, -3.1415), (1.5701, 1.5701, 1.5701)] >>> site.rotate(angles)