Package data :: Module diff_tensor
[hide private]
[frames] | no frames]

Module diff_tensor

source code

Classes [hide private]
  DiffTensorData
An empty data container for the diffusion tensor elements.
  DiffTensorSimList
Empty data container for Monte Carlo simulation diffusion tensor data.
Functions [hide private]
float
calc_Diso(tm)
Function for calculating the Diso value.
source code
float
calc_Dpar(Diso, Da)
Function for calculating the Dpar value.
source code
numpy array
calc_Dpar_unit(theta, phi)
Function for calculating the Dpar unit vector.
source code
float
calc_Dper(Diso, Da)
Function for calculating the Dper value.
source code
float
calc_Dratio(Dpar, Dper)
Function for calculating the Dratio value.
source code
float
calc_Dx(Diso, Da, Dr)
Function for calculating the Dx value.
source code
numpy array
calc_Dx_unit(alpha, beta, gamma)
Function for calculating the Dx unit vector.
source code
float
calc_Dy(Diso, Da, Dr)
Function for calculating the Dy value.
source code
numpy array
calc_Dy_unit(alpha, beta, gamma)
Function for calculating the Dy unit vector.
source code
float
calc_Dz(Diso, Da)
Function for calculating the Dz value.
source code
numpy array
calc_Dz_unit(beta, gamma)
Function for calculating the Dz unit vector.
source code
numpy 3x3 array
calc_rotation(diff_type, *args)
Function for calculating the rotation matrix.
source code
str
calc_spheroid_type(Da, spheroid_type, flag)
Determine the spheroid type.
source code
numpy 3x3 array
calc_tensor(rotation, tensor_diag)
Function for calculating the diffusion tensor (in the structural frame).
source code
numpy 3x3 array
calc_tensor_diag(diff_type, *args)
Function for calculating the diagonalised diffusion tensor.
source code
 
dependency_generator(diff_type)
Generator for the automatic updating the diffusion tensor data structures.
source code
Variables [hide private]
  __package__ = 'data'

Imports: deepcopy, search, cos, sin, array, float64, dot, identity, transpose, zeros, ListType, Element, spherical_to_cartesian, two_vect_to_R, RelaxError, fill_object_contents, xml_to_object


Function Details [hide private]

calc_Diso(tm)

source code 

Function for calculating the Diso value.

The equation for calculating the parameter is:

   Diso  =  1 / (6tm).
Parameters:
  • tm (float) - The global correlation time.
Returns: float
The isotropic diffusion rate (Diso).

calc_Dpar(Diso, Da)

source code 

Function for calculating the Dpar value.

The equation for calculating the parameter is:

   Dpar  =  Diso + 2/3 Da.
Parameters:
  • Diso (float) - The isotropic diffusion rate.
  • Da (float) - The anisotropic diffusion rate.
Returns: float
The diffusion rate parallel to the unique axis of the spheroid.

calc_Dpar_unit(theta, phi)

source code 

Function for calculating the Dpar unit vector.

The unit vector parallel to the unique axis of the diffusion tensor is:

                 | sin(theta) * cos(phi) |
   Dpar_unit  =  | sin(theta) * sin(phi) |.
                 |      cos(theta)       |
Parameters:
  • theta (float) - The azimuthal angle in radians.
  • phi (float) - The polar angle in radians.
Returns: numpy array
The Dpar unit vector.

calc_Dper(Diso, Da)

source code 

Function for calculating the Dper value.

The equation for calculating the parameter is:

   Dper  =  Diso - 1/3 Da.
Parameters:
  • Diso (float) - The isotropic diffusion rate.
  • Da (float) - The anisotropic diffusion rate.
Returns: float
The diffusion rate perpendicular to the unique axis of the spheroid.

calc_Dratio(Dpar, Dper)

source code 

Function for calculating the Dratio value.

The equation for calculating the parameter is:

   Dratio  =  Dpar / Dper.
Parameters:
  • Dpar (float) - The diffusion rate parallel to the unique axis of the spheroid.
  • Dper (float) - The diffusion rate perpendicular to the unique axis of the spheroid.
Returns: float
The ratio of the parallel and perpendicular diffusion rates.

calc_Dx(Diso, Da, Dr)

source code 

Function for calculating the Dx value.

The equation for calculating the parameter is:

   Dx  =  Diso - 1/3 Da(1 + 3Dr).
Parameters:
  • Diso (float) - The isotropic diffusion rate.
  • Da (float) - The anisotropic diffusion rate.
  • Dr (float) - The rhombic component of the diffusion tensor.
Returns: float
The diffusion rate parallel to the x-axis of the ellipsoid.

calc_Dx_unit(alpha, beta, gamma)

source code 

Function for calculating the Dx unit vector.

The unit Dx vector is:

               | -sin(alpha) * sin(gamma) + cos(alpha) * cos(beta) * cos(gamma) |
   Dx_unit  =  | -sin(alpha) * cos(gamma) - cos(alpha) * cos(beta) * sin(gamma) |.
               |                    cos(alpha) * sin(beta)                      |
Parameters:
  • alpha (float) - The Euler angle alpha in radians using the z-y-z convention.
  • beta (float) - The Euler angle beta in radians using the z-y-z convention.
  • gamma (float) - The Euler angle gamma in radians using the z-y-z convention.
Returns: numpy array
The Dx unit vector.

calc_Dy(Diso, Da, Dr)

source code 

Function for calculating the Dy value.

The equation for calculating the parameter is:

   Dy  =  Diso - 1/3 Da(1 - 3Dr),
