Package specific_fns :: 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_cont, sim=False)
Dummy method for initialising data structures.
source code
float
_default_value_spin(self, param)
The default spin parameter values.
source code
bool
_eliminate_false(self, name, value, model_info, args, sim=None)
Dummy method for model elimination.
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_true(self, name)
Dummy 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
_model_loop_spin(self)
Default generator method for looping over the models, where each spin has a separate model.
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)
Dummy method, normally for deselecting spins with insufficient data for minimisation.
source code
None or float
_return_conversion_factor_spin(self, param)
Return the spin specific parameter conversion factor.
source code
str or None
_return_data_desc_spin(self, name)
Return a description of the spin parameter.
source code
str
_return_data_name(self, param)
Return a unique identifying string for the global or spin parameter.
source code
str
_return_data_name_global(self, param)
Return a unique identifying string for the global parameter.
source code
str
_return_data_name_spin(self, param)
Return a unique identifying string for the spin parameter.
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
str
_return_grace_string_spin(self, param)
Return the Grace string representing the given spin parameter.
source code
float
_return_no_conversion_factor(self, param)
Method for returning 1.0.
source code
None or str
_return_units_global(self, param)
Return a string representing the global parameter units.
source code
None or str
_return_units_spin(self, param)
Return a string representing the spin parameter units.
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, model_info, index, error)
Set the parameter errors (spin system specific).
source code
 
_set_param_values_global(self, param=None, value=None, spin_id=None, 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, spin_id=None, force=True)
Set the spin specific parameter values.
source code
 
_set_selected_sim_global(self, model_info, select_sim)
Set the simulation selection flag (for a single global model).
source code
 
_set_selected_sim_spin(self, model_info, select_sim)
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, model_info, index=None)
Return the simulation chi-squared values (spin system specific).
source code
list of float
_sim_return_param_spin(self, model_info, index)
Return the array of simulation parameter values (spin system specific).
source code
list of int
_sim_return_selected_global(self, model_info)
Return the array of selected simulation flags for the global model.
source code
list of int
_sim_return_selected_spin(self, model_info)
Return the array of selected simulation flags (spin system specific).
source code
 
_test_grid_ops_general(self, lower=None, upper=None, inc=None, n=None)
Test that the grid search options are reasonable.
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_cont, sim=False)

source code 

Dummy method for initialising data structures.

This method does nothing!

Parameters:
  • data_cont (instance) - The data container.
  • sim (bool) - The unused Monte Carlo simulation flag.

_default_value_spin(self, param)

source code 

The default spin parameter values.

Parameters:
  • param (str) - The spin parameter.
Returns: float
The default value.

_eliminate_false(self, name, value, model_info, args, sim=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.
  • model_info (int) - The model index from model_info().
  • args (None or tuple of float) - The elimination constant overrides.
  • sim (int) - The Monte Carlo simulation index.
Returns: bool
False to prevent model elimination.

_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_true(self, name)

source code 

Dummy method stating that the parameter is spin specific.

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

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. Hence the yielded data is the spin container object.

Returns: SpinContainer instance
The spin container.

_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).

_return_conversion_factor_spin(self, param)

source code 

Return the spin specific parameter conversion factor.

Parameters:
  • param (str) - The parameter name.
Returns: None or float
The spin specific parameter conversion factor.

_return_data_desc_spin(self, name)

source code 

Return a description of the spin parameter.

Parameters:
  • name (str) - The name of the spin specific object.
Returns: str or None
The object description, or None.

_return_data_name(self, param)

source code 

Return a unique identifying string for the global or spin parameter.

This first returns a global parameter if it exists, followed by a spin parameter, and None if neither exist.

Parameters:
  • param (str) - The parameter name.
Returns: str
The unique parameter identifying string.

_return_data_name_global(self, param)

source code 

Return a unique identifying string for the global parameter.

Parameters:
  • param (str) - The parameter name.
Returns: str
The unique parameter identifying string.

_return_data_name_spin(self, param)

source code 

Return a unique identifying string for the spin parameter.

Parameters:
  • param (str) - The parameter name.
Returns: str
The unique parameter identifying string.

_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_grace_string_spin(self, param)

source code 

Return the Grace string representing the given spin parameter.

Parameters:
  • param (str) - The parameter name.
Returns: str
The unique parameter identifying string.

_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_units_global(self, param)

source code 

Return a string representing the global parameter units.

Parameters:
  • param (str) - The parameter name.
Returns: None or str
The string representation of the units.

_return_units_spin(self, param)

source code 

Return a string representing the spin parameter units.

Parameters:
  • param (str) - The parameter name.
Returns: None or str
The string representation of the units.

_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, model_info, index, error)

source code 

Set the parameter errors (spin system specific).

Parameters:
  • model_info (unknown) - The spin container originating from model_loop().
  • index (int) - The index of the parameter to set the errors for.
  • error (float) - The error value.

_set_param_values_global(self, param=None, value=None, spin_id=None, 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.
  • spin_id (None) - The spin identification string (unused).
  • 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, spin_id=None, 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.
  • spin_id (None or str) - The spin identification string, only used for spin specific parameters.
  • 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, model_info, select_sim)

source code 

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

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

_set_selected_sim_spin(self, model_info, select_sim)

source code 

Set the simulation selection flag (spin system specific).

Parameters:
  • model_info (unknown) - The model information originating from model_loop().
  • select_sim (bool) - The selection flag for the simulations.

_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, model_info, index=None)

source code 

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

Parameters:
  • model_info (unknown) - The model information originating from model_loop().
  • index (int) - The optional simulation index.
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, model_info, index)

source code 

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

Parameters:
  • model_info (unknown) - The model information originating from model_loop().
  • index (int) - The index of the parameter to return the array of values for.
Returns: list of float
The array of simulation parameter values.

_sim_return_selected_global(self, model_info)

source code 

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

Parameters:
  • model_info (int) - The model information originating from model_loop(). 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)

source code 

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

Parameters:
  • model_info (unknown) - The model information originating from model_loop().
Returns: list of int
The array of selected simulation flags.

_test_grid_ops_general(self, lower=None, upper=None, inc=None, n=None)

source code 

Test that the grid search options are reasonable.

Parameters:
  • lower (array of numbers) - The lower bounds of the grid search which must be equal to the number of parameters in the model.
  • upper (array of numbers) - The upper bounds of the grid search which must be equal to the number of parameters in the model.
  • inc (array 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.
  • n (int) - The number of parameters in the model.