Package pipe_control :: Module align_tensor
[hide private]
[frames] | no frames]

Module align_tensor

source code

Module containing functions for the handling of alignment tensors.

Functions [hide private]
bool
align_data_exists(tensor, pipe=None)
Function for determining if alignment data exists in the current data pipe.
source code
bool
all_tensors_fixed()
Determine if all alignment tensors are fixed.
source code
 
copy(tensor_from=None, pipe_from=None, tensor_to=None, pipe_to=None)
Function for copying alignment tensor data from one data pipe to another.
source code
 
delete(tensor=None)
Function for deleting alignment tensor data.
source code
 
display(tensor=None)
Function for displaying the alignment tensor.
source code
 
fix(id=None, fixed=True)
Fix the alignment tensor during optimisation.
source code
 
fold_angles(sim_index=None)
Wrap the Euler angles and remove the glide reflection and translational symmetries.
source code
float
gdo(A)
Calculate the generalized degree of order (GDO) for the given alignment tensor.
source code
list of str
get_align_ids()
Return the list of all alignment IDs.
source code
list of str
get_tensor_ids()
Return the list of all tensor IDs.
source code
int
get_tensor_index(tensor=None, align_id=None, pipe=None)
Function for returning the index corresponding to the 'tensor' argument.
source code
AlignTensorData instance
get_tensor_object(tensor, pipe=None)
Return the AlignTensorData instance corresponding to the tensor ID.
source code
AlignTensorData instance
get_tensor_object_from_align(align_id, pipe=None)
Return the unique AlignTensorData instance corresponding to the alignment ID.
source code
 
init(tensor=None, align_id=None, params=None, scale=1.0, angle_units='deg', param_types=0, domain=None, errors=False)
Function for initialising the alignment tensor.
source code
 
matrix_angles(basis_set=0, tensors=None)
Function for calculating the 5D angles between the alignment tensors.
source code
int
num_tensors(skip_fixed=True)
Count the number of tensors.
source code
bool
opt_uses_align_data(align_id=None)
Determine if the PCS or RDC data for the given alignment ID is needed for optimisation.
source code
bool
opt_uses_tensor(tensor)
Determine if the given tensor is to be optimised.
source code
 
reduction(full_tensor=None, red_tensor=None)
Specify which tensor is a reduction of which other tensor.
source code
data.align_tensor.AlignTensorData instance
return_tensor(index, skip_fixed=True)
Return the tensor container for the given index, skipping fixed tensors if required.
source code
 
set(tensor=None, value=None, param=None, errors=False)
Set the tensor.
source code
 
set_align_id(tensor=None, align_id=None)
Set the align ID string for the given tensor.
source code
 
set_domain(tensor=None, domain=None)
Set the domain label for the given tensor.
source code
 
svd(basis_set=0, tensors=None)
Function for calculating the singular values of all the loaded tensors.
source code
Variables [hide private]
  __package__ = 'pipe_control'

Imports: deepcopy, pi, sqrt, arccos, dot, float64, linalg, zeros, norm, sys, warn, AlignTensorList, calc_chi_tensor, kappa, RelaxError, RelaxNoTensorError, RelaxTensorError, RelaxUnknownParamCombError, RelaxUnknownParamError, wrap_angles, write_data, RelaxWarning, pipe_control, pipes


Function Details [hide private]

align_data_exists(tensor, pipe=None)

source code 

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

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

all_tensors_fixed()

source code 

Determine if all alignment tensors are fixed.

Returns: bool
True if all tensors are fixed, False otherwise.

copy(tensor_from=None, pipe_from=None, tensor_to=None, pipe_to=None)

source code 

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

Parameters:
  • tensor_from (str) - The identification string of the alignment tensor to copy the data from.
  • pipe_from (str) - The data pipe to copy the alignment tensor data from. This defaults to the current data pipe.
  • tensor_to (str or None) - The identification string of the alignment tensor to copy the data to. If set to None, then the ID string will be set to the value of tensor_from.
  • pipe_to (str) - The data pipe to copy the alignment tensor data to. This defaults to the current data pipe.

