edges.sim.simulate

Simulation functions for ideal sky observations.

edges.sim.simulate.simulate_spectra(beam: Beam, lsts: Longitude, 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 = ConstantIndex(index=2.5), 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), telescope: Telescope = Telescope(name='edges-low', location=<EarthLocation (-2553239.64058645, 5097473.27470581, -2850021.53546025) m>, pols=('XX', ), integration_time=<Quantity 13. s>, x_orientation=<Angle 0. deg>), ref_time: Time = <Time object: scale='utc' format='isot' value=2014-01-01T09:39:42.000>, interp_kind: Literal['linear', 'nearest', 'slinear', 'cubic', 'quintic', 'pchip', 'spline', 'sphere-spline']='sphere-spline', use_astropy_azel: bool = True) GSData[source]

Simulate global spectra from sky and beam models.

Parameters:
  • beam – A Beam object.

  • lsts – The LSTs at which to simulate

  • sky_model – A sky model to use.

  • 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.

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

  • beam_smoothing – Whether to smooth the beam in frequency before interpolating. This can help with interpolation artifacts, but can also make the simulation less accurate.

  • smoothing_model – The model to use for smoothing the beam in frequency. Only used if beam_smoothing is True.

  • telescope – The telescope to use for the simulation. Specifies the location and polarizations of the simulation.

  • ref_time – The reference time to use for the simulation. This is used to convert between LST and local time. By default, this is set to a time when the LST is 0.1666 (00:10 Hrs LST) at the EDGES location, but can be set to any time.

  • interp_kind – The kind of interpolation to use for the beam. “spline” uses scipy.interpolate.RectBivariateSpline and “sphere-spline” uses scipy.interpolate.RectSphereBivariateSpline. All other options use scipy.interpolate.RegularGridInterpolator. with the given kind as method.

  • use_astropy_azel – Whether to use the astropy coordinate system for azimuth and elevation. If False, compute the az/el using Alan’s method.

Returns:

spectra – A GSData object containing the simulated spectra. The data array has shape (1, 1, Ntimes, Nfreqs), where the first two dimensions are singleton dimensions for loads and polarizations. The frequencies are taken from the beam, but only those between f_low and f_high are kept.

edges.sim.simulate.sky_convolution_generator(lsts: Longitude, beam: Beam, sky_model: SkyModel, index_model: IndexModel, normalize_beam: bool, beam_smoothing: bool, smoothing_model: Model, ground_loss: ndarray | None = None, location: EarthLocation = <EarthLocation (-2553239.64058645, 5097473.27470581, -2850021.53546025) m>, ref_time: Time = <Time object: scale='utc' format='isot' value=2014-01-01T09:39:42.000>, interp_kind: Literal['linear', 'nearest', 'slinear', 'cubic', 'quintic', 'pchip', 'spline', 'sphere-spline']='sphere-spline', lst_progress: bool = True, freq_progress: bool = True, ref_freq_idx: int = 0, use_astropy_azel: bool = True)[source]

Iterate through given LSTs and generate a beam*sky product at each freq and LST.

This is a generator, so it will yield a single item at a time (to save on memory).

Parameters:
  • lsts – The LSTs at which to evaluate the convolution.

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

  • beam – The beam to convolve.

  • sky_model – The sky model to convolve

  • index_model – The spectral index model of the sky model.

  • normalize_beam – Whether to ensure the beam is properly normalised.

  • beam_interpolation – Whether to smooth over freq axis

  • interp_kind – The kind of interpolation to use for the beam. “spline” uses scipy.interpolate.RectBivariateSpline and “sphere-spline” uses scipy.interpolate.RectSphereBivariateSpline. All other options use scipy.interpolate.RegularGridInterpolator. with the given kind as method.

  • use_astropy_azel – Whether to use the astropy coordinate system for azimuth and elevation. If False, compute the az/el using Alan’s method.

Yields:
  • i – The LST enumerator

  • j – The frequency enumerator

  • mean_conv_temp – The mean temperature after multiplying by the beam (above the horizon)

  • conv_temp – An array containing the temperature after multiuplying by the beam in each pixel above the horizon.

  • sky – An array containing the sky temperature in pixel above the horizon.

  • beam – An array containing the interpolatedbeam in pixels above the horizon

  • time – The local time at each LST.

  • n_pixels – The total number of pixels that are not masked.

Examples

Use this function as follows:

>>> for i, j, mean_t, conv_t, sky, bm, time, npix in sky_convolution_generator():
>>>     print(conv_t)