edges.cal.calobs¶
The main user-facing module of edges-cal.
This module contains wrappers around lower-level functions in other modules, providing a one-stop interface for everything related to calibration.
- class edges.cal.calobs.CalibrationObservation(*, loads: dict[str, InputSource], receiver: ReflectionCoefficient, raw_receiver: ReflectionCoefficient | None = None)[source]¶
An object representing a full Calibration Observation.
- Parameters:
loads (dict[str, edges.cal.input_sources.InputSource]) – Dictionary of load names mapping to
InputSourceobjects.receiver (edges.cal.sparams.core.datatypes.ReflectionCoefficient) – The reflection coefficient of the receiver.
- property ambient: InputSource¶
The ambient load.
- averaged_spectrum(load: InputSource, t_load_ns: float, t_load: float)[source]¶
Compute a quick guess at the calibrated spectrum of a given load.
- clone(**kwargs)[source]¶
Clone the instance, updating some parameters.
- Parameters:
kwargs – All parameters to be updated.
- property freqs: Annotated[Quantity, PhysicalType('frequency')]¶
The frequencies at which spectra were measured.
- classmethod from_edges2_caldef(caldef: ~edges.io.calobsdef.CalObsDefEDGES2, *, freq_bin_size: int = 1, spectrum_kwargs: dict[str, dict[str, ~typing.Any]] | None = None, s11_kwargs: dict[str, dict[str, ~typing.Any]] | None = None, internal_calkit: ~edges.cal.sparams.core.network_component_models.Calkit | None = None, external_calkit_internal_switch: ~edges.cal.sparams.core.network_component_models.Calkit | None = None, f_low: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('frequency')] = <Quantity 40. MHz>, f_high: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('frequency')] = <Quantity inf MHz>, receiver_kwargs: dict[str, ~typing.Any] | None = None, restrict_s11_model_freqs: bool = True, loss_models: dict[str, callable] | None = None, loss_model_params: ~edges.cal.sparams.core.s11model.S11ModelParams | None = None, internal_switch_temperature: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('temperature')] | None = None, internal_switch_model_params: ~edges.cal.sparams.core.s11model.S11ModelParams | None = S11ModelParams(model=Polynomial(parameters=None, n_terms=8, _transform=ScaleTransform(scale=75.0), xtransform=ScaleTransform(scale=75.0), basis_scaler=None, data_transform=IdentityTransform(), offset=0.0, spacing=1.0), complex_model_type=<class 'edges.modeling.composite.ComplexRealImagModel'>, find_model_delay=False, model_delay=<Quantity 0. s>, set_transform_range=True, fit_method='lstsq', combine_s12s21=True)) Self[source]¶
Create the object from an edges-io observation.
- Parameters:
caldef – A calibration definition object from which all the data can be read.
freq_bin_size – The size of each frequency bin (of the spectra) in units of the raw size.
spectrum_kwargs – Keyword arguments used to instantiate the calibrator
LoadSpectrumobjects. See its documentation for relevant parameters. Parameters specified here are used for _all_ calibrator sources.s11_kwargs – Keyword arguments used to instantiate the calibrator
LoadS11objects. See its documentation for relevant parameters. Parameters specified here are used for _all_ calibrator sources.internal_switch_kwargs – Keyword arguments used to instantiate the
SParamsobjects. See its documentation for relevant parameters. The same internal switch is used to calibrate the S11 for each input source.f_low (float) – Minimum frequency to keep for all loads (and their S11’s). If for some reason different frequency bounds are desired per-load, one can pass in full load objects through
load_spectra.f_high (float) – Maximum frequency to keep for all loads (and their S11’s). If for some reason different frequency bounds are desired per-load, one can pass in full load objects through
load_spectra.sources – A sequence of strings specifying which loads to actually use in the calibration. Default is all four standard calibrators.
receiver_kwargs – Keyword arguments used to instantiate the calibrator
Receiverobjects. See its documentation for relevant parameters.lna_kwargsis a deprecated alias.restrict_s11_model_freqs – Whether to restrict the S11 modelling (i.e. smoothing) to the given freq range. The final output will be calibrated only between the given freq range, but the S11 models themselves can be fit over a broader set of frequencies.
- classmethod from_edges3_caldef(caldef: ~edges.io.calobsdef3.CalObsDefEDGES3, *, freq_bin_size: int = 1, spectrum_kwargs: dict[str, dict[str, ~typing.Any]] | None = None, s11_kwargs: dict[str, dict[str, ~typing.Any]] | None = None, f_low: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('frequency')] = <Quantity 40. MHz>, f_high: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('frequency')] = <Quantity inf MHz>, receiver_kwargs: dict[str, ~typing.Any] | None = None, restrict_s11_model_freqs: bool = True, loss_models: dict[str, callable] | None = None, **kwargs) Self[source]¶
Create the object from an edges-io observation.
- Parameters:
io_obj – An calibration observation object from which all the data can be read.
freq_bin_size – The size of each frequency bin (of the spectra) in units of the raw size.
spectrum_kwargs – Keyword arguments used to instantiate the calibrator
LoadSpectrumobjects. See its documentation for relevant parameters. Parameters specified here are used for _all_ calibrator sources.s11_kwargs – Keyword arguments used to instantiate the calibrator
LoadS11objects. See its documentation for relevant parameters. Parameters specified here are used for _all_ calibrator sources.internal_switch_kwargs – Keyword arguments used to instantiate the
SParamsobjects. See its documentation for relevant parameters. The same internal switch is used to calibrate the S11 for each input source.f_low (float) – Minimum frequency to keep for all loads (and their S11’s). If for some reason different frequency bounds are desired per-load, one can pass in full load objects through
load_spectra.f_high (float) – Maximum frequency to keep for all loads (and their S11’s). If for some reason different frequency bounds are desired per-load, one can pass in full load objects through
load_spectra.sources – A sequence of strings specifying which loads to actually use in the calibration. Default is all four standard calibrators.
receiver_kwargs – Keyword arguments used to instantiate the calibrator
Receiverobjects. See its documentation for relevant parameters.lna_kwargsis a deprecated alias.restrict_s11_model_freqs – Whether to restrict the S11 modelling (i.e. smoothing) to the given freq range. The final output will be calibrated only between the given freq range, but the S11 models themselves can be fit over a broader set of frequencies.
loss_models – A dictionary of loss models for each source. If a particular source has no loss its entry can be missing or None. By default, the only source with loss is the hot_load, which uses a 4” cable.
- get_K() dict[str, tuple[ndarray, ndarray, ndarray, ndarray]][source]¶
Get the source-S11-dependent factors of Monsalve (2017) Eq. 7.
- get_calibration_residuals(calibrator: Calibrator) dict[str, ndarray[tuple[Any, ...], dtype[float]]][source]¶
Get the residuals of calibrated spectra to the known temperatures.
- get_rms(calibrator: Calibrator, smooth: int = 4)[source]¶
Return a dict of RMS values for each source.
- Parameters:
smooth (int) – The number of bins over which to smooth residuals before taking the RMS.
- property hot_load: InputSource¶
The hot load.
- inject(receiver: ndarray = None, source_s11s: dict[str, ndarray] | None = None, averaged_q: dict[str, ndarray] | None = None, thermistor_temp_ave: dict[str, ndarray] | None = None) Self[source]¶
Make a new
CalibrationObservationbased on this, with injections.- Returns:
CalibrationObservation– A new observation object with the injected models.
- property load_s11_models: dict[str, ndarray]¶
Dictionary of S11 correction models, one for each source.
- property open: InputSource¶
The open load.
- property receiver_s11: ReflectionCoefficient¶
The S11 of the receiver.
- property short: InputSource¶
The short load.