delete(tensor=None)

source code 

Function for deleting alignment tensor data.

Parameters:
  • tensor (str or None) - The alignment tensor identification string.

display(tensor=None)

source code 

Function for displaying the alignment tensor.

Parameters:
  • tensor (str or None) - The alignment tensor identification string.

fix(id=None, fixed=True)

source code 

Fix the alignment tensor during optimisation.

Parameters:
  • id (str or None) - The alignment tensor ID string. If set to None, then all alignment tensors will be fixed.
  • fixed (bool) - If True, the alignment tensor will be fixed during optimisation. If False, the alignment tensors will be optimised.

fold_angles(sim_index=None)

source code 

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

Wrap the angles such that:

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

For the simulated values, the angles are wrapped as:

   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.

gdo(A)

source code 

Calculate the generalized degree of order (GDO) for the given alignment tensor.

Parameters:
  • A (rank-2, 3D numpy array) - The alignment tensor.
Returns: float
The GDO value.

get_align_ids()

source code 

Return the list of all alignment IDs.

Returns: list of str
The list of all alignment IDs.

get_tensor_ids()

source code 

Return the list of all tensor IDs.

Returns: list of str
The list of all tensor IDs.

get_tensor_index(tensor=None, align_id=None, pipe=None)

source code 

Function for returning the index corresponding to the 'tensor' argument.

Parameters:
  • tensor (str or None) - The alignment tensor identification string.
  • align_id (str or None) - Alternative to the tensor argument, used to return the tensor index for the tensors corresponding to the alignment ID string. If more than one tensor exists, then this will fail.
  • pipe (str) - The data pipe to search for data in.
Returns: int
The index corresponding to the 'tensor' arg.

get_tensor_object(tensor, pipe=None)

source code 

Return the AlignTensorData instance corresponding to the tensor ID.

Parameters:
  • tensor (str) - The alignment tensor identification string.
  • pipe (str) - The data pipe to search for data in.
Returns: AlignTensorData instance
The alignment tensor object corresponding to the 'tensor' arg.

get_tensor_object_from_align(align_id, pipe=None)

source code 

Return the unique AlignTensorData instance corresponding to the alignment ID.

Parameters:
  • align_id (str) - The alignment ID for the unique tensor.
Returns: AlignTensorData instance
The alignment tensor object corresponding to the 'tensor' arg.

init(tensor=None, align_id=None, params=None, scale=1.0, angle_units='deg', param_types=0, domain=None, errors=False)

source code 

Function for initialising the alignment tensor.

Parameters:
  • tensor (str) - The alignment tensor identification string.
  • align_id (str or None) - The alignment ID string that the tensor corresponds to.
  • params (float) - The alignment tensor parameters.
  • scale (float) - The alignment tensor eigenvalue scaling value.
  • angle_units (str) - The units for the angle parameters (either 'deg' or 'rad').
  • param_types (int) - The type of parameters supplied. The flag values correspond to, 0: {Axx, Ayy, Axy, Axz, Ayz}, and 1: {Azz, Axx-yy, Axy, Axz, Ayz}.
  • domain (str or None) - The domain label.
  • errors (bool) - A flag which determines if the alignment tensor data or its errors are being input.

matrix_angles(basis_set=0, tensors=None)

source code 

Function for calculating the 5D angles between the alignment tensors.

The basis set used for the 5D vector construction changes the angles calculated.

Parameters:
  • basis_set (int) - The basis set to use for constructing the 5D vectors. If set to 0, the basis set is {Sxx, Syy, Sxy, Sxz, Syz}. If 1, then the basis set is {Szz, Sxxyy, Sxy, Sxz, Syz}.
  • tensors (None or array of str) - An array of tensors to apply SVD to. If None, all tensors will be used.

