lightcurvelynx.noise_models.noise_utils

Functions

poisson_bandflux_std(→ numpy.typing.ArrayLike)

Simulate photon noise for bandflux measurements.

apply_noise(bandflux, bandflux_err[, rng])

Apply Gaussian noise to a bandflux measurement.

Module Contents

poisson_bandflux_std(bandflux: numpy.typing.ArrayLike, *, total_exposure_time: numpy.typing.ArrayLike, exposure_count: numpy.typing.ArrayLike, psf_footprint: numpy.typing.ArrayLike, sky: numpy.typing.ArrayLike, zp: numpy.typing.ArrayLike, readout_noise: numpy.typing.ArrayLike | collections.abc.Callable, dark_current: numpy.typing.ArrayLike, zp_err_mag: numpy.typing.ArrayLike = 0.0) numpy.typing.ArrayLike[source]

Simulate photon noise for bandflux measurements.

Parameters:
  • bandflux (array_like of float) – Source bandflux in energy units, e.g. nJy.

  • total_exposure_time (array_like of float) – Total exposure time of all observation, in time units (e.g. seconds).

  • exposure_count (array_like of int) – Number of exposures in the observation.

  • sky (array_like of float) – Sky background per unit angular area, in the units of electrons / pixel^2.

  • psf_footprint (array_like of float) – Point spread function effective area, in pixel^2.

  • zp (array_like of float) – Zero point bandflux for the observation, i.e. bandflux giving a single electron during the total exposure time. Units are the same as the input bandflux over electron, e.g. nJy / electron.

  • readout_noise (array_like of float, or Callable) – Standard deviation of the readout electrons per pixel per exposure.

  • dark_current (array_like of float) – Mean dark current electrons per pixel per unit time.

  • zp_err_mag (array_like of float) – Zero-point uncertainty in magnitude. Default is 0.

Returns:

Simulated bandflux noise, in the same units as the input bandflux.

Return type:

array_like

Note

  1. We do not specify units for the input parameters, but they should be consistent with each other.

  2. Here we assume that the sky and source photon noises follow Poisson statistics in the limit of large number of photons, e.g. they are both considered to be normal distributed with variance equal to the number of photons. Readout noise is assumed to be Poisson distributed with variance (squared mean) equal to the square of the given value. Dark current is assumed to be Poisson distributed with variance (squared mean) equal to the product of the given value and the exposure time. The output is Poisson standard deviation of the sum of all these noises converted to the flux units.

apply_noise(bandflux, bandflux_err, rng=None)[source]

Apply Gaussian noise to a bandflux measurement.

Parameters:
  • bandflux (ndarray of float) – The bandflux measurement.

  • bandflux_err (ndarray of float) – The bandflux measurement error.

  • rng (np.random.Generator, optional) – The random number generator.

Returns:

The noisy bandflux measurement.

Return type:

ndarray of float