optimize_s11#
- simpleEMS.sim_tools.optimize_s11(freqs: ndarray[tuple[Any, ...], dtype[_ScalarT]], s11: ndarray[tuple[Any, ...], dtype[_ScalarT]], target_freq: float | None = None, freq_band: tuple[float, float] | None = None, mode: str = 'worst', threshold: float = -15) floating#
Objective function for S11 (reflection) optimization. Lower is better.
Intended as a scalar cost function for
optimize_s_params: converts S11 to dB and reduces it to a single number, either at one frequency or over a band. Iftarget_freqis given it takes precedence overfreq_band(andmode/thresholdare ignored).- Parameters:
freqs (NDArray) – Array of frequencies in Hz, matching
s11.s11 (NDArray) – Complex S11 parameter array across the frequency range.
target_freq (float, optional) – If given, evaluate S11 (in dB) at the frequency in
freqsclosest to this value, ignoringfreq_band/mode/threshold.freq_band (tuple of (float, float), optional) – Frequency band
(f_min, f_max)in Hz over which to evaluate S11 whentarget_freqis not given.mode (str, optional) –
Evaluation mode within the frequency band:
"worst": the maximum S11 in dB (worst-case reflection)."mean": the mean S11 in dB across the band."threshold": sum, over the band, of the amount (in dB) each point exceedsthreshold(0 if none exceed it).
Default is
"worst".threshold (float, optional) – S11 threshold in dB, used only when
mode="threshold". Default is-15.
- Returns:
Scalar cost value (S11 in dB); lower means better matched.
- Return type:
float
- Raises:
ValueError – If
modeis not one of"mean","worst", or"threshold", or if neithertarget_freqnorfreq_bandis provided.