Package specific_analyses :: Package n_state_model :: Module api :: Class N_state_model
[hide private]
[frames] | no frames]

Class N_state_model

source code


Class containing functions for the N-state model.

Instance Methods [hide private]
 
__init__(self)
Initialise the class by placing API_common methods into the API.
source code
list of [SpinContainer instance, str, str] or [InteratomContainer instance, str, str]
base_data_loop(self)
Loop over the base data of the spins - RDCs, PCSs, and NOESY data.
source code
 
calculate(self, spin_id=None, scaling_matrix=None, verbosity=1, sim_index=None)
Calculation function.
source code
list of floats
create_mc_data(self, data_id=None)
Create the Monte Carlo data by back-calculation.
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)
The grid search function.
source code
bool
is_spin_param(self, name)
Determine whether the given parameter is spin specific.
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
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
list of (float or None)
return_data(self, data_id)
Return the base data for the given data ID.
source code
list of float
return_error(self, data_id=None)
Create and return the spin specific Monte Carlo Ri error structure.
source code
 
set_error(self, index, error, model_info=None)
Set the parameter errors.
source code
 
set_param_values(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)
Set the N-state model parameter values.
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

Inherited from api_base.API_base: back_calc_ri, bmrb_read, bmrb_write, constraint_algorithm, covariance_matrix, data_init, data_names, data_type, default_value, deselect, duplicate_data, eliminate, get_model_container, has_errors, model_desc, model_loop, model_type, molmol_macro, num_instances, overfit_deselect, print_model_title, pymol_macro, return_conversion_factor, return_data_desc, return_error_red_chi2, return_grace_string, return_grace_units, return_units, return_value, set_selected_sim, set_update, sim_return_chi2, sim_return_selected, 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 

Loop over the base data of the spins - RDCs, PCSs, and NOESY data.

This loop iterates for each data point (RDC, PCS, NOESY) for each spin or interatomic data container, returning the identification information.

Returns: list of [SpinContainer instance, str, str] or [InteratomContainer instance, str, str]
A list of the spin or interatomic data container, the data type ('rdc', 'pcs', 'noesy'), and the alignment ID if required.
Overrides: api_base.API_base.base_data_loop

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

source code 

Calculation function.

Currently this function simply calculates the NOESY flat-bottom quadratic energy potential, if NOE restraints are available.

Parameters:
  • spin_id (None or str) - 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) - The MC simulation index (unused).
Overrides: api_base.API_base.calculate

create_mc_data(self, data_id=None)

source code 

Create the Monte Carlo data by back-calculation.

Parameters:
  • data_id (str) - The list of spin ID, data type, and alignment ID, as yielded by the base_data_loop() generator method.
Returns: list of floats
The Monte Carlo Ri data.
Overrides: api_base.API_base.create_mc_data

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 optional 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 

The grid search function.

Parameters:
  • lower (list of lists of floats) - The lower bounds of the grid search which must be equal to the number of parameters in the model.
  • upper (list of lists of floats) - The 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 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 (elinating 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.
Overrides: api_base.API_base.grid_search

is_spin_param(self, name)

source code 

Determine whether the given parameter is spin specific.

Parameters:
  • name (str) - The name of the parameter.
Returns: bool
False
Overrides: api_base.API_base.is_spin_param

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_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 or str) - The spin identification string. This is ignored in the N-state model.
  • global_stats (None or bool) - A parameter which determines if global or local statistics are returned. For the N-state model, this argument is ignored.
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

return_data(self, data_id)

source code 

Return the base data for the given data ID.

Parameters:
  • data_id (list of str) - The list of spin ID, data type, and alignment ID, as yielded by the base_data_loop() generator method.
Returns: list of (float or None)
The base data.
Overrides: api_base.API_base.return_data

return_error(self, data_id=None)

source code 

Create and return the spin specific Monte Carlo Ri error structure.

Parameters:
  • data_id (str) - The list of spin ID, data type, and alignment ID, as yielded by the base_data_loop() generator method.
Returns: list of float
The Monte Carlo simulation data errors.
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_param_values(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)

source code 

Set the N-state model parameter values.

Parameters:
  • param (list of str) - The parameter name list.
  • value (list) - The parameter value list.
  • index (None or int) - The index for parameters which are of the list-type (probs, alpha, beta, and gamma). This is ignored for all other types.
  • spin_id (None) - The spin identification string (unused).
  • error (bool) - A flag which if True will allow the parameter errors to be set instead of the values.
  • force (bool) - A flag which if True will cause current values to be overwritten. If False, a RelaxError will raised if the parameter value is already set.
Overrides: api_base.API_base.set_param_values

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 list of spin ID, data type, and alignment ID, 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