pynrc.nrc_utils.pix_noise

pynrc.nrc_utils.pix_noise(ngroup=2, nf=1, nd2=0, tf=10.73677, rn=15.0, ktc=29.0, p_excess=(0, 0), fsrc=0.0, idark=0.003, fzodi=0, fbg=0, ideal_Poisson=False, ff_noise=False, **kwargs)[source]

Noise per pixel

Theoretical noise calculation of a generalized MULTIACCUM ramp in terms of e-/sec. Includes flat field errors from JWST-CALC-003894.

Parameters
  • n (int) – Number of groups in integration rampl

  • m (int) – Number of frames in each groupl

  • s (int) – Number of dropped frames in each groupl

  • tf (float) – Frame time

  • rn (float) – Read Noise per pixel (e-).

  • ktc (float) – kTC noise (in e-). Only valid for single frame (n=1)l

  • p_excess (array-like) – An array or list of two elements that holds the parameters describing the excess variance observed in effective noise plots. By default these are both 0. For NIRCam detectors, recommended values are [1.0,5.0] for SW and [1.5,10.0] for LW.

  • fsrc (float) – Flux of source in e-/sec/pix.

  • idark (float) – Dark current in e-/sec/pix.

  • fzodi (float) – Zodiacal light emission in e-/sec/pix.

  • fbg (float) – Any additional background (telescope emission or scattered light?)

  • ideal_Poisson (bool) – If set to True, use total signal for noise estimate, otherwise MULTIACCUM equation is used.

  • ff_noise (bool) – Include flat field errors in calculation? From JWST-CALC-003894. Default=False.

Notes

Various parameters can either be single values or numpy arrays. If multiple inputs are arrays, make sure their array sizes match. Variables that need to have the same array shapes (or a single value):

  • n, m, s, & tf

  • rn, idark, ktc, fsrc, fzodi, & fbg

Array broadcasting also works.

Example

>>> n = np.arange(50)+1  # An array of different ngroups to test out
>>> # Create 2D Gaussian PSF with FWHM = 3 pix
>>> npix = 20  # Number of pixels in x and y direction
>>> fwhm = 3.0
>>> x = np.arange(0, npix, 1, dtype=float)
>>> y = x[:,np.newaxis]
>>> x0 = y0 = npix // 2  # Center position
>>> fsrc = np.exp(-4*np.log(2.) * ((x-x0)**2 + (y-y0)**2) / fwhm**2)
>>> fsrc /= fsrc.max()
>>> fsrc *= 10  # 10 counts/sec in peak pixel
>>> fsrc = fsrc.reshape(npix,npix,1)  # Necessary for broadcasting
>>> # Represents pixel array w/ slightly different RN/pix
>>> rn = 15 + np.random.normal(loc=0, scale=0.5, size=(1,npix,npix))
>>> # Results is a 50x(20x20) showing the noise in e-/sec/pix at each group
>>> noise = pix_noise(ngroup=n, rn=rn, fsrc=fsrc)