itcsimlib.itc_grid module

Provides discrete sample parameter values selection during data fitting.

class itcsimlib.itc_grid.ITCGrid(fit, start=0, end=None, callback=None, verbose=False)[source]

Bases: object

A class for either discretely spacing parameters either for different starting conditions or holding them fixed during optimization.

fit

The fitter used for optimization.

Type:ITCFit
sim

The simulator (and associated model) used for fitting.

Type:ITCSim
callback

A function to be called with the current parameter vector after optimization at each grid point.

Type:function
verbose

Whether or not to print additional information to the console.

Type:boolean
add_axis(param, start, stop, steps, logspace=False)[source]

Add a parameter discretization axis to the the grid

Parameters:
  • param (string) – The name of the model parameter.
  • start (float) – The starting value of the model parameter.
  • stop (float) – The ending value of the model parameter.
  • steps (integer) – The number of steps to insert between the start and stop.
  • logspace (boolean) – Space the steps logarithmically?
Returns:

Return type:

None

define_axis(param, points)[source]

Add a parameter discretization axis to the the grid using a set of points.

Parameters:
  • param (string) – The name of the model parameter.
  • points (list of floats) – The points at which to sample the parameter
Returns:

Return type:

None

get_axis_names()[source]

Returns the names of the parameters the grid is being evaluated over

Parameters:None
Returns:The parameter names that constitute the axes of the grid
Return type:list of strings
optimize(params=[], **kwargs)[source]

Optimize the model at each point on the grid defined by the parameter axes

Parameters:
  • params (list of strings) – The names of the parameters to optimize.
  • **kwargs – Keyword arguments to pass to the ITCFit optimizer at each grid point
Returns:

A list of tuples, where each tuple consists of the grid point and the resulting optimized model parameters

Return type:

(list of tuples)