num_tensors(skip_fixed=True)

source code 

Count the number of tensors.

Parameters:
  • skip_fixed (bool) - If set to True, then only the tensors without the fixed flag will be counted. If set to False, then all tensors will be counted.
Returns: int
The number of tensors (excluding fixed tensors by default).

opt_uses_align_data(align_id=None)

source code 

Determine if the PCS or RDC data for the given alignment ID is needed for optimisation.

Parameters:
  • align_id (str) - The optional alignment ID string.
Returns: bool
True if alignment data is to be used for optimisation, False otherwise.

opt_uses_tensor(tensor)

source code 

Determine if the given tensor is to be optimised.

Parameters:
  • tensor (AlignmentTensor object.) - The alignment tensor to check.
Returns: bool
True if the tensor is to be optimised, False otherwise.

reduction(full_tensor=None, red_tensor=None)

source code 

Specify which tensor is a reduction of which other tensor.

Parameters:
  • full_tensor (str) - The full alignment tensor.
  • red_tensor (str) - The reduced alignment tensor.

return_tensor(index, skip_fixed=True)

source code 

Return the tensor container for the given index, skipping fixed tensors if required.

Parameters:
  • index (int) - The index of the tensor (if skip_fixed is True, then fixed tensors are not included in the index count).
  • skip_fixed (bool) - A flag which if True will exclude fixed tensors from the indexation.
Returns: data.align_tensor.AlignTensorData instance
The tensor corresponding to the index.

set(tensor=None, value=None, param=None, errors=False)

source code 

Set the tensor.

Parameters:
  • tensor (AlignTensorData instance) - The alignment tensor object.
  • value (list of float) - The list of values to set the parameters to.
  • param (list of str) - The list of parameter names.
  • errors (bool) - A flag which determines if the alignment tensor data or its errors are being input.

set_align_id(tensor=None, align_id=None)

source code 

Set the align ID string for the given tensor.

Parameters:
  • tensor (str) - The alignment tensor label.
  • align_id (str) - The alignment ID string.

set_domain(tensor=None, domain=None)

source code 

Set the domain label for the given tensor.

Parameters:
  • tensor (str) - The alignment tensor label.
  • domain (str) - The domain label.

svd(basis_set=0, tensors=None)

source code 

Function for calculating the singular values of all the loaded tensors.

The matrix on which SVD will be performed is:

   | Sxx1 Syy1 Sxy1 Sxz1 Syz1 |
   | Sxx2 Syy2 Sxy2 Sxz2 Syz2 |
   | Sxx3 Syy3 Sxy3 Sxz3 Syz3 |
   |  .    .    .    .    .   |
   |  .    .    .    .    .   |
   |  .    .    .    .    .   |
   | SxxN SyyN SxyN SxzN SyzN |

This is the default unitary basis set (selected when basis_set is 0). Alternatively a geometric basis set consisting of the stretching and skewing parameters Szz and Sxx-yy respectively replacing Sxx and Syy can be chosen by setting basis_set to 1. The matrix in this case is:

   | Szz1 Sxxyy1 Sxy1 Sxz1 Syz1 |
   | Szz2 Sxxyy2 Sxy2 Sxz2 Syz2 |
   | Szz3 Sxxyy3 Sxy3 Sxz3 Syz3 |
   |  .     .     .    .    .   |
   |  .     .     .    .    .   |
   |  .     .     .    .    .   |
   | SzzN SxxyyN SxyN SxzN SyzN |

The relationships between the geometric and unitary basis sets are:

   Szz = - Sxx - Syy,
   Sxxyy = Sxx - Syy,

The SVD values and condition number are dependendent upon the basis set chosen.

Parameters:
  • basis_set (int) - The basis set to create the 5 by n matrix on which to perform SVD.
  • tensors (None or array of str) - An array of tensors to apply SVD to. If None, all tensors will be used.