opticam.noise ============= .. py:module:: opticam.noise Functions --------- .. autoapisummary:: opticam.noise.get_sky_stderr opticam.noise.get_shot_stderr opticam.noise.get_bias_stderr opticam.noise.get_dark_stderr opticam.noise.get_flat_stderr opticam.noise.get_read_stderr opticam.noise.snr opticam.noise.snr_stderr opticam.noise.get_noise_params opticam.noise.get_snrs opticam.noise.characterise_noise Module Contents --------------- .. py:function:: get_sky_stderr(N_source, N_pix, n_sky) Get the standard error (in magnitudes) of the sky noise. Parameters ---------- N_source : float The total number of source counts. N_pix : int The number of aperture pixels. n_sky : float The number of sky counts **per pixel**. Returns ------- float The standard error (in magnitudes) of the sky noise. .. py:function:: get_shot_stderr(N_source) Get the standard error (in magnitudes) of the shot noise. Parameters ---------- N_source : float The total number of source counts. Returns ------- float The standard error (in magnitudes) of the shot noise. .. py:function:: get_bias_stderr(N_source, N_pix, bias_var) Get the standard error (in magnitudes) of the bias variance. Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. bias_var : Quantity The bias variance. Returns ------- float The standard error (in magnitudes) of the bias variance. .. py:function:: get_dark_stderr(N_source, N_pix, dark_var) Get the standard error (in magnitudes) of the dark noise variance. Parameters ---------- N_source : float The total number of source counts. N_pix : int The number of aperture pixels. dark_var : float The dark noise variance. Returns ------- float The standard error (in magnitudes) of the dark noise. .. py:function:: get_flat_stderr(N_source, N_pix, flat_var) Get the standard error (in magnitudes) of the flat-field variance. Parameters ---------- N_source : float The total number of source counts. N_pix : int The number of aperture pixels. flat_var : float The flat-field variance. Returns ------- float The standard error (in magnitudes) of the flat-field variance. .. py:function:: get_read_stderr(N_source, N_pix, read_noise) Get the standard error (in magnitudes) of the readout noise. Parameters ---------- N_source : float The total number of source counts. N_pix : float The number of aperture pixels. read_noise : float The read noise of the detector in electrons/pixel. Returns ------- float The standard error (in magnitudes) of the readout noise. .. py:function:: snr(N_source, N_pix, n_sky, bias_var, dark_var, flat_var, read_noise) The (simplified) S/N ratio equation or CCD Equation (see Chapter 4.4 of Handbook of CCD Astronomy by Howell, 2006). Parameters ---------- N_source : float | NDArray The total number of source counts. N_pix : int The number of aperture pixels. n_sky : float The number of sky counts **per pixel**. bias_var : float The bias variance. dark_var : float The dark noise variance. flat_var : float The flat-field variance. read_noise : float The read noise of the detector in electrons/pixel. Returns ------- float | NDArray The S/N ratio. .. py:function:: snr_stderr(N_source, N_pix, n_sky, bias_var, dark_var, flat_var, read_noise) The standard error (in magnitudes) on the CCD Equation (see Chapter 4.4 of Handbook of CCD Astronomy by Howell, 2006). Parameters ---------- N_source : float | NDArray The total number of source counts. N_pix : float The number of aperture pixels. n_sky : float The number of sky counts **per pixel**. bias_var : float The bias variance. dark_var : float The dark noise variance. flat_var : float The flat-field variance. read_noise : float The read noise of the detector in electrons/pixel. Returns ------- float | NDArray The standard error (in magnitudes) on the S/N ratio. .. py:function:: get_noise_params(file, catalog, background, psf_params, instrument, bias_corrector, dark_corrector, flat_corrector) Get the noise values of a science image. Parameters ---------- file : MEFSlice The science image file. catalog : QTable The source catalog corresponding to the science image. background : BaseBackground | Callable The background estimator. psf_params : dict[str, float] The PSF parameters. instrument : Instrument The instrument. bias_corrector : BiasCorrector | None The bias corrector. dark_corrector : DarkNoiseCorrector | None The dark noise corrector. flat_corrector : FlatFieldCorrector | None The flat-field corrector. Returns ------- tuple[NDArray, NDArray, float, float, float] The source IDs, fluxes, flux errors, number of aperture pixels, backgorund counts/pixel, bias variance, dark variance, and flat-field variance. .. py:function:: get_snrs(file, background, catalog, psf_params, instrument, bias_corrector, dark_corrector, flat_corrector) Get the S/N ratios for the cataloged sources in a science image. Parameters ---------- file : MEFSlice The science image file. background : BaseBackground | Callable The background estimator. catalog : QTable The source catalog corresponding to the science image. psf_params : dict[str, float] The PSF parameters. instrument : Instrument The instrument. bias_corrector : BiasCorrector | None The bias corrector. dark_corrector : DarkNoiseCorrector | None The dark noise corrector. flat_corrector : FlatFieldCorrector | None The flat-field corrector. Returns ------- tuple[NDArray, NDArray] The source IDs and S/N for each source. .. py:function:: characterise_noise(file, background, catalog, psf_params, instrument, bias_corrector, dark_corrector, flat_corrector) Characterise the expected noise from an image and compare it to the measured noise for a number of cataloged sources. Parameters ---------- file : MEFSlice The science image file. background : BaseBackground | Callable The background estimator. catalog : QTable The source catalog corresponding to the science image. psf_params : dict[str, float] The PSF parameters. instrument : Instrument The instrument. bias_corrector : BiasCorrector The bias corrector. dark_corrector : DarkNoiseCorrector The dark noise corrector. flat_corrector : FlatFieldCorrector The flat-field corrector. Returns ------- dict[str, NDArray] The noies properties.