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).

do_nothing(value, ref_value, **kwargs)[source]

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)

Parameters:
Return type:

ndarray | float

set_first_value_to(*args, value, **kwargs)[source]

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

Parameters:
Return type:

ndarray

difference(value, reference_value, **kwargs)[source]
Overloads:
  • value (float), reference_value (float), kwargs (bool) → float

  • value (np.ndarray), reference_value (np.ndarray), kwargs (bool) → np.ndarray

Parameters:
Return type:

ndarray | float

Compute the difference.

Parameters:
Return type:

ndarray | float

relative_difference(value, reference_value, replace_zeros_by_nan_in_ref=True, **kwargs)[source]
Overloads:
  • value (float), reference_value (float), kwargs (bool) → float

  • value (np.ndarray), reference_value (np.ndarray), kwargs (bool) → np.ndarray

Parameters:
Return type:

ndarray | float

Compute the relative difference.

Parameters:
Return type:

ndarray | float

rms_error(value, reference_value, **kwargs)[source]

Compute the RMS error.

Parameters:
Return type:

float

absolute(*args, **kwargs)[source]
Overloads:
  • args (float), kwargs (bool) → float

  • args (np.ndarray), kwargs (bool) → np.ndarray

Parameters:
Return type:

ndarray | float

Return the absolute value.

Parameters:
Return type:

ndarray | float

scale_by(*args, scale=1.0, **kwargs)[source]
Overloads:
  • args (float), scale (float), kwargsfloat

  • args (np.ndarray), scale (np.ndarray | float), kwargsnp.ndarray

Parameters:
Return type:

ndarray | float

Return value scaled by scale.

Parameters:
Return type:

ndarray | float

maximum(*args, **kwargs)[source]

Return the maximum of value.

Parameters:
Return type:

float

minimum(*args, **kwargs)[source]

Return the minimum of value.

Parameters:
Return type:

float

take_last(*args, **kwargs)[source]

Return the last element of value.

Parameters:
Return type:

float

sum(*args, **kwargs)[source]

Sum array over linac.

Parameters:
Return type:

float