Package generic_fns :: Module diffusion_tensor
[hide private]
[frames] | no frames]

Module diffusion_tensor

source code

Module for the support of diffusion tensors.

Functions [hide private]
 
bmrb_read(star)
Read the relaxation data from the NMR-STAR dictionary object.
source code
 
bmrb_write(star)
Generate the diffusion tensor saveframes for the NMR-STAR dictionary object.
source code
 
copy(pipe_from=None, pipe_to=None)
Function for copying diffusion tensor data from one data pipe to another.
source code
 
data_names()
Function for returning a list of names of data structures associated with the sequence.
source code
float
default_value(param)
Return the default values for the diffusion tensor parameters.
source code
 
delete()
Function for deleting diffusion tensor data.
source code
bool
diff_data_exists(pipe=None)
Function for determining if diffusion data exists in the current data pipe.
source code
 
display()
Function for displaying the diffusion tensor.
source code
 
ellipsoid(params=None, time_scale=None, d_scale=None, angle_units=None, param_types=None)
Function for setting up a ellipsoidal diffusion tensor.
source code
 
fold_angles(sim_index=None)
Wrap the Euler or spherical angles and remove the glide reflection and translational symmetries.
source code
 
init(params=None, time_scale=1.0, d_scale=1.0, angle_units='deg', param_types=0, spheroid_type=None, fixed=1)
Function for initialising the diffusion tensor.
source code
list of len 2 of floats
map_bounds(param, spin_id=None)
The function for creating bounds for the mapping function.
source code
 
map_labels(index, params, bounds, swap, inc)
Function for creating labels, tick locations, and tick values for an OpenDX map.
source code
float
return_conversion_factor(param)
Function for returning the factor of conversion between different parameter units.
source code
str
return_data_name(name)
Return the parameter name.
source code
 
return_eigenvalues()
Function for returning Dx, Dy, and Dz.
source code
str
return_units(param)
Function for returning a string representing the parameters units.
source code
 
set(value=None, param=None)
Set the diffusion tensor parameters.
source code
 
sphere(params=None, time_scale=None, param_types=None)
Function for setting up a spherical diffusion tensor.
source code
 
spheroid(params=None, time_scale=None, d_scale=None, angle_units=None, param_types=None, spheroid_type=None)
Function for setting up a spheroidal diffusion tensor.
source code
3D rank-1 array, 3D rank-2 array, float, float, float
tensor_eigen_system(tensor)
Determine the eigenvalues and vectors for the tensor, sorting the entries.
source code
 
test_params(num_params)
Function for testing the validity of the input parameters.
source code
 
