Package specific_analyses :: Package frame_order :: Module optimisation
[hide private]
[frames] | no frames]

Module optimisation

source code

Module for the optimisation of the frame order models.

Classes [hide private]
  Frame_order_grid_command
Command class for relaxation dispersion optimisation on the slave processor.
  Frame_order_memo
The frame order memo class.
  Frame_order_minimise_command
Command class for relaxation dispersion optimisation on the slave processor.
  Frame_order_result_command
Class for processing the frame order results.
Functions [hide private]
 
count_sobol_points(target_fn=None, verbosity=1)
Count the number of Sobol' points for the current parameter values of the model.
source code
list of float
grid_row(incs, lower, upper, dist_type=None, end_point=True)
Set up a row of the grid search for a given parameter.
source code
numpy rank-3 array, numpy rank-1 array.
minimise_setup_atomic_pos(sim_index=None, verbosity=1)
Set up the atomic position data structures for optimisation using PCSs and PREs as base data sets.
source code
tuple of (numpy rank-2 array, numpy rank-2 array, numpy rank-2 array, numpy rank-1 array, numpy rank-1 array)
minimise_setup_pcs(sim_index=None)
Set up the data structures for optimisation using PCSs as base data sets.
source code
tuple of (numpy rank-2 array, numpy rank-2 array, numpy rank-2 array, numpy rank-3 array, numpy rank-2 array, numpy rank-2 array)
minimise_setup_rdcs(sim_index=None)
Set up the data structures for optimisation using RDCs as base data sets.
source code
tuple of 3 numpy nx5D, rank-1 arrays
minimise_setup_tensors(sim_index=None)
Set up the data structures for optimisation using alignment tensors as base data sets.
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_pcs(align_id)
Determine if the PCS data for the given alignment ID is needed for optimisation.
source code
bool
opt_uses_rdc(align_id)
Determine if the RDC data for the given alignment ID is needed for optimisation.
source code
 
store_bc_data(A_5D_bc=None, pcs_theta=None, rdc_theta=None)
Store the back-calculated data.
source code
 
target_fn_data_setup(sim_index=None, verbosity=1, scaling_matrix=None, unset_fail=False)
Initialise the target function for optimisation or direct calculation.
source code
 
unpack_opt_results(param_vector=None, func=None, iter_count=None, f_count=None, g_count=None, h_count=None, warning=None, scaling_matrix=None, sim_index=None)
Unpack and store the Frame Order optimisation results.
source code
Variables [hide private]
  __package__ = 'specific_analyses.frame_order'

Imports: cos, pi, generic_minimise, grid_point_array, arccos, array, dot, float64, ndarray, ones, zeros, inv, norm, sys, warn, is_float, isNaN, isInf, RelaxError, RelaxInfError, RelaxNaNError, RelaxNoPCSError, RelaxNoRDCError, tmax_pseudo_ellipse_array, MODEL_DOUBLE_ROTOR, MODEL_FREE_ROTOR, MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, MODEL_LIST_FREE_ROTORS, MODEL_LIST_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE_FREE_ROTOR, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID, MODEL_ROTOR, wrap_angles, periodic_table, dipolar_constant, RelaxWarning, Memo, Result_command, Slave_command, interatomic_loop, return_spin, spin_loop, pipe_centre_of_mass, check_domain, check_model, check_parameters, base_data_types, domain_moving, pivot_fixed, tensor_loop, assemble_param_vector, linear_constraints, Frame_order, sobol_data


Function Details [hide private]

count_sobol_points(target_fn=None, verbosity=1)

source code 

Count the number of Sobol' points for the current parameter values of the model.

The count will be stored in the current data pipe and printed out.

Parameters:
  • target_fn (target_functions.frame_order.Frame_order instance) - The pre-initialised frame order target function class.
  • verbosity (int) - If greater than 0, lots of information will be printed out.

grid_row(incs, lower, upper, dist_type=None, end_point=True)

source code 

Set up a row of the grid search for a given parameter.

