quantity_is_between module
Define an objective that is a quantity must be within some bounds.
Todo
Implement loss functions.
- class QuantityIsBetween(name, weight, get_key, get_kwargs, limits, descriptor=None, loss_function=None)[source]
Bases:
ObjectiveQuantity must be within some bounds.
- Parameters:
- __init__(name, weight, get_key, get_kwargs, limits, descriptor=None, loss_function=None)[source]
Set complementary
SimulationOutput.get()flags, reference value.- Parameters:
get_key (str) – Name of the quantity to get, which must be an attribute of
SimulationOutput.get_kwargs (dict[str, Element | str | bool]) – Keyword arguments for the
SimulationOutput.get()method. We do not check its validity, but in general you will want to define the keyseltandpos. If objective concerns a phase, you may want to precise theto_degkey. You also should explicit theto_numpykey.limits (tuple[float, float]) – Lower and upper bound for the value.
loss_function (str | None, optional) – Indicates how the residues are handled whe the quantity is outside the limits. The default is None.
name (
str)weight (
float)
- _value_getter(simulation_output)[source]
Get desired value using
SimulationOutput.get()method.- Parameters:
simulation_output (
SimulationOutput)- Return type:
- evaluate(simulation_output)[source]
Compute residue of this objective.
- Parameters:
simulation_output (SimulationOutput | float) – Object containing simulation results of the broken linac.
- Returns:
residue – Difference between current evaluation and ideal_value value for
self.name, scaled byself.weight.- Return type:
- _abc_impl = <_abc._abc_data object at 0x73dca76120c0>