NIRI Pattern Noise Removal


NAME
       nirinoise.py - filter pattern noise out of NIRI frames

SYNOPSIS
       nirinoise.py [options] infile

DESCRIPTION
       This script assumes that the NIRI pattern noise in any quadrant
       can be represented by a fixed pattern which is repeated over the
       entire quadrant.  The default size for this pattern is 16 pixels
       wide and 4 pixels high, which may be changed via the -x and -y
       flags.  The pattern is determined for each quadrant by taking the
       median of the pixel value distribution at each position in the
       pattern.  Once the median pattern has been determined for a
       quadrant it is replicated to cover the entire quadrant and then
       subtracted from the quadrant, and the mean of the pattern is
       added back to preserve flux.  The standard deviation of all the
       pixels in the quadrant is compared to that before the pattern
       subtraction, and if no reduction was achieved the subtraction is
       undone.  The pattern subtraction may be forced via the -f flag.
       This process is repeated for all four quadrants of the frame, and
       the cleaned frame is written to <infile>.clean.fits.  The pattern
       derived for each quadrant is saved to <infile>.pattern.fits,
       where the output pattern has a size of 2*patternx by 2*patterny
       pixels; if no pattern was subtracted from a quadrant (because the
       standard deviation did not decrease) that quadrant of the pattern
       file will be filled with zeros.  Occasionally there will be an
       offset in the bias values between the four quadrants and one may
       want to use the -b flag to remove this offset.  In this case the
       median value of each quadrant is calculated in the central 10% of
       the image (changeable via the -c flag) and subtracted, and the
       median value of the original image is added back to each
       quadrant.

       Things are more difficult for spectroscopy since the vertical sky
       lines complicate the pattern mesurement.  By default f/6
       spectroscopy with the 2-pixel or blue slits (which does not fill
       the detector), uses the empty regions at the bottom (1-272) and
       top (720-1024) of the array for calculating the pattern.  This is
       not possible for other modes of spectroscopy as the spectrum
       fills the detector.  For these modes it is best to do sky
       subtraction first (or adjacent pair subtraction) and then run
       this pattern-removal script on the difference image.  If you want
       to use this method for spectra using the f/6 2-pixel or blue sits,
       the -a flag will force using all pixels for the pattern determination.

OPTIONS
       -a : use all pixels for pattern determination
       -b : adjust bias values
       -c <frac> : use central <frac> of image for bias adjustment [0.1]
       -f : force cleaning of all quads even if stddev does not decrease
       -o <file> : write output to $lt;file$gt; [infile.clean.fits]
       -p <file> : write pattern to $lt;file> [infile.pattern.fits]
       -x <size> : set pattern x size in pix [16]
       -y <size> : set pattern y size in pix [4]
       -v : verbose debugging output

VERSION
       2008 February 5


Requirements:

Download

Installation Notes



Examples:
  1. Remove the pattern noise from an image using the default parameters:
    > nirinoise.py N20070806S0001.fits
    Output:
    N20070806S0001.clean.fits - cleaned FITS image
    N20070806S0001.pattern.fits - pattern which was subtracted from the image

  2. Remove the pattern noise from all quadrants even if the standard deviation does not improve,
    normalize the bias value of each quadrant using the central 50% of the image,
    and write the output to cN20070806S0001.fits:
    > nirinoise.py -f -b -c 0.25 -o cN20070806S0001.fits N20070806S0001.fits


Disclaimer:

2008 February 5 - Andrew Stephens <astephens at gemini dot edu>