edges.cal.sparams.core.s11model

Methods for modeling and smoothing ReflectionCoefficient (S11) data.

class edges.cal.sparams.core.s11model.DelayedS11Model(cmodel: ComplexMagPhaseModel | ComplexRealImagModel, delay: Quantity, PhysicalType('time')]=<Quantity 0. s>)[source]

An S11 callable model that accounts for a delay in the complex values.

class edges.cal.sparams.core.s11model.S11ModelParams(*, model: Model = Fourier(parameters=None, n_terms=55, _transform=UnitTransform(range=(0.0, 1.0)), xtransform=UnitTransform(range=(0.0, 1.0)), basis_scaler=None, data_transform=IdentityTransform(), period=6.283185307179586), complex_model_type: type[ComplexMagPhaseModel] | type[ComplexRealImagModel] = <class 'edges.modeling.composite.ComplexMagPhaseModel'>, find_model_delay: bool = False, model_delay: Quantity, PhysicalType('time')]=<Quantity 0. s>, set_transform_range=True, fit_method: str = 'lstsq', combine_s12s21: bool = True)[source]

A class holding parameters required to model an S11.

Parameters:
  • model (edges.modeling.core.Model) – The linear model used to fit each component of the data (real/imag or abs/phase)

  • complex_model_type (type[edges.modeling.composite.ComplexMagPhaseModel] | type[edges.modeling.composite.ComplexRealImagModel]) – The type of complex model to use (ComplexMagPhaseModel or ComplexRealImagModel).

  • find_model_delay (bool) – Whether to find and remove a delay in the S11 data before fitting the model.

  • optimize_model_delay – Whether to optimize the model delay using a minimization routine (by default, do a simple grid search).

  • model_delay (astropy.units.quantity.Quantity) – If not finding the model delay, use this fixed delay value.

  • set_transform_range (bool) – Whether to set the transform range/scale based on the frequency range of the data.

  • fit_method (str) – The fitting method to use when fitting the model to the data, see edges.modeling.fitting.ModelFit().

  • combine_s12s21 (bool) – Whether to fit to s12*s21 instead of fitting s12 and s21 separately.

clone(**kwargs)[source]

Clone with new parameters.

classmethod from_file(path: str | Path | Group)

Load an HDF5 file as a given type.

write(path: str | Path | Group)

Write an attrs class to HDF5.

edges.cal.sparams.core.s11model.get_delay(gamma: ReflectionCoefficient) Annotated[Quantity, Unit('us')][source]

Find the delay of an S11 with a grid search.

edges.cal.sparams.core.s11model.get_s11_model(params: S11ModelParams, gamma: ReflectionCoefficient) Callable[[Annotated[Quantity, PhysicalType('frequency')]], ndarray][source]

Generate a callable model for the S11.

This should closely match s11_correction().

Parameters:

raw_s11 – The raw s11 of the

Returns:

callable – A function of one argument, f, which should be a frequency in the same units as self.freq.

Raises:

ValueError – If n_terms is not an integer, or not odd.

edges.cal.sparams.core.s11model.new_s11_modelled(gamma: ReflectionCoefficient, params: S11ModelParams, freqs: Annotated[Quantity, PhysicalType('frequency')] | None = None) ReflectionCoefficient[source]

Create a new ReflectionCoefficient that has been smoothed/modelled.

Parameters:
  • raw_s11 – The input ReflectionCoefficient object.

  • params – The set of parameters defining the model used to smooth/interpolate.

  • new_freqs – Optional new frequencies onto which to interpolate. If not given, retain the same set of frequencies.

Returns:

modelled_s11 – A new ReflectionCoefficient object that has been smoothed.

edges.cal.sparams.core.s11model.smooth_sparams(sparams: SParams, params: S11ModelParams | dict[str, S11ModelParams], freqs: Annotated[Quantity, PhysicalType('frequency')] | None = None) SParams[source]

Smooth all S-parameters using the S11 modeling procedure.

Parameters:
  • sparams – The input SParams object.

  • params – The set of parameters defining the model used to smooth/interpolate.

  • new_freqs – Optional new frequencies onto which to interpolate. If not given, retain the same set of frequencies.

Returns:

smoothed_sparams – A new SParams object that has been smoothed.