Package specific_analyses :: Package frame_order :: Module api :: Class Frame_order
[hide private]
[frames] | no frames]

Class Frame_order

source code


Class containing the specific methods of the Frame Order theories.

Instance Methods [hide private]
 
__init__(self)
Initialise the class by placing API_common methods into the API.
source code
list of str
base_data_loop(self)
Generator method for looping over the base data - RDCs and PCSs.
source code
 
calculate(self, spin_id=None, scaling_matrix=None, verbosity=1, sim_index=None)
Calculate the chi-squared value for the current parameter values.
source code
str
constraint_algorithm(self)
Return the 'Log barrier' optimisation constraint algorithm.
source code
list of floats
create_mc_data(self, data_id=None)
Create the Monte Carlo data by back calculating the RDCs or PCSs.
source code
 
duplicate_data(self, pipe_from=None, pipe_to=None, model_info=None, global_stats=False, verbose=True)
Duplicate the data specific to a single frame order data pipe.
source code
bool
eliminate(self, name, value, args, sim=None, model_info=None)
Model elimination method.
source code
list of str
get_param_names(self, model_info=None)
Return a vector of parameter names.
source code
list of str
get_param_values(self, model_info=None, sim_index=None)
Return a vector of parameter values.
source code
 
grid_search(self, lower=None, upper=None, inc=None, scaling_matrix=None, constraints=False, verbosity=0, sim_index=None)
Perform a grid search.
source code
list of float
map_bounds(self, param, spin_id=None)
Create bounds for the OpenDX mapping function.
source code
 
minimise(self, min_algor=None, min_options=None, func_tol=None, grad_tol=None, max_iterations=None, constraints=False, scaling_matrix=None, verbosity=0, sim_index=None, lower=None, upper=None, inc=None)
Minimisation function.
source code
str
model_desc(self, model_info=None)
Return a description of the model.
source code
tuple of (int, int, float)
model_statistics(self, model_info=None, spin_id=None, global_stats=None)
Return the k, n, and chi2 model statistics.
source code
 
overfit_deselect(self, data_check=True, verbose=True)
Deselect spins which have insufficient data to support minimisation.
source code
list of float
return_error(self, data_id)
Return the RDC or PCS error structure.
source code
 
set_error(self, index, error, model_info=None)
Set the parameter errors.
source code
 
set_selected_sim(self, select_sim, model_info=None)
Set the simulation selection flag for the spin.
source code
 
sim_init_values(self)
Initialise the Monte Carlo parameter values.
source code
 
sim_pack_data(self, data_id, sim_data)
Pack the Monte Carlo simulation data.
source code
list of float
sim_return_param(self, index, model_info=None)
Return the array of simulation parameter values.
source code
list of int
sim_return_selected(self, model_info=None)
Return the array of selected simulation flags for the spin.
source code

Inherited from api_base.API_base: back_calc_ri, bmrb_read, bmrb_write, covariance_matrix, data_init, data_names, data_type, default_value, deselect, get_model_container, has_errors, is_spin_param, model_loop, model_type, molmol_macro, num_instances, print_model_title, pymol_macro, return_conversion_factor, return_data, return_data_desc, return_error_red_chi2, return_grace_string, return_grace_units, return_units, return_value, set_param_values, set_update, sim_return_chi2, skip_function

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]

Inherited from api_base.API_base: __new__

Class Variables [hide private]
  instance = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialise the class by placing API_common methods into the API.

Overrides: object.__init__

base_data_loop(self)

source code 

Generator method for looping over the base data - RDCs and PCSs.

This loop yields the following:

  • The RDC identification data for the interatomic data container and alignment.
  • The PCS identification data for the spin data container and alignment.
Returns: list of str
The base data type ('rdc' or 'pcs'), the spin or interatomic data container information (either one or two spin hashes), and the alignment ID string.
Overrides: api_base.API_base.base_data_loop

calculate(self, spin_id=None, scaling_matrix=None, verbosity=1, sim_index=None)

source code 

Calculate the chi-squared value for the current parameter values.

