INTERP: Interpolate Across Rows, Columns, or Masked Pixels

     
Form: INTERP imno [BOX=b1,b2,...] [COL] [ROW] [ORD=n] [AVE=a] [MASK]
imno
is the buffer on which interpolation will be performed,
BOX=b1,b2,...
is a list of boxes to be interpolated across,
COL
interpolates across bad columns,
ROW
interpolates across bad rows,
ORD=n
specifies order of polynomial interpolation,
AVE=a
specifies how many pixels on either side are to be averaged to provide the interpolation,
MASK
interpolates across all masked pixels.
INTERP may be used to remove bad portions of an image. It works by replacing the bad pixels with a polynomial fit to several pixels on either side of the bad part. It is an inherently one-dimensional interpolation, in that it will only interpolate either along a column or along a rows. Hence if you have a bad column you want to get rid of, specify the COL keyword. If you need to replace a bad row, use ROW. Note that ONE of these two keywords MUST be specified. The region across which the interpolation is done is specified by defining a box containing the region. A list of boxes may be given via the BOX= keyword, in case you want to remove a number of bad columns (or rows) from an image. An alternate form uses the MASK keyword. When this is used the program searches the image for the first masked pixel, continues until the next unmasked pixel, and interpolates across this region. Then it proceeds until it finds the next masked pixel, and repeats the process until no more masked pixels have been found. Note that the BOX= and MASK keywords are incompatible; use only one or the other.

The order of the interpolation-polynomial is given with the ORD=n keyword. The default is ORD=0, so that the bad pixels are replaced simply by the average of the adjacent pixels. This works fine for flat images, but when interpolating across stars or spectra ORD=2 works much better (higher orders up to 6 are allowed but are rarely needed). The user can change the number of pixels to be used in the fit by the AVE= keyword. AVE pixels at each side of the bad region are used in the fit. The value of AVE has to be at least (ORD+1)/2, if a smaller value is given, the order of the interpolation-polynomial will be reduced to the highest allowed order. The default value is AVE=1; in other words, replaces the bad pixels with the line (or the average if ORD=0) defined by the pair of adjacent pixels (one pixel on either side) of the bad region.

Examples:

INTERP 4 BOX=2,5,3 COL
Boxes 2, 3, and 5 have been defined to contain bad columns or sets of columns. These boxes in image 4 will be replaced by the average of the their two adjacent columns.

INTERP 2 MASK ROW ORD=1
Bad rows and/or pixels in image 2 which have been masked are to be removed by linear interpolation.

INTERP 17 BOX=3 COL AVE=4
Bad columns in box 3 are to be removed from image 17, at each row the bad columns will be replaced by the average of the eight adjacent columns (four on either side).

INTERP 17 BOX=3 COL AVE=4 ORD=2
Same as above but the bad pixels will be replaced by a 2nd-order polynomial fit to the eight adjacent columns at each row.