Parameters:
  • Diso (float) - The isotropic diffusion rate.
  • Da (float) - The anisotropic diffusion rate.
  • Dr (float) - The rhombic component of the diffusion tensor.
Returns: float
The Dy value.

calc_Dy_unit(alpha, beta, gamma)

source code 

Function for calculating the Dy unit vector.

The unit Dy vector is:

               | cos(alpha) * sin(gamma) + sin(alpha) * cos(beta) * cos(gamma) |
   Dy_unit  =  | cos(alpha) * cos(gamma) - sin(alpha) * cos(beta) * sin(gamma) |.
               |                   sin(alpha) * sin(beta)                      |
Parameters:
  • alpha (float) - The Euler angle alpha in radians using the z-y-z convention.
  • beta (float) - The Euler angle beta in radians using the z-y-z convention.
  • gamma (float) - The Euler angle gamma in radians using the z-y-z convention.
Returns: numpy array
The Dy unit vector.

calc_Dz(Diso, Da)

source code 

Function for calculating the Dz value.

The equation for calculating the parameter is:

   Dz  =  Diso + 2/3 Da.
Parameters:
  • Diso (float) - The isotropic diffusion rate.
  • Da (float) - The anisotropic diffusion rate.
Returns: float
The Dz value.

calc_Dz_unit(beta, gamma)

source code 

Function for calculating the Dz unit vector.

The unit Dz vector is:

               | -sin(beta) * cos(gamma) |
   Dz_unit  =  |  sin(beta) * sin(gamma) |.
               |        cos(beta)        |
Parameters:
  • beta (float) - The Euler angle beta in radians using the z-y-z convention.
  • gamma (float) - The Euler angle gamma in radians using the z-y-z convention.
Returns: numpy array
The Dz unit vector.

calc_rotation(diff_type, *args)

source code 

Function for calculating the rotation matrix.

Spherical diffusion

As the orientation of the diffusion tensor within the structural frame is undefined when the molecule diffuses as a sphere, the rotation matrix is simply the identity matrix:

         | 1  0  0 |
   R  =  | 0  1  0 |.
         | 0  0  1 |

Spheroidal diffusion

The rotation matrix required to shift from the diffusion tensor frame to the structural frame is generated from the unique axis of the diffusion tensor.

Ellipsoidal diffusion

The rotation matrix required to shift from the diffusion tensor frame to the structural frame is equal to:

   R  =  | Dx_unit  Dy_unit  Dz_unit |,

         | Dx_unit[0]  Dy_unit[0]  Dz_unit[0] |
      =  | Dx_unit[1]  Dy_unit[1]  Dz_unit[1] |.
         | Dx_unit[2]  Dy_unit[2]  Dz_unit[2] |
Parameters:
  • args (tuple) - All the function arguments.
  • theta (float) - The azimuthal angle in radians.
  • phi (float) - The polar angle in radians.
  • Dx_unit (numpy array) - The Dx unit vector.
  • Dy_unit (numpy array) - The Dy unit vector.
  • Dz_unit (numpy array) - The Dz unit vector.
Returns: numpy 3x3 array
The rotation matrix.

calc_spheroid_type(Da, spheroid_type, flag)

source code 

Determine the spheroid type.

Parameters:
  • Da (float) - The diffusion tensor anisotropy.
  • spheroid_type (str) - The current value of spheroid_type.
  • flag (bool) - A flag which if True will cause the current spheroid_type value to be returned.
Returns: str
The spheroid type, either 'oblate' or 'prolate'.

calc_tensor(rotation, tensor_diag)

source code 

Function for calculating the diffusion tensor (in the structural frame).

The diffusion tensor is calculated using the diagonalised tensor and the rotation matrix through the equation:

   R . tensor_diag . R^T.
Parameters:
  • rotation (numpy 3x3 array) - The rotation matrix.
  • tensor_diag (numpy 3x3 array) - The diagonalised diffusion tensor.
Returns: numpy 3x3 array
The diffusion tensor (within the structural frame).

calc_tensor_diag(diff_type, *args)

source code 

Function for calculating the diagonalised diffusion tensor.

The diagonalised spherical diffusion tensor is defined as:

              | Diso     0     0 |
   tensor  =  |    0  Diso     0 |.
              |    0     0  Diso |

The diagonalised spheroidal tensor is defined as:

              | Dper     0     0 |
   tensor  =  |    0  Dper     0 |.
              |    0     0  Dpar |

The diagonalised ellipsoidal diffusion tensor is defined as:

              | Dx   0   0 |
   tensor  =  |  0  Dy   0 |.
              |  0   0  Dz |
Parameters:
  • args (tuple) - All the arguments.
  • Diso (float) - The Diso parameter of the sphere.
  • Dpar (float) - The Dpar parameter of the spheroid.
  • Dper (float) - The Dper parameter of the spheroid.
  • Dx (float) - The Dx parameter of the ellipsoid.
  • Dy (float) - The Dy parameter of the ellipsoid.
  • Dz (float) - The Dz parameter of the ellipsoid.
Returns: numpy 3x3 array
The diagonalised diffusion tensor.

dependency_generator(diff_type)

source code 

Generator for the automatic updating the diffusion tensor data structures.

The order of the yield statements is important!

Parameters:
  • diff_type (str) - The type of Brownian rotational diffusion.
Returns:
This generator successively yields three objects, the target object to update, the list of parameters which if modified cause the target to be updated, and the list of parameters that the target depends upon.