Priors

class ionworkspipeline.priors.Prior(name: str | list[str] | ndarray | tuple, distribution: Distribution, regularizer_weight=None)

A function that takes a dictionary of inputs and returns a value.

Parameters

funcallable

The penalty function that takes a dictionary of inputs and returns a value.

regularizer_weightfloat, optional

The weight applied to the penalty term. Default is 1.0.

Extends: ionworkspipeline.data_fits.regularizers.regularizers.Regularizer

evaluate_to_array(inputs: dict) ndarray

Evaluate the regularizer function with dictionary inputs, returning an array.

Parameters

inputsdict

Dictionary of input values.

Returns

ndarray

Array containing the regularizer value.

evaluate_to_scalar(inputs: dict) float

Evaluate the regularizer function with dictionary inputs, returning a scalar.

Parameters

inputsdict

Dictionary of input values.

Returns

float

Scalar regularizer value.

class ionworkspipeline.priors.PriorSet(priors: list[Prior], scalar_output: bool, x_to_inputs: callable, regularizer_set_weight=None)

A collection of prior terms that can be evaluated together.

Parameters

regularizerslist, tuple or ndarray

Collection of penalty terms.

scalar_outputbool

Whether the set returns scalar or array outputs.

regularizer_set_weightfloat, optional

Weight applied to the entire penalty set. Default is 1.0.

Extends: ionworkspipeline.data_fits.regularizers.regularizers.RegularizerSet

property base_regularizer_type

type: The base type for regularizers in this set.

evaluate_to_array(inputs: dict) ndarray

Evaluate all regularizers with dictionary inputs, returning an array.

Parameters

inputsdict

Dictionary of input values.

Returns

ndarray

Array containing all regularizer values multiplied by the set weight.

evaluate_to_scalar(inputs: dict) float

Evaluate all regularizers with dictionary inputs, returning a scalar.

Parameters

inputsdict

Dictionary of input values.

Returns

float

Sum of all regularizer values.