MASH: Extract a Spectrum by Summing (mashing) Rows or Columns

Form:MASH dest source SP=i1,i2 [BK=b1,b2] [COLS] [COL] [COL=c1,c2] [ROW=r1,r2]
 $$
[SKY=s] [NORM] [REFLAT] [SUB] [MASK]
dest
is the buffer which will hold the resulting spectrum.
source
is the image from which the spectrum is being made.
COLS or COL
says that the spectrum runs down columns.
SP=
delimits the rows or columns in the image 'source' which are used to make the spectrum.
BK=
delimits rows (columns) used for the background
COL=
takes the spectrum from the specified columns.
ROW=
takes the spectrum from the specified rows.
SKY=
saves the sky rows (from BK= keyword) as a spectrum in buffer s.
NORM
averages the added rows.
REFLAT
fits each background column (row) with a parabola, and uses this as the background. Alters source buffer.
SUB
subtracts the average background spectrum from the original image.
MASK
uses the image mask defined with the MASK command to ignore bad pixels and/or image segments. This works only with REFLAT option.

MASH adds together rows or columns of an image to produce a spectrum. The number of the spectrum comes immediately after MASH on the command line. The basic syntax of this command is:

     MASH (extract this spectrum) (from this image)
SP= selects rows (or columns when COLS is used) that are to be added to make the spectrum. BK selects rows (or columns) which are background. The resulting spectrum is the sum of the spectrum rows (or columns) with the background rows (columns) subtracted. You may specify SP and BK more than once.

It is assumed that the spectrum is aligned with the columns or rows on the image - that each column (or row) contains light of only one wavelength. Use SPECTROID if the slit lies along columns or rows, but the spectrum is either curved or projected diagonally across the image (as is the case for single-order or multi-order cross-dispersed spectrometers, slit spectrographs with either large spectra ranges or observations taken with severe atmospheric dispersion, or multi-order echelle spectra). In the future, VISTA will be able to handle spectra for which the dispersion is not aligned along a row or column (e.g., a CCD tilted with respect to the nominal dispersion axis).

NORM divides the spectrum by the number of rows (or columns) used to produce the spectrum. COL= (or ROW= if COLS is used) selects the columns (or rows) used to make the spectrum.

REFLAT selects the background rows (columns) in the image, fitting each column (row) of the image with a polynomial. The image columns (rows) are divided by this polynomial to 're-flat' the image. MASK tells the program to ignore masked pixels in the REFLAT procedure.

SKY=n saves the sky spectrum (the normalized sum of the background rows or columns) in the designated buffer.

Examples: The examples below assume that the spectrum runs along rows. If it ran along columns, you would add the COLS keyword and substitute ROW= for the COL= keyword

MASH 2 1 SP=50,55 BK=20,30 BK=75,80
produces spectrum 2 from image 1. The spectrum is taken from rows 50-55. The background is rows 20-30 and 75-80.

MASH 2 1 SP=50,55 BK=20,30 BK=75,80 COL=100,200
does the same as example 1, but takes the spectrum only from columns 100 to 200.

MASH 2 1 SP=50,55 BK=20,30 BK=75,80 REFLAT
A polynomial is fit down each column, using the rows selected for the background. Each column in the image is divided by the polynomial which was fit in that column. The MASH then proceeds as in example 1.