ibex_bluesky_core.callbacks.fitting

For IBEX Bluesky scan fitting.

Submodules

fitting_utils

Defines the standard fits.

Members

FitMethod

Tell LiveFit how to fit to a scan.

LiveFit

Live fit, customized for IBEX.

class ibex_bluesky_core.callbacks.fitting.FitMethod(model: Model | Callable[[ndarray[Any, dtype[float64]]], ndarray[Any, dtype[float64]]], guess: Callable[[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], dict[str, Parameter]])[source]

Bases: object

Tell LiveFit how to fit to a scan. Has a Model function and a Guess function.

Model - Takes x values and a set of parameters to return y values. Guess - Takes x and y values and returns a rough ‘guess’ of the original parameters.

Assign model and guess functions.

Parameters:
  • model (lmfit.Model | Callable) – The model function to use.

  • guess (Callable) – The guess function to use.

class ibex_bluesky_core.callbacks.fitting.LiveFit(method: FitMethod, y: str, x: str, *, update_every: int = 1, yerr: str | None = None)[source]

Bases: LiveFit

Live fit, customized for IBEX.

Call Bluesky LiveFit with assumption that there is only one independant variable.

Parameters:
  • method (FitMethod) – The FitMethod (Model & Guess) to use when fitting.

  • y (str) – The name of the dependant variable.

  • x (str) – The name of the independant variable.

  • update_every (int, optional) – How often to update the fit. (seconds)

  • yerr (str or None, optional) – Name of field in the Event document that provides standard deviation for each Y value. None meaning do not use uncertainties in fit.

event(doc: Event) None[source]

When an event is received, update caches.

update_fit() None[source]

Use the provided guess function with the most recent x and y values after every update.

Parameters:

None

Returns:

None

update_weight(weight: float | None = 0.0) None[source]

Update uncertainties cache.