evaluator.post_treaters module

Define the functions used by SimulationOutputEvaluator.

They are dedicated to treat data. They all take a value and a reference value as arguments and return the treated value (ref is unchanged).

absolute(*args: float, **kwargs: bool) float
absolute(*args: ndarray, **kwargs: bool) ndarray

Return the absolute value.

difference(value: float, reference_value: float, **kwargs: bool) float
difference(value: ndarray, reference_value: ndarray, **kwargs: bool) ndarray

Compute the difference.

do_nothing(value: ndarray | float, ref_value: ndarray | float, **kwargs: bool) ndarray | float

Hold the place for a post treater.

If you want to plot the data as imported from the SimulationOutput, set the first of the post_treaters keys to: partial(_do_nothing, to_plot=True)

maximum(*args: ndarray, **kwargs: bool) float

Return the maximum of value.

minimum(*args: ndarray, **kwargs: bool) float

Return the minimum of value.

relative_difference(value: float, reference_value: float, **kwargs: bool) float
relative_difference(value: ndarray, reference_value: ndarray, **kwargs: bool) ndarray

Compute the relative difference.

rms_error(value: ndarray, reference_value: ndarray, **kwargs: bool) float

Compute the RMS error.

scale_by(*args: float, scale: float = 1.0, **kwargs) float
scale_by(*args: ndarray, scale: ndarray | float = 1.0, **kwargs) ndarray

Return value scaled by scale.

set_first_value_to(*args: ndarray, value: float, **kwargs: bool) ndarray

Set first element of array to value, sometimes bugs in TW output.

sum(*args: ndarray, **kwargs: bool) float

Sum array over linac.

take_last(*args: ndarray, **kwargs: bool) float

Return the last element of value.