edges.sim.antenna_beam_factor

Functions for computing the antenna beam factor.

class edges.sim.antenna_beam_factor.BeamFactor(frequencies, lsts, reference_frequency, antenna_temp, antenna_temp_ref, loss_fraction: ndarray | None = None, meta=NOTHING)[source]

A non-interpolated beam factor.

This class holds the attributes necessary to compute beam factors at particular LSTs and frequencies, namely the antenna temperature (beam-weighted integral of the sky) and the same at a particular reference frequency. We hold these separately to enable computing the beam factor in different ways from these basic quantities.

Variables:
  • frequencies (np.ndarray) – The frequencies at which the beam-weighted sky integrals are defined.

  • lsts (np.ndarray) – The LSTs at which the beam-weighted sky integrals are defined.

  • reference_frequency (float) – The reference frequency.

  • antenna_temp (np.ndarray) – The beam-weighted sky integrals at each frequency and LST.

  • antenna_temp_ref (np.ndarray) – The beam-weighted sky integrals at the reference frequency and each LST.

  • loss_fraction (np.ndarray) – The fraction of the sky signal lost below the horizon.

  • meta (dict) – A dictionary of metadata.

at_lsts(lsts: ndarray, interp_kind: int | str = 'cubic') Self[source]

Return a new BeamFactor at the given LSTs.

between_lsts(lst0: float, lst1: float) Self[source]

Return a new BeamFactor including only LSTs between those given.

Parameters:
  • lst0 – Lower edge of lsts in hours.

  • lst1 – Upper edge of lsts in hours.

classmethod from_file(path: str | Path | Group)

Load an HDF5 file as a given type.

get_beam_factor(model: Model, freqs: ndarray | None = None) ndarray[source]

Return the beam factor as a function of LST and frequency.

This will always be normalized to unity at the reference frequency, via a model fit.

get_integrated_beam_factor(model: Model, freqs: ndarray | None = None, **fit_kwargs) ndarray[source]

Return the beam factor integrated over the LST range.

This is the ratio of summed LSTs, rather than the sum of the ratio at each LST, i.e. it is not the same as the mean beam factor over the LST range. It is normalized to unity at the reference frequency via a model fit.

get_mean_beam_factor(model: Model, freqs: ndarray | None) ndarray[source]

Return the mean beam factor over all LSTs.

property nfreq: int

The number of frequencies in the beam factor.

property nlst: int

The number of LSTs in the beam factor.

write(path: str | Path | Group)

Write an attrs class to HDF5.

edges.sim.antenna_beam_factor.compute_antenna_beam_factor(beam: Beam, sky_model: SkyModel, ground_loss: ndarray | None = None, f_low: Quantity, PhysicalType('frequency')]=<Quantity 0. MHz>, f_high: Quantity, PhysicalType('frequency')]=<Quantity inf MHz>, normalize_beam: bool = True, index_model: IndexModel = GaussianIndex(index_pole=2.65, index_center=2.4, sigma_deg=8.5), lsts: ndarray | None = None, reference_frequency: Quantity, PhysicalType('frequency')] | None=None, beam_smoothing: bool = True, smoothing_model: Model = Polynomial(parameters=None, n_terms=12, _transform=IdentityTransform(), xtransform=IdentityTransform(), basis_scaler=None, data_transform=IdentityTransform(), offset=0.0, spacing=1.0), interp_kind: Literal['linear', 'nearest', 'slinear', 'cubic', 'quintic', 'pchip', 'spline', 'sphere-spline']='cubic', lst_progress: bool = True, freq_progress: bool = True, location: EarthLocation = <EarthLocation (-2553239.64058645, 5097473.27470581, -2850021.53546025) m>, sky_at_reference_frequency: bool = True, use_astropy_azel: bool = True) BeamFactor[source]

Calculate the antenna beam factor.

Parameters:
  • beam – A Beam object.

  • ground_loss – An array of ground-loss values for the beam, shape (Nfreq,).

  • f_low – Minimum frequency to keep in the simulation (frequencies otherwise defined by the beam).

  • f_high – Maximum frequency to keep in the simulation (frequencies otherwise defined by the beam).

  • normalize_beam – Whether to normalize the beam to be maximum unity.

  • sky_model – A sky model to use.

  • index_model – An IndexModel to use to generate different frequencies of the sky model.

  • twenty_min_per_lst – How many periods of twenty minutes fit into each LST bin.

  • save_dir – The directory in which to save the output beam factor.

  • save_fname – The filename to save the output beam factor.

  • reference_frequency – The frequency to take as the “reference”, i.e. where the chromaticity will be by construction unity.

  • lst_progress – Whether to show a progress bar over the LSTs.

  • freq_progress – Whether to show a progress bar over the frequencies.

  • location – The location of the telescope.

Returns:

beam_factor (:class`BeamFactor` instance)