Package specific_analyses :: Module api_common :: Class API_common
[hide private]
[frames] | no frames]

Class API_common

source code


Base class containing API methods common to multiple analysis types.

Instance Methods [hide private]
str
_base_data_loop_spin(self)
Generator method for looping over the base data of the specific analysis type (spin system specific).
source code
 
_create_mc_relax_data(self, data_id)
Return the Monte Carlo relaxation data list for the corresponding spin.
source code
 
_data_init_dummy(self, data, sim=False)
Dummy method for initialising data structures.
source code
 
_data_init_spin(self, data, sim=False)
Initialise data structures (spin system specific).
source code
 
_deselect_global(self, sim_index=None, model_info=None)
Common method for deselecting a global model.
source code
bool
_eliminate_false(self, name, value, args, sim=None, model_info=None)
Dummy method for model elimination.
source code
class instance
_get_model_container_cdp(self, model_info=None)
Return the current data pipe as the model container.
source code
bool
_has_errors_spin(self)
Testing if errors exist for the current data pipe (spin system specific).
source code
bool
_is_spin_param_false(self, name)
Common method stating that the parameter is not spin specific.
source code
bool
_is_spin_param_true(self, name)
Common method stating that the parameter is spin specific.
source code
int
_model_loop_single_global(self)
Default generator method for looping over a single global (non-spin specific) model.
source code
SpinContainer instance, str
_model_loop_spin(self)
Default generator method for looping over the models, where each spin has a separate model.
source code
str
_model_type_global(self)
Return the type of the model as being 'global'.
source code
str
_model_type_local(self)
Return the type of the model as being 'local'.
source code
int
_num_instances_spin(self)
Return the number of instances, equal to the number of selected spins.
source code
 
_overfit_deselect_dummy(self, data_check=True, verbose=True)
Dummy method, normally for deselecting spins with insufficient data for minimisation.
source code
 
_print_model_title_global(self, prefix=None, model_info=None)
Default method for when the model_loop() method simply loops over a single global model.
source code
 
_print_model_title_spin(self, prefix=None, model_info=None)
Default method for when the model_loop() method simply loops over spins.
source code
list of float
_return_data_relax_data(self, spin)
Return the Ri data structure for the given spin.
source code
list of float
_return_error_relax_data(self, data_id)
Return the Ri error structure for the corresponding spin.
source code
float
_return_no_conversion_factor(self, param)
Method for returning 1.0.
source code
tuple of length 2 of floats or None
_return_value_general(self, spin, param, sim=None, bc=False)
Return the value and error corresponding to the parameter 'param'.
source code
 
_set_error_spin(self, index, error, model_info=None)
Set the parameter errors (spin system specific).
source code
 
_set_param_values_global(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)
Set the global parameter values in the top layer of the data pipe.
source code
 
_set_param_values_spin(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)
Set the spin specific parameter values.
source code
 
_set_selected_sim_global(self, select_sim, model_info=None)
Set the simulation selection flag (for a single global model).
source code
 
_set_selected_sim_spin(self, select_sim, model_info=None)
Set the simulation selection flag (spin system specific).
source code
 
_set_update(self, param, spin)
Dummy method to do nothing!
source code
 
_sim_init_values_spin(self)
Initialise the Monte Carlo parameter values (spin system specific).
source code
 
_sim_pack_relax_data(self, data_id, sim_data)
Pack the Monte Carlo simulation relaxation data into the corresponding spin container.
source code
list of float or float
_sim_return_chi2_spin(self, index=None, model_info=None)
Return the simulation chi-squared values (spin system specific).
source code
list of float
_sim_return_param_spin(self, index, model_info=None)
Return the array of simulation parameter values (spin system specific).
source code
list of int
_sim_return_selected_global(self, model_info=None)
Return the array of selected simulation flags for the global model.
source code
list of int
_sim_return_selected_spin(self, model_info=None)
Return the array of selected simulation flags (spin system specific).
source code
Method Details [hide private]

_base_data_loop_spin(self)

source code 

Generator method for looping over the base data of the specific analysis type (spin system specific).

This method simply loops over the spins, returning the spin identification string.

Returns: str
The spin identification string

_create_mc_relax_data(self, data_id)

source code 

Return the Monte Carlo relaxation data list for the corresponding spin.

Parameters:
  • data_id (str) - The spin identification string, as yielded by the base_data_loop() generator method.

_data_init_dummy(self, data, sim=False)

source code 

Dummy method for initialising data structures.

This method does nothing!

Parameters:
  • data (instance) - The data from the base_data_loop() method.
  • sim (bool) - The unused Monte Carlo simulation flag.

_data_init_spin(self, data, sim=False)

source code 

Initialise data structures (spin system specific).

Parameters:
  • data (str) - The spin ID string from the _base_data_loop_spin() method.
  • sim (bool) - The Monte Carlo simulation flag, which if true will initialise the simulation data structure.

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

source code 

Common method for deselecting a global model.

Parameters:
  • sim_index (None or int) - The optional Monte Carlo simulation index. If None, then models will be deselected, otherwise the given simulation will.
  • model_info (int) - The model information from _model_loop_single_global(). This should be zero for the single global model.

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

source code 

Dummy method for model elimination.

This simply returns False to signal that no model elimination is to be performed.

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 (unknown) - The model information from model_loop().
Returns: bool
False to prevent model elimination.

_get_model_container_cdp(self, model_info=None)

source code 

Return the current data pipe as the model container.

Parameters:
  • model_info (unknown) - The model information from model_loop().
Returns: class instance
The data container corresponding to the model.

_has_errors_spin(self)

source code 

Testing if errors exist for the current data pipe (spin system specific).