Parameters:
  • spin_id (None) - The spin identification string (unused).
  • scaling_matrix (list of numpy rank-2, float64 array or list of None) - The per-model list of diagonal and square scaling matrices.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.
  • sim_index (None or int) - The optional MC simulation index (unused).
Overrides: api_base.API_base.calculate

constraint_algorithm(self)

source code 

Return the 'Log barrier' optimisation constraint algorithm.

Returns: str
The 'Log barrier' constraint algorithm.
Overrides: api_base.API_base.constraint_algorithm

create_mc_data(self, data_id=None)

source code 

Create the Monte Carlo data by back calculating the RDCs or PCSs.

Parameters:
  • data_id (list of str) - The data set as yielded by the base_data_loop() generator method.
Returns: list of floats
The Monte Carlo simulation data.
Overrides: api_base.API_base.create_mc_data

duplicate_data(self, pipe_from=None, pipe_to=None, model_info=None, global_stats=False, verbose=True)

source code 

Duplicate the data specific to a single frame order data pipe.

Parameters:
  • pipe_from (str) - The data pipe to copy the data from.
  • pipe_to (str) - The data pipe to copy the data to.
  • model_info (None) - The model information from model_loop(). This is unused.
  • global_stats (bool) - The global statistics flag.
  • verbose (bool) - Unused.
Overrides: api_base.API_base.duplicate_data

eliminate(self, name, value, args, sim=None, model_info=None)

source code 

Model elimination method.

Parameters:
  • name (str) - The parameter name.
  • value (float) - The parameter value.
  • args (None or tuple of float) - The elimination constant overrides.
  • sim (int) - The Monte Carlo simulation index.
  • model_info (None) - The model information from model_loop(). This is unused.
Returns: bool
True if the model is to be eliminated, False otherwise.
Overrides: api_base.API_base.eliminate

get_param_names(self, model_info=None)

source code 

Return a vector of parameter names.

Parameters:
  • model_info (None) - The model information from model_loop(). This is unused.
Returns: list of str
The vector of parameter names.
Overrides: api_base.API_base.get_param_names

get_param_values(self, model_info=None, sim_index=None)

source code 

Return a vector of parameter values.

Parameters:
  • model_info (None) - The model information from model_loop(). This is unused.
  • sim_index (int) - The Monte Carlo simulation index.
Returns: list of str
The vector of parameter values.
Overrides: api_base.API_base.get_param_values

grid_search(self, lower=None, upper=None, inc=None, scaling_matrix=None, constraints=False, verbosity=0, sim_index=None)

source code 

Perform a grid search.

Parameters:
  • lower (list of lists of numbers) - The per-model lower bounds of the grid search which must be equal to the number of parameters in the model.
  • upper (list of lists of numbers) - The per-model upper bounds of the grid search which must be equal to the number of parameters in the model.
  • inc (list of lists of int) - The per-model increments for each dimension of the space for the grid search. The number of elements in the array must equal to the number of parameters in the model.
  • scaling_matrix (list of numpy rank-2, float64 array or list of None) - The per-model list of diagonal and square scaling matrices.
  • constraints (bool) - If True, constraints are applied during the grid search (eliminating parts of the grid). If False, no constraints are used.
  • verbosity (int) - A flag specifying the amount of information to print. The higher the value, the greater the verbosity.
  • sim_index (None or int) - The Monte Carlo simulation index.
Overrides: api_base.API_base.grid_search

map_bounds(self, param, spin_id=None)

source code 

Create bounds for the OpenDX mapping function.

Parameters:
  • param (str) - The name of the parameter to return the lower and upper bounds of.
  • spin_id (None) - The spin identification string (unused).
Returns: list of float
The upper and lower bounds of the parameter.
Overrides: api_base.API_base.map_bounds

minimise(self, min_algor=None, min_options=None, func_tol=None, grad_tol=None, max_iterations=None, constraints=False, scaling_matrix=None, verbosity=0, sim_index=None, lower=None, upper=None, inc=None)

source code 

Minimisation function.

