opticam.noise ============= .. py:module:: opticam.noise Functions --------- .. autoapisummary:: opticam.noise.get_source_photons opticam.noise.get_sky_photons_per_pixel opticam.noise.get_dark_counts_per_pixel opticam.noise.get_read_counts_per_pixel opticam.noise.get_sky_stderr opticam.noise.get_shot_stderr opticam.noise.get_dark_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_source_photons(N_source, gain) Get the number of source photons. Parameters ---------- N_source : Quantity The number of source counts [ADU]. gain : Quantity The gain [photons/ADU]. Returns ------- float The number of source photons. .. py:function:: get_sky_photons_per_pixel(n_sky, gain) Get the number of sky photons per pixel. Parameters ---------- n_sky : Quantity The sky counts per unit pixel [ADU/pix]. gain : Quantity The gain [photons/ADU]. Returns ------- float The number of sky photons per pixel. .. py:function:: get_dark_counts_per_pixel(dark_curr, t_exp) Get the number of dark counts per pixel. Parameters ---------- dark_curr : Quantity The dark current [ADU/pixel/second] t_exp : Quantity The exposure time [seconds]. Returns ------- float The number of dark counts per pixel. .. py:function:: get_read_counts_per_pixel(n_read) Get the read noise per pixel. Parameters ---------- n_read : Quantity The number of counts due to read noise per pixel [ADU/pixel]. Returns ------- float The read noise per pixel. .. py:function:: get_sky_stderr(N_source, N_pix, n_sky, gain) Get the standard error (in magnitudes) of the sky noise. Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. n_sky : Quantity The number of sky counts **per pixel**. gain: Quantity The detector gain. Returns ------- float The standard error (in magnitudes) of the sky noise. .. py:function:: get_shot_stderr(N_source, gain) Get the standard error (in magnitudes) of the shot noise. Parameters ---------- N_source : Quantity The total number of source counts. gain: Quantity The detector gain. Returns ------- float The standard error (in magnitudes) of the shot noise. .. py:function:: get_dark_stderr(N_source, N_pix, n_dark, t_exp, gain) Get the standard error (in magnitudes) of the dark current noise. Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. dark_curr : Quantity The number of dark current electrons **per pixel per unit time**. t_exp: Quantity The exposure time. gain: Quantity The detector gain. Returns ------- float The standard error (in magnitudes) of the dark current noise. .. py:function:: get_read_stderr(N_source, N_pix, n_read, gain) Get the standard error (in magnitudes) of the readout noise. Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. n_read : Quantity The number of electrons **per pixel** due to read noise. gain: Quantity The detector gain. Returns ------- float The standard error (in magnitudes) of the readout noise. .. py:function:: snr(N_source, N_pix, N_bkg, n_sky, dark_curr, n_read, t_exp, gain) The (simplified) S/N ratio equation or CCD Equation (see Chapter 4.4 of Handbook of CCD Astronomy by Howell, 2006). Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. N_bkg : Quantity The number of pixels used to estimate the background. n_sky : Quantity The number of sky counts **per pixel**. dark_curr : Quantity The number of dark current electrons **per pixel per unit time**. n_read : Quantity The number of electrons **per pixel** due to read noise. t_exp: Quantity The exposure time. gain: Quantity The detector gain. Returns ------- float The S/N ratio. .. py:function:: snr_stderr(N_source, N_pix, N_bkg, n_sky, dark_curr, n_read, t_exp, gain) The standard error (in magnitudes) on the CCD Equation (see Chapter 4.4 of Handbook of CCD Astronomy by Howell, 2006). Parameters ---------- N_source : Quantity The total number of source counts. N_pix : int The number of aperture pixels. N_bkg : Quantity The number of pixels used to estimate the background. n_sky : Quantity The number of sky counts **per pixel**. dark_curr : Quantity The number of dark current electrons **per pixel per unit time**. n_read : Quantity The number of electrons **per pixel** due to read noise. t_exp: Quantity The exposure time. gain: Quantity The detector gain. Returns ------- float The standard error (in magnitudes) on the S/N ratio. .. py:function:: get_noise_params(file, catalog, background, psf_params) Get the noise values of a science image. Parameters ---------- file : str The path to the science image. catalog : QTable The source catalog corresponding to the science image. background : BaseBackground | Callable The background estimator. psf_params : Dict[str, float] The PSF parameters. Returns ------- Tuple[NDArray, NDArray, Quantity, Quantity, Quantity, Quantity, Quantity, Quantity] The fluxes, flux errors, number of pixels, backgorund counts/pixel, dark current, readout noise, exposure time, and gain. .. py:function:: get_snrs(file, background, catalog, psf_params) Get the S/N ratios for the cataloged sources in a science image. Parameters ---------- file : str The path to the science image. background : BaseBackground | Callable The background estimator. catalog : QTable The source catalog corresponding to the science image. psf_params : Dict[str, float] The PSF parameters. Returns ------- List[float] The S/N for each source. Sources are ordered as they appear in `catalog`. .. py:function:: characterise_noise(file, background, catalog, psf_params) Characterise the expected noise from an image and compare it to the measured noise for a number of cataloged sources. Parameters ---------- file : str The file path to the science image. background : BaseBackground | Callable The background estimator. catalog : QTable The source catalog corresponding to the science image. psf_params : Dict[str, float] The PSF parameters. Returns ------- Dict[str, NDArray] The noies properties.