Returns: bool
The answer to the question of whether errors exist.

_is_spin_param_false(self, name)

source code 

Common method stating that the parameter is not spin specific.

This method always returns False, hence all parameters will be considered global.

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

_is_spin_param_true(self, name)

source code 

Common method stating that the parameter is spin specific.

This method always returns true, hence all parameters will be considered residents of a SpinContainer object.

Parameters:
  • name (str) - The name of the parameter.
Returns: bool
True

_model_loop_single_global(self)

source code 

Default generator method for looping over a single global (non-spin specific) model.

The loop will yield a single index, zero, once to indicate a single model.

Returns: int
The global model index of zero.

_model_loop_spin(self)

source code 

Default generator method for looping over the models, where each spin has a separate model.

In this case only a single model per spin system is assumed. The yielded data is the spin container object. The spin ID string is also yielded to allow the corresponding spin container to be identified.

Returns: SpinContainer instance, str
The spin container and the spin ID string.

_model_type_global(self)

source code 

Return the type of the model as being 'global'.

Returns: str
The model type of 'global'.

_model_type_local(self)

source code 

Return the type of the model as being 'local'.

Returns: str
The model type of 'local'.

_num_instances_spin(self)

source code 

Return the number of instances, equal to the number of selected spins.

Returns: int
The number of instances (equal to the number of spins).

_print_model_title_global(self, prefix=None, model_info=None)

source code 

Default method for when the model_loop() method simply loops over a single global model.

Parameters:
  • prefix (str) - The starting text of the title. This should be printed out first, followed by the model information text.
  • model_info (int) - The model information from _model_loop_single_global(). This should be zero for the single global model.

_print_model_title_spin(self, prefix=None, model_info=None)

source code 

Default method for when the model_loop() method simply loops over spins.

Parameters:
  • prefix (str) - The starting text of the title. This should be printed out first, followed by the model information text.
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.

_return_data_relax_data(self, spin)

source code 

Return the Ri data structure for the given spin.

Parameters:
  • spin (SpinContainer instance) - The SpinContainer object.
Returns: list of float
The array of relaxation data values.

_return_error_relax_data(self, data_id)

source code 

Return the Ri error structure for the corresponding spin.

Parameters:
  • data_id (str) - The data identification information, as yielded by the base_data_loop() generator method.
Returns: list of float
The array of relaxation data error values.

_return_no_conversion_factor(self, param)

source code 

Method for returning 1.0.

Parameters:
  • param (str) - The parameter name.
Returns: float
A conversion factor of 1.0.

_return_value_general(self, spin, param, sim=None, bc=False)

source code 

Return the value and error corresponding to the parameter 'param'.

If sim is set to an integer, return the value of the simulation and None. The values are taken from the given SpinContainer object.

Parameters:
  • spin (SpinContainer) - The SpinContainer object.
  • param (str) - The name of the parameter to return values for.
  • sim (None or int) - The Monte Carlo simulation index.
  • bc (bool) - The back-calculated data flag. If True, then the back-calculated data will be returned rather than the actual data.
Returns: tuple of length 2 of floats or None
The value and error corresponding to

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

source code 

Set the parameter errors (spin system specific).

Parameters:
  • index (int) - The index of the parameter to set the errors for.
  • error (float) - The error value.
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.

_set_param_values_global(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)

source code 

Set the global parameter values in the top layer of the data pipe.

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. This is unused.
  • 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.

_set_param_values_spin(self, param=None, value=None, index=None, spin_id=None, error=False, force=True)

source code 

Set the spin specific 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. This is unused.
  • spin_id (None or str) - The spin identification string, only used for spin specific parameters.
  • 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.

_set_selected_sim_global(self, select_sim, model_info=None)

source code 

Set the simulation selection flag (for a single global model).

Parameters:
  • select_sim (bool) - The selection flag for the simulations.
  • model_info (int) - The model information from _model_loop_single_global(). This should be zero for the single global model.

_set_selected_sim_spin(self, select_sim, model_info=None)

source code 

Set the simulation selection flag (spin system specific).

Parameters:
  • select_sim (bool) - The selection flag for the simulations.
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.

_set_update(self, param, spin)

source code 

Dummy method to do nothing!

Parameters:
  • param (str) - The name of the parameter which has been changed.
  • spin (SpinContainer) - The SpinContainer object.

_sim_pack_relax_data(self, data_id, sim_data)

source code 

Pack the Monte Carlo simulation relaxation data into the corresponding spin container.

Parameters:
  • data_id (str) - The spin identification string, as yielded by the base_data_loop() generator method.
  • sim_data (list of float) - The Monte Carlo simulation data.

_sim_return_chi2_spin(self, index=None, model_info=None)

source code 

Return the simulation chi-squared values (spin system specific).

Parameters:
  • index (int) - The optional simulation index.
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.
Returns: list of float or float
The list of simulation chi-squared values. If the index is supplied, only a single value will be returned.

_sim_return_param_spin(self, index, model_info=None)

source code 

Return the array of simulation parameter values (spin system specific).

Parameters:
  • index (int) - The index of the parameter to return the array of values for.
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.
Returns: list of float
The array of simulation parameter values.

_sim_return_selected_global(self, model_info=None)

source code 

Return the array of selected simulation flags for the global model.

Parameters:
  • model_info (int) - The model information from _model_loop_single_global(). This should be zero for the single global model.
Returns: list of int
The array of selected simulation flags.

_sim_return_selected_spin(self, model_info=None)

source code 

Return the array of selected simulation flags (spin system specific).

Parameters:
  • model_info (SpinContainer instance, str) - The spin container and the spin ID string from the _model_loop_spin() method.
Returns: list of int
The array of selected simulation flags.