Parameters:
  • min_algor (str) - The minimisation algorithm to use.
  • min_options (array of str) - An array of options to be used by the minimisation algorithm.
  • func_tol (None or float) - The function tolerance which, when reached, terminates optimisation. Setting this to None turns of the check.
  • grad_tol (None or float) - The gradient tolerance which, when reached, terminates optimisation. Setting this to None turns of the check.
  • max_iterations (int) - The maximum number of iterations for the algorithm.
  • constraints (bool) - If True, constraints are used during optimisation.
  • scaling_matrix (list of numpy rank-2, float64 array or list of None) - The per-model list of diagonal and square scaling matrices.
  • verbosity (int) - A flag specifying the amount of information to print. The higher the value, the greater the verbosity.
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
  • lower (list of lists of numbers) - The per-model lower bounds of the grid search which must be equal to the number of parameters in the model. This optional argument is only used when doing a grid search.
  • upper (list of lists of numbers) - The per-model upper bounds of the grid search which must be equal to the number of parameters in the model. This optional argument is only used when doing a grid search.
  • inc (list of lists of int) - The per-model increments for each dimension of the space for the grid search. The number of elements in the array must equal to the number of parameters in the model. This argument is only used when doing a grid search.
Overrides: api_base.API_base.minimise

model_desc(self, model_info=None)

source code 

Return a description of the model.

Parameters:
  • model_info (None) - The model information from model_loop(). This is unused.
Returns: str
The model description.
Overrides: api_base.API_base.model_desc

model_statistics(self, model_info=None, spin_id=None, global_stats=None)

source code 

Return the k, n, and chi2 model statistics.

k - number of parameters. n - number of data points. chi2 - the chi-squared value.

Parameters:
  • model_info (None) - The model information from model_loop(). This is unused.
  • spin_id (None) - Unused.
  • global_stats (None) - Unused.
Returns: tuple of (int, int, float)
The optimisation statistics, in tuple format, of the number of parameters (k), the number of data points (n), and the chi-squared value (chi2).
Overrides: api_base.API_base.model_statistics

overfit_deselect(self, data_check=True, verbose=True)

source code 

Deselect spins which have insufficient data to support minimisation.

Parameters:
  • data_check (bool) - A flag to signal if the presence of base data is to be checked for.
  • verbose (bool) - A flag which if True will allow printouts.
Overrides: api_base.API_base.overfit_deselect

return_error(self, data_id)

source code 

Return the RDC or PCS error structure.

Parameters:
  • data_id (list of str) - The data set as yielded by the base_data_loop() generator method.
Returns: list of float
The array of RDC or PCS error values.
Overrides: api_base.API_base.return_error

set_error(self, index, error, model_info=None)

source code 

Set the parameter errors.

Parameters:
  • index (int) - The index of the parameter to set the errors for.
  • error (float) - The error value.
  • model_info (None) - The model information from model_loop(). This is unused.
Overrides: api_base.API_base.set_error

set_selected_sim(self, select_sim, model_info=None)

source code 

Set the simulation selection flag for the spin.

Parameters:
  • select_sim (bool) - The selection flag for the simulations.
  • model_info (None) - The model information from model_loop(). This is unused.
Overrides: api_base.API_base.set_selected_sim

sim_init_values(self)

source code 

Initialise the Monte Carlo parameter values.

Overrides: api_base.API_base.sim_init_values

sim_pack_data(self, data_id, sim_data)

source code 

Pack the Monte Carlo simulation data.

Parameters:
  • data_id (list of str) - The data set as yielded by the base_data_loop() generator method.
  • sim_data (list of float) - The Monte Carlo simulation data.
Overrides: api_base.API_base.sim_pack_data

sim_return_param(self, index, model_info=None)

source code 

Return the array of simulation parameter values.

Parameters:
  • index (int) - The index of the parameter to return the array of values for.
  • model_info (None) - The model information from model_loop(). This is unused.
Returns: list of float
The array of simulation parameter values.
Overrides: api_base.API_base.sim_return_param

sim_return_selected(self, model_info=None)

source code 

Return the array of selected simulation flags for the spin.

Parameters:
  • model_info (None) - The model information from model_loop(). This is unused.
Returns: list of int
The array of selected simulation flags.
Overrides: api_base.API_base.sim_return_selected