Package specific_analyses :: Package n_state_model :: Module parameters
[hide private]
[frames] | no frames]

Module parameters

source code

The N-state model or structural ensemble analysis parameter handling.

Functions [hide private]
numpy array
assemble_param_vector(sim_index=None)
Assemble all the parameters of the model into a single array.
source code
 
disassemble_param_vector(param_vector=None, data_types=None, sim_index=None)
Disassemble the parameter vector and place the values into the relevant variables.
source code
 
elim_no_prob()
Remove all structures or states which have no probability.
source code
tuple of len 2 of a numpy rank-2, size NxM matrix and numpy rank-1, size N array
linear_constraints(data_types=None, scaling_matrix=None)
Function for setting up the linear constraint matrices A and b.
source code
 
number_of_states(N=None)
Set the number of states in the N-state model.
source code
str
param_model_index(param)
Return the N-state model index for the given parameter.
source code
int
param_num()
Determine the number of parameters in the model.
source code
 
ref_domain(ref=None)
Set the reference domain for the '2-domain' N-state model.
source code
 
select_model(model=None)
Select the N-state model type.
source code
 
update_model()
Update the model parameters as necessary.
source code
Variables [hide private]
  __package__ = 'specific_analyses.n_state_model'

Imports: array, float64, zeros, search, warn, RelaxNoModelError, RelaxWarning, align_tensor, check_pipe, opt_uses_align_data, opt_uses_tensor, base_data_types


Function Details [hide private]

assemble_param_vector(sim_index=None)

source code 

Assemble all the parameters of the model into a single array.

Parameters:
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.
Returns: numpy array
The parameter vector used for optimisation.

disassemble_param_vector(param_vector=None, data_types=None, sim_index=None)

source code 

Disassemble the parameter vector and place the values into the relevant variables.

For the 2-domain N-state model, the parameters are stored in the probability and Euler angle data structures. For the population N-state model, only the probabilities are stored. If RDCs are present and alignment tensors are optimised, then these are stored as well.

Parameters:
  • data_types (list of str) - The base data types used in the optimisation. This list can contain the elements 'rdc', 'pcs' or 'tensor'.
  • param_vector (numpy array) - The parameter vector returned from optimisation.
  • sim_index (None or int) - The index of the simulation to optimise. This should be None if normal optimisation is desired.

linear_constraints(data_types=None, scaling_matrix=None)

source code 

Function for setting up the linear constraint matrices A and b.

Standard notation

The N-state model constraints are:

   0 <= pc <= 1,

where p is the probability and c corresponds to state c.

Matrix notation

In the notation A.x >= b, where A is an matrix of coefficients, x is an array of parameter values, and b is a vector of scalars, these inequality constraints are:

   | 1  0  0 |                   |    0    |
   |         |                   |         |
   |-1  0  0 |                   |   -1    |
   |         |                   |         |
   | 0  1  0 |                   |    0    |
   |         |     |  p0  |      |         |
   | 0 -1  0 |     |      |      |   -1    |
   |         |  .  |  p1  |  >=  |         |
   | 0  0  1 |     |      |      |    0    |
   |         |     |  p2  |      |         |
   | 0  0 -1 |                   |   -1    |
   |         |                   |         |
   |-1 -1 -1 |                   |   -1    |
   |         |                   |         |
   | 1  1  1 |                   |    0    |

This example is for a 4-state model, the last probability pn is not included as this parameter does not exist (because the sum of pc is equal to 1). The Euler angle parameters have been excluded here but will be included in the returned A and b objects. These parameters simply add columns of zero to the A matrix and have no effect on b. The last two rows correspond to the inequality:

   0 <= pN <= 1.

As:

           N-1
                   pN = 1 - >  pc,
           /__
           c=1

then:

   -p1 - p2 - ... - p(N-1) >= -1,

    p1 + p2 + ... + p(N-1) >= 0.
Parameters:
  • data_types (list of str) - The base data types used in the optimisation. This list can contain the elements 'rdc', 'pcs' or 'tensor'.
  • scaling_matrix (numpy rank-2 square matrix) - The diagonal scaling matrix.
Returns: tuple of len 2 of a numpy rank-2, size NxM matrix and numpy rank-1, size N array
The matrices A and b.

number_of_states(N=None)

source code 

Set the number of states in the N-state model.

Parameters:
  • N (int) - The number of states.

param_model_index(param)

source code 

Return the N-state model index for the given parameter.

Parameters:
  • param (str) - The N-state model parameter.
Returns: str
The N-state model index.

param_num()

source code 

Determine the number of parameters in the model.

Returns: int
The number of model parameters.

ref_domain(ref=None)

source code 

Set the reference domain for the '2-domain' N-state model.

Parameters:
  • ref (str) - The reference domain.

select_model(model=None)

source code 

Select the N-state model type.

Parameters:
  • model (str) - The N-state model type. Can be one of '2-domain', 'population', or 'fixed'.