optimisation.objective.minimize_mismatch module
This module is specific to hold mismatches.
It has its own module as this quantity is pretty specific.
- class MinimizeMismatch(name: str, weight: float, get_key: str, get_kwargs: dict[str, Element | str | bool], reference: SimulationOutput, descriptor: str | None = None)
Bases:
Objective
Minimize a mismatch factor.
- __init__(name: str, weight: float, get_key: str, get_kwargs: dict[str, Element | str | bool], reference: SimulationOutput, descriptor: str | None = None) None
Set complementary
get()
flags, reference value.- Parameters:
get_key (str) – Must contain ‘twiss’ plus the name of a phase-space, or simply ‘twiss’ and the phase-space is defined in
get_kwargs
.get_kwargs (dict[str, Element | str | bool]) – Keyword arguments for the
get()
method. We do not check its validity, but in general you will want to define the keyselt
andpos
. You should also define thephase_space_name
key if it is not defined in theget_key
.reference (SimulationOutput) – The reference simulation output from which the Twiss parameters will be taken.
- _abc_impl = <_abc._abc_data object>
- _base_str() str
Return a base text for output.
- _compute_residues(twiss_fix: ndarray) float
Compute the residues.
- _twiss_getter(simulation_output: SimulationOutput) ndarray
Get desired value using
SimulationOutput.get()
method.
- current_value(simulation_output: SimulationOutput) str
Give value of current objective and residue.
- evaluate(simulation_output: SimulationOutput) float
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:
float