edges.cal.input_sources

Definition of a class that contains all the data required for a calibration load.

class edges.cal.input_sources.InputSource(*, spectrum: ~edges.cal.spectra.LoadSpectrum, reflection_coefficient: ~edges.cal.sparams.core.datatypes.ReflectionCoefficient, raw_s11: ~edges.cal.sparams.core.datatypes.ReflectionCoefficient | None = None, ambient_temperature: ~numpy._typing._array_like._Buffer | ~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]] | ~numpy._typing._nested_sequence._NestedSequence[~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]]] | complex | bytes | str | ~numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | ~astropy.units.quantity.Quantity | None = <Quantity 298. K>, name='', loss: ~numpy._typing._array_like._Buffer | ~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]] | ~numpy._typing._nested_sequence._NestedSequence[~numpy._typing._array_like._SupportsArray[~numpy.dtype[~typing.Any]]] | complex | bytes | str | ~numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | ~astropy.units.quantity.Quantity | None = NOTHING)[source]

Class containing all relevant information for a given calibration source.

Parameters:
  • spectrum (edges.cal.spectra.LoadSpectrum) – The spectrum for this input source.

  • reflection_coefficient (edges.cal.sparams.core.datatypes.ReflectionCoefficient) – The calibrated reflection coefficient for this input source, defined at the frequencies of the spectrum.

  • raw_s11 – The un-modeled reflection coefficient, which can be set simply to be able to compare to the modeled coefficients.

  • ambient_temperature (astropy.units.quantity.Quantity) – The ambient temperature when the spectra were taken. Used only when calculating the loss.

  • name (str) – The name of the input source. Optional, but can be useful if set.

  • loss (numpy.ndarray) – The loss as a function of frequency (must have the same size as the number of frequency channels in the spectrum).

property averaged_q: ndarray

The average spectrum power ratio, Q (over time).

property freqs: Annotated[Quantity, PhysicalType('frequency')]

Frequencies of the spectrum.

classmethod from_caldef(caldef: ~edges.io.calobsdef.CalObsDefEDGES2 | ~edges.io.calobsdef3.CalObsDefEDGES3, load_name: str, internal_switch: ~edges.cal.sparams.core.datatypes.SParams | None = None, ambient_temperature: ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, PhysicalType('temperature')] | 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>, s11_kwargs: dict | None = None, spec_kwargs: dict | None = None, loss_model: ~collections.abc.Callable | None = None, loss_model_params: ~edges.cal.sparams.core.s11model.S11ModelParams = S11ModelParams(model=Fourier(parameters=None, n_terms=27, _transform=ZerotooneTransform(range=(0.0, 1.0)), xtransform=ZerotooneTransform(range=(0.0, 1.0)), basis_scaler=None, data_transform=IdentityTransform(), period=1.5), 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), restrict_s11_freqs: bool = False) Self[source]

Define a full InputSource from a path and name.

Parameters:
  • caldef – The calibration definition object that points to all the required datafiles.

  • load_name – The name of the load within the calibration definition to use.

  • internal_switch – The internal switch S-parameters to calibrate the source reflection coefficient (optional – use for EDGES 2). Note tat you can compute this with get_internal_switch_from_caldef().

  • ambient_temperature – The ambient temperature during the spectrum observations.

  • f_low – The minimum frequency to keep in the spectra.

  • f_high – The maximum frequency to keep in the spectra.

  • s11_kwargs – Keyword arguments affecting how the reflection coefficients are calibrated and modelled.

  • spec_kwargs – Keyword arguments affecting how the spectra are defined.

  • loss_model – A callable model of the loss of the source.

  • restrict_s11_freqs – Whether to restrict the S11 frequencies to f_low/f_high when calibrating and modelling (they will always be restricted to the spectrum frequencies after modelling).

Returns:

load – The InputSource object, containing all info about spectra and S11’s for that input source.

classmethod from_file(path: str | Path | Group)

Load an HDF5 file as a given type.

get_temp_with_loss()[source]

Calculate the temperature of the load accounting for loss.

property s11: ReflectionCoefficient

An alias for the reflection coefficient.

write(path: str | Path | Group)

Write an attrs class to HDF5.