edges.cal.calibrator

A module defining a Calibrator object that holds noise-wave solutions.

class edges.cal.calibrator.Calibrator(*, freqs: Annotated[Quantity, PhysicalType('frequency')], Tsca: ndarray[tuple[Any, ...], dtype[float]], Toff: ndarray[tuple[Any, ...], dtype[float]], Tunc: ndarray[tuple[Any, ...], dtype[float]], Tcos: ndarray[tuple[Any, ...], dtype[float]], Tsin: ndarray[tuple[Any, ...], dtype[float]], receiver_s11: ndarray[tuple[Any, ...], dtype[complex]], unit: Unit = Unit('K'))[source]

A class holding all information required to perform receiver calibration.

This object makes sense in the context of the noise-wave formalism.

calibrate_approximate_temperature(temp: ndarray[tuple[Any, ...], dtype[float]], t_load: float, t_load_ns: float, ant_s11: ReflectionCoefficient | ndarray[tuple[Any, ...], dtype[complex]], freqs: Annotated[Quantity, PhysicalType('frequency')] | None = None, models: dict[str, Callable | Model | None] | None = None) Annotated[Quantity, PhysicalType('temperature')][source]

Calibrate “approximate” temperatures, Tapprox = t_load_ns*Q + t_load.

Parameters:
  • temp – The approximate temperature to calibrate.

  • t_load – The “guess” of the load temperature

  • t_load_ns – The guess of the load+noise-source temperature.

  • ant_s11 – The antenna S11 for the load.

  • freqs – The frequencies at which to calibrate

  • models – A dictionary of models to use to interpolate the calibration coefficients. If None, interpolate with splines.

Returns:

temp (np.ndarray) – The calibrated temperature.

calibrate_load(load: InputSource, models: dict[str, Callable | Model | None] | None = None) Annotated[Quantity, PhysicalType('temperature')][source]

Calibrate a Load object, returning the calibrated temperature.

calibrate_q(q: ndarray, ant_s11: ReflectionCoefficient | ndarray[tuple[Any, ...], dtype[complex]], freqs: Annotated[Quantity, PhysicalType('frequency')] | None = None, models: dict[str, Callable | Model | None] | None = None) Annotated[Quantity, PhysicalType('temperature')][source]

Calibrate power-ratio measurements.

Parameters:
  • q – The power-ratio measurements.

  • ant_s11 – The antenna S11 for the load.

  • freqs – The frequencies at which to calibrate

  • models – A dictionary of models to use to interpolate the calibration coefficients. If None, interpolate with splines.

Returns:

temp (np.ndarray) – The calibrated temperature.

clone(**kwargs)[source]

Clone the instance with new parameters.

decalibrate(temp: Annotated[Quantity, PhysicalType('temperature')], ant_s11: ReflectionCoefficient | ndarray[tuple[Any, ...], dtype[complex]], freqs: Annotated[Quantity, PhysicalType('frequency')] | None = None, models: dict[str, Callable | Model | None] | None = None) Annotated[Quantity, PhysicalType('temperature')][source]

De-calibrate given calibrated spectrum.

Parameters:
  • temp – The spectrum to decalibrate (in K)

  • ant_s11 – The antenna S11 for the load.

  • freqs – The frequencies at which to calibrate

  • models – A dictionary of models to use to interpolate the calibration coefficients. If None, interpolate with splines.

Returns:

q – The uncalibrated power-ratio.

Notes

Using this and then calibrate_q() immediately should be an identity operation.

classmethod from_calfile(path: str | Path) Self[source]

Generate from calfile.

classmethod from_file(path: str | Path | Group)

Load an HDF5 file as a given type.

get_linear_coefficients(ant_s11: ~edges.cal.sparams.core.datatypes.ReflectionCoefficient | ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[complex]], freqs: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('frequency')] | None = None, models: dict[str, ~collections.abc.Callable | ~edges.modeling.core.Model | None] | None = None, s11_model_params: ~edges.cal.sparams.core.s11model.S11ModelParams = S11ModelParams(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=<class 'edges.modeling.composite.ComplexMagPhaseModel'>, find_model_delay=False, model_delay=<Quantity 0. s>, set_transform_range=True, fit_method='lstsq', combine_s12s21=True))[source]

Return the frequency-dependent linear coefficients required to calibrate.

The returned coefficients a and b are such that

T_cal = a*Q + b

get_modelled(thing: Literal['Tsca', 'Toff', 'Tunc', 'Tcos', 'Tsin'], freq: Annotated[Quantity, PhysicalType('frequency')], model: Callable | Model | None = None) ndarray[source]

Evaluate a quantity at particular frequencies.

write(path: str | Path | Group)

Write an attrs class to HDF5.