Package generic_fns :: Module minimise
[hide private]
[frames] | no frames]

Module minimise

source code

Module for model minimisation/optimisation.

Functions [hide private]
 
calc(verbosity=1)
Function for calculating the function value.
source code
 
grid_search(lower=None, upper=None, inc=None, constraints=True, verbosity=1)
The grid search function.
source code
 
minimise(min_algor=None, min_options=None, func_tol=None, grad_tol=None, max_iterations=None, constraints=True, scaling=True, verbosity=1, sim_index=None)
Minimisation function.
source code
 
reset_min_stats(data_pipe=None, spin=None)
Function for resetting the minimisation statistics.
source code
float
return_conversion_factor(stat_type)
Dummy function for returning 1.0.
source code
str
return_data_name(name)
Return a unique identifying string for the minimisation parameter.
source code
str
return_grace_string(stat_type)
Function for returning the Grace string representing the data type for axis labelling.
source code
None
return_units(stat_type)
Dummy function which returns None as the stats have no units.
source code
 
return_value(spin=None, stat_type=None, sim=None)
Function for returning the minimisation statistic corresponding to 'stat_type'.
source code
 
set(val=None, error=None, param=None, scaling=None, spin_id=None)
Set global or spin specific minimisation parameters.
source code
Variables [hide private]
  status = Status()
  return_data_name_doc = ['Minimisation statistic data type stri...
  set_doc = '\n Minimisation statistic set details\n ...
  __package__ = 'generic_fns'

Imports: search, return_spin, spin_loop, pipes, RelaxError, specific_fns, Status


Function Details [hide private]

calc(verbosity=1)

source code 

Function for calculating the function value.

Parameters:
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.

grid_search(lower=None, upper=None, inc=None, constraints=True, verbosity=1)

source code 

The grid search function.

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.
  • constraints (bool) - If True, constraints are applied during the grid search (elinating parts of the grid). If False, no constraints are used.
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.

minimise(min_algor=None, min_options=None, func_tol=None, grad_tol=None, max_iterations=None, constraints=True, scaling=True, verbosity=1, sim_index=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 (bool) - If True, diagonal scaling is enabled during optimisation to allow the problem to be better conditioned.
  • verbosity (int) - 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.

reset_min_stats(data_pipe=None, spin=None)

source code 

Function for resetting the minimisation statistics.

Parameters:
  • data_pipe (str) - The name of the data pipe to reset the minimisation statisics of. This defaults to the current data pipe.
  • spin (SpinContainer) - The spin data container if spin specific data is to be reset.

return_conversion_factor(stat_type)

source code 

Dummy function for returning 1.0.

Parameters:
  • stat_type (str) - The name of the statistic. This is unused!
Returns: float
A conversion factor of 1.0.

return_data_name(name)

source code 

Return a unique identifying string for the minimisation parameter.

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

return_grace_string(stat_type)

source code 

Function for returning the Grace string representing the data type for axis labelling.

Parameters:
  • stat_type (str) - The name of the statistic to return the Grace string for.
Returns: str
The Grace string.

return_units(stat_type)

source code 

Dummy function which returns None as the stats have no units.

Parameters:
  • stat_type (str) - The name of the statistic. This is unused!
Returns: None
Nothing.

return_value(spin=None, stat_type=None, sim=None)

source code 

Function for returning the minimisation statistic corresponding to 'stat_type'.

Parameters:
  • spin (SpinContainer) - The spin data container if spin specific data is to be reset.
  • stat_type (str) - The name of the statistic to return the value for.
  • sim (None or int) - The index of the simulation to return the value for. If None, then the normal value is returned.

set(val=None, error=None, param=None, scaling=None, spin_id=None)

source code 

Set global or spin specific minimisation parameters.

Parameters:
  • val (number) - The parameter values.
  • param (str) - The parameter names.
  • scaling (float) - Unused.
  • spin_id (str) - The spin identification string.

Variables Details [hide private]

return_data_name_doc

Value:
['Minimisation statistic data type string matching patterns',
 '''
        ______________________________________________________________\
______________________________
        |                        |              |                     \
                             |
        | Data type              | Object name  | Patterns            \
                             |
...

set_doc

Value:
'''
        Minimisation statistic set details
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        This shouldn\'t really be executed by a user.
'''