optimize API reference#

Objectives#

class optimize.objectives.Chi2Loss(flag_worst=0, remove_edges=0, **kwargs)#

Bases: optimize.objectives.ObjectiveFunction

class optimize.objectives.ObjectiveFunction(**kwargs)#

Bases: object

An base class for a general objective function. Not useful to instantiate on its own.

class optimize.objectives.RMSLoss(flag_worst=0, remove_edges=0, **kwargs)#

Bases: optimize.objectives.ObjectiveFunction

static rmsloss(residuals, weights=None, flag_worst=0, remove_edges=0)#

Convenient method to compute the weighted RMS between two vectors x and y.

Parameters
  • residuals (np.ndarray) – The residuals array, where residuals = data - model.

  • weights (np.ndarray, optional) – The weights. Defaults to uniform weights.

  • flag_worst (int, optional) – Flag the largest outliers (with weights applied). Defaults to 0.

  • remove_edges (int, optional) – Ignore this number of edges on each side. Note this is only relevant for 1d data. Defaults to 0.

Returns

The weighted RMS.

Return type

float