unit_axes()
Function for calculating the unit axes of the diffusion tensor.
source code
Variables [hide private]
  __default_value_prompt_doc__ = ['Diffusion tensor parameter de...
  __return_data_name_prompt_doc__ = ['Diffusion tensor parameter...
  __set_prompt_doc__ = ['Diffusion tensor set details', '\n ...
  __package__ = 'generic_fns'

Imports: deepcopy, cos, pi, sin, cross, float64, int32, ones, transpose, zeros, norm, svd, itemgetter, search, string, wrap_angles, DiffTensorData, pipes, fold_spherical_angles, get_molecule_names, spin_loop, cartesian_to_spherical, R_to_euler_zyz, element_from_isotope, number_from_isotope, RelaxError, RelaxNoTensorError, RelaxStrError, RelaxTensorError, RelaxUnknownParamCombError, RelaxUnknownParamError


Function Details [hide private]

bmrb_read(star)

source code 

Read the relaxation data from the NMR-STAR dictionary object.

Parameters:
  • star (NMR_STAR instance) - The NMR-STAR dictionary object.

bmrb_write(star)

source code 

Generate the diffusion tensor saveframes for the NMR-STAR dictionary object.

Parameters:
  • star (NMR_STAR instance) - The NMR-STAR dictionary object.

copy(pipe_from=None, pipe_to=None)

source code 

Function for copying diffusion tensor data from one data pipe to another.

Parameters:
  • pipe_from (str) - The data pipe to copy the diffusion tensor data from. This defaults to the current data pipe.
  • pipe_to (str) - The data pipe to copy the diffusion tensor data to. This defaults to the current data pipe.

default_value(param)

source code 

Return the default values for the diffusion tensor parameters.

Parameters:
  • param (str) - The name of the parameter.
Returns: float
The default value.

diff_data_exists(pipe=None)

source code 

Function for determining if diffusion data exists in the current data pipe.

Parameters:
  • pipe (str) - The data pipe to search for data in.
Returns: bool
The answer to the question.

ellipsoid(params=None, time_scale=None, d_scale=None, angle_units=None, param_types=None)

source code 

Function for setting up a ellipsoidal diffusion tensor.

Parameters:
  • params (float) - The diffusion tensor parameter.
  • time_scale (float) - The correlation time scaling value.
  • d_scale (float) - The diffusion tensor eigenvalue scaling value.
  • angle_units (str) - The units for the angle parameters which can be either 'deg' or 'rad'.
  • param_types (int) - The type of parameters supplied. These correspond to 0: {tm, Da, theta, phi}, 1: {Diso, Da, theta, phi}, 2: {tm, Dratio, theta, phi}, 3: {Dpar, Dper, theta, phi}, 4: {Diso, Dratio, theta, phi}.

fold_angles(sim_index=None)

source code 

Wrap the Euler or spherical angles and remove the glide reflection and translational symmetries.

Wrap the angles such that:

   0 <= theta <= pi,
   0 <= phi <= 2pi,

and:

   0 <= alpha <= 2pi,
   0 <= beta <= pi,
   0 <= gamma <= 2pi.

For the simulated values, the angles are wrapped as:

   theta - pi/2 <= theta_sim <= theta + pi/2
   phi - pi <= phi_sim <= phi + pi

and:

   alpha - pi <= alpha_sim <= alpha + pi
   beta - pi/2 <= beta_sim <= beta + pi/2
   gamma - pi <= gamma_sim <= gamma + pi
Parameters:
  • sim_index (int or None) - The simulation index. If set to None then the actual values will be folded rather than the simulation values.

init(params=None, time_scale=1.0, d_scale=1.0, angle_units='deg', param_types=0, spheroid_type=None, fixed=1)

source code 

Function for initialising the diffusion tensor.

Parameters:
  • params (float) - The diffusion tensor parameters.
  • time_scale (float) - The correlation time scaling value.
  • d_scale (float) - The diffusion tensor eigenvalue scaling value.
  • angle_units (str (either 'deg' or 'rad')) - The units for the angle parameters.
  • param_types (int) - The type of parameters supplied. For spherical diffusion, the flag values correspond to 0: tm, 1: Diso. For spheroidal diffusion, 0: {tm, Da, theta, phi}, 1: {Diso, Da, theta, phi}, 2: {tm, Dratio, theta, phi}, 3: {Dpar, Dper, theta, phi}, 4: {Diso, Dratio, theta, phi}. For ellipsoidal diffusion, 0: {tm, Da, Dr, alpha, beta, gamma}, 1: {Diso, Da, Dr, alpha, beta, gamma}, 2: {Dx, Dy, Dz, alpha, beta, gamma}.
  • spheroid_type (str) - A string which, if supplied together with spheroid parameters, will restrict the tensor to either being 'oblate' or 'prolate'.
  • fixed (bin) - A flag specifying whether the diffusion tensor is fixed or can be optimised.

map_bounds(param, spin_id=None)

source code 

The function for creating bounds for the mapping function.

Parameters:
  • param (str) - The name of the parameter to return the bounds for.
  • spin_id (None or str) - The spin identification string. This arg is unused.
Returns: list of len 2 of floats
The bounds for the parameter.

return_conversion_factor(param)

source code 

Function for returning the factor of conversion between different parameter units.

For example, the internal representation of tm is in seconds, whereas the external representation is in nanoseconds, therefore this function will return 1e-9 for tm.

Parameters:
  • param (str) - The name of the parameter to return the conversion factor for.
Returns: float
The conversion factor.

return_data_name(name)

source code 

Return the parameter name.

Parameters:
  • name (str) - The name of the parameter to return the name of.
Returns: str
The parameter name.

return_units(param)

source code 

Function for returning a string representing the parameters units.

For example, the internal representation of tm is in seconds, whereas the external representation is in nanoseconds, therefore this function will return the string 'nanoseconds' for tm.

Parameters:
  • param (str) - The name of the parameter to return the units for.
Returns: str
The parameter units string.

set(value=None, param=None)

source code 

Set the diffusion tensor parameters.

Parameters:
  • tensor (DiffTensorData instance) - The diffusion tensor object.
  • value (list of float) - The list of values to set the parameters to.
  • param (list of str) - The list of parameter names.

sphere(params=None, time_scale=None, param_types=None)

source code 

Function for setting up a spherical diffusion tensor.

Parameters:
  • params (float) - The diffusion tensor parameter.
  • time_scale (float) - The correlation time scaling value.
  • param_types (int) - The type of parameter supplied. If 0, then the parameter is tm. If 1, then the parameter is Diso.

spheroid(params=None, time_scale=None, d_scale=None, angle_units=None, param_types=None, spheroid_type=None)

source code 

Function for setting up a spheroidal diffusion tensor.

Parameters:
  • params (float) - The diffusion tensor parameter.
  • time_scale (float) - The correlation time scaling value.
  • d_scale (float) - The diffusion tensor eigenvalue scaling value.
  • angle_units (str) - The units for the angle parameters which can be either 'deg' or 'rad'.
  • param_types (int) - The type of parameters supplied. These correspond to 0: {tm, Da, theta, phi}, 1: {Diso, Da, theta, phi}, 2: {tm, Dratio, theta, phi}, 3: {Dpar, Dper, theta, phi}, 4: {Diso, Dratio, theta, phi}.
  • spheroid_type (str) - A string which, if supplied together with spheroid parameters, will restrict the tensor to either being 'oblate' or 'prolate'.

tensor_eigen_system(tensor)

source code 

Determine the eigenvalues and vectors for the tensor, sorting the entries.

Returns: 3D rank-1 array, 3D rank-2 array, float, float, float
The eigenvalues, rotation matrix, and the Euler angles in zyz notation.

unit_axes()

source code 

Function for calculating the unit axes of the diffusion tensor.

Spheroid

The unit Dpar vector is:

            | sin(theta) * cos(phi) |
   Dpar  =  | sin(theta) * sin(phi) |
            |      cos(theta)       |

Ellipsoid

The unit Dx vector is:

          | -sin(alpha) * sin(gamma) + cos(alpha) * cos(beta) * cos(gamma) |
   Dx  =  | -sin(alpha) * cos(gamma) - cos(alpha) * cos(beta) * sin(gamma) |
          |                    cos(alpha) * sin(beta)                      |

The unit Dy vector is:

          | cos(alpha) * sin(gamma) + sin(alpha) * cos(beta) * cos(gamma) |
   Dy  =  | cos(alpha) * cos(gamma) - sin(alpha) * cos(beta) * sin(gamma) |
          |                   sin(alpha) * sin(beta)                      |

The unit Dz vector is:

          | -sin(beta) * cos(gamma) |
   Dz  =  |  sin(beta) * sin(gamma) |
          |        cos(beta)        |

Variables Details [hide private]

__default_value_prompt_doc__

Value:
['Diffusion tensor parameter default values',
 '''
        ______________________________________________________________\
__________
        |                        |                    |               \
         |
        | Data type              | Object name        | Value         \
         |
...

__return_data_name_prompt_doc__

Value:
['Diffusion tensor parameter string matching patterns',
 '''
        ______________________________________________________________\
______________________________
        |                                                        |    \
          |                  |
        | Data type                                              | Obj\
ect name  | Patterns         |
...

__set_prompt_doc__

Value:
['Diffusion tensor set details',
 '''
        If the diffusion tensor has not been setup, use the more power\
ful function \'diffusion_tensor.init\' to initialise the tensor parame\
ters.  This function cannot be used to initialise a diffusion tensor.

        The units of the parameters are:

...