Parameters:
  • incs (int) - The number of increments.
  • lower (float) - The lower bounds.
  • upper (float) - The upper bounds.
  • dist_type (None or str) - The spacing or distribution type between grid nodes. If None, then a linear grid row is returned. If 'acos', then an inverse cos distribution of points is returned (e.g. for uniform sampling in angular space).
  • end_point (bool) - A flag which if False will cause the end point to be removed.
Returns: list of float
The row of the grid.

minimise_setup_atomic_pos(sim_index=None, verbosity=1)

source code 

Set up the atomic position data structures for optimisation using PCSs and PREs as base data sets.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
  • verbosity (int) - If set to 1 or higher, then printouts and warnings will be active.
Returns: numpy rank-3 array, numpy rank-1 array.
The atomic positions (the first index is the spins, the second is the structures, and the third is the atomic coordinates) and the paramagnetic centre.

minimise_setup_pcs(sim_index=None)

source code 

Set up the data structures for optimisation using PCSs as base data sets.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
Returns: tuple of (numpy rank-2 array, numpy rank-2 array, numpy rank-2 array, numpy rank-1 array, numpy rank-1 array)
The assembled data structures for using PCSs as the base data for optimisation. These include:
  • the PCS values.
  • the unit vectors connecting the paramagnetic centre (the electron spin) to
  • the PCS weight.
  • the nuclear spin.
  • the pseudocontact shift constants.

minimise_setup_rdcs(sim_index=None)

source code 

Set up the data structures for optimisation using RDCs as base data sets.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
Returns: tuple of (numpy rank-2 array, numpy rank-2 array, numpy rank-2 array, numpy rank-3 array, numpy rank-2 array, numpy rank-2 array)
The assembled data structures for using RDCs as the base data for optimisation. These include:
  • rdc, the RDC values.
  • rdc_err, the RDC errors.
  • rdc_weight, the RDC weights.
  • vectors, the interatomic vectors.
  • rdc_const, the dipolar constants.
  • absolute, the absolute value flags (as 1's and 0's).

minimise_setup_tensors(sim_index=None)

source code 

Set up the data structures for optimisation using alignment tensors as base data sets.

Parameters:
  • sim_index (None or int) - The simulation index. This should be None if normal optimisation is desired.
Returns: tuple of 3 numpy nx5D, rank-1 arrays
The assembled data structures for using alignment tensors as the base data for optimisation. These include:
  • full_tensors, the full tensors as concatenated arrays.
  • full_err, the full tensor errors as concatenated arrays.
  • full_in_ref_frame, the flags specifying if the tensor is the full or reduced tensor in the non-moving reference domain.

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_pcs(align_id)

source code 

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

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

opt_uses_rdc(align_id)

source code 

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

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

store_bc_data(A_5D_bc=None, pcs_theta=None, rdc_theta=None)

source code 

Store the back-calculated data.

Parameters:
  • A_5D_bc (numpy float64 array) - The reduced back-calculated alignment tensors from the target function.
  • pcs_theta (numpy float64 array) - The back calculated PCS values from the target function.
  • rdc_theta (numpy float64 array) - The back calculated RDC values from the target function.

target_fn_data_setup(sim_index=None, verbosity=1, scaling_matrix=None, unset_fail=False)

source code 

Initialise the target function for optimisation or direct calculation.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.
  • scaling_matrix (numpy rank-2, float64 array or None) - The diagonal and square scaling matrices.
  • unset_fail (bool) - A flag which if True will cause a RelaxError to be raised if the parameter is not set yet.

unpack_opt_results(param_vector=None, func=None, iter_count=None, f_count=None, g_count=None, h_count=None, warning=None, scaling_matrix=None, sim_index=None)

source code 

Unpack and store the Frame Order optimisation results.

Parameters:
  • param_vector (numpy array) - The model-free parameter vector.
  • func (float) - The optimised chi-squared value.
  • iter_count (int) - The number of optimisation steps required to find the minimum.
  • f_count (int) - The function count.
  • g_count (int) - The gradient count.
  • h_count (int) - The Hessian count.
  • warning (str or None) - Any optimisation warnings.
  • scaling_matrix (numpy rank-2, float64 array or None) - The diagonal and square scaling matrices.
  • sim_index (None or int) - The index of the simulation to optimise. This should be None for normal optimisation.