ALIGN: Linearize or Transform a Wavelength-Calibrated Spectrum

     
Form: ALIGN source [DSP=disp] [W=l,p] [NW=n] [LOG] [FLIP] [MS=n]
[NOFLUX] [V=v] [Z=z] [RED=z] [DERED=z] [DP=dp] [DS=dp]
[LCMOD=n] [SINC] [LGI] [SILENT]
source
is the image that the program works on.
DSP=disp
set the dispersion of the new scale (p.e. Angs/pixel),
W=l,p
sets zero-point of new scale (lambda 'l' at pixel 'p',
NW=n
makes final scale cover the range of n pixels.
LOG
transforms to a logarithmic scale (linear otherwise),
FLIP
reverse the direction of the dispersion,
MS=n
set the final pixel scale to be that of image 'n',
NOFLUX
prevent conversion to counts/sec/Angstrom.
V=v
remove velocity shift of 'v' km/sec,
Z=z, DERED=z
remove redshift z (i.e. deredshifts the image rows),
RED=z
redshift the image by z.
DP=dp
remove a shift of dp pixels from the image,
DS=ds
remove a stretch of ds relative-units from the image,
LCMOD=n
remove the polynomial distortion given in buffer 'n',
SILENT
inhibit printout.
ALIGN will transform the rows of an image from the original pixel scale to either a linear scale or a logarithmic scale. The physical pixel units defined on the FITS card CTYPE1 are arbitrary (Wavelength, Time, RA, etc) We will refer mostly to wavelengths in angstroms but other units are treated analogously. Columns can be aligned after a right angle rotation of the image.

Spectral pixels are re-binned onto the new wavelength scale using a Lagrangian interpolation algorithm. Lagrangian interpolation conserves area (under binned data as opposed to sampled data), runs faster, and produces less "ringing" when interpolating undersampled data than resampling algorithms (like SINC interpolation).

If the pixel-scale is not one of wavelength (or lnWavelength) the scale used is the linear scale defined by the FITS cards CRVAL1, CDELT1, and CRPIX1, so the original image can be on any of the 3 scales supported by VISTA:

   Linear (FITS standard)     :  Lambda = Lambda0 + Dispersion * Pix
   Logarithmic                :  Ln(Lambda) = Ln(Lambda0) + b * Pix
   Polynomial (VISTA internal):  Lambda = P(0) + P(1)*Pix + P(2)*Pix**2 + ...

To ALIGN 1-D or long-slit (2-D) spectra, first compute a polynomial wavelength calibration from an appropriate lamp spectrum using the LINEID and WSCALE command. Then copy the results to the object image using the COPW command. ALIGN can then be used to transform the image onto the desired final (linear or logarithmic) wavelength scale. If you want to edit the FITS cards directly, note that the REVERSE fit (pixel as a function of wavelength) computed by WSCALE is the fit actually used within ALIGN.

If the image is initially on a VISTA polynomial wavelength scale (CTYPE1=LAMBDA_POLY), the observed intensities are converted to an uncalibrated F-Lambda scale (counts/sec/Angstrom), unless the NOFLUX word is given. This conversion is done by dividing each pixel by (1) the integration time (FITS header EXPOSE or EXPTIME card) and (2) the width of each pixel in Angstroms (note that for a polynomial wavelength scale in raw spectra, the number of Angstroms spanned by each pixel changes as a function of position). If you are aligning co-added ("stacked") images, the integration-time data in the FITS header must be changed to the appropriate total integration time.

To specify the dispersion and zero-point of the new pixel scale, you may supply ALIGN with the desired dispersion and reference pixel using DSP=disp keyword to specify the desired new dispersion, and W=l,p where 'l' to give the lambda at the reference pixel 'p' in the final aligned image. The default of these references are those of the image's first column. If the original pixel scale is other than raw-pixels, ALIGN will set the starting column of the final image to be pixel 1.

The keywords DP=dp, DS=ds, and LCMOD=n can remove the effects of having a different scale on the FITS cards and on the image rows due to geometric distortions (like flexure shifts, Optical distortions, Line-Curvature, etc). A combination of DP=dp and DS=ds will take care of simple cases where distortions can be characterized by a single shift plus a linear a stretch of the form:

 
  PIX(Image) = PIX(Fits)*ds + dp, or PIX(Fits) = (PIX(Image)-dp)/ds.

LCMOD=b can remove more general distortions than the linear case allowed by keywords DP=dp and DS=ds, since a different polynomial distortion may be removed from each row of the image. Buffer b should hold the polynomial coefficients (in the format generated by command ROWFIT LOAD=b) giving, for each row the distortion relation :

 
  PIX(Image) = p0 + p1 * PIX(Fits) + p2 * PIX(Fits)**2 + ...
To remove or to add effects due to redshift, the user may use keywords V=v, Z=z, RED=z, and/or DERED=z. V=v, will REMOVE a velocity shift of v km/sec (one way to conveniently remove known radial velocities from an image). Z=z or DERED=z will REMOVE a redshift of 'z' from the image rows. RED=z will redshift the spectrum by 'z'. Note that RED=z is NOT the same as DERED=-z or Z=z (since 1-z, used by Z=z and DERED=-z, is not equal to 1/(1+z), used by RED=z).

Any combination of keywords is allowed to remove or to add distortions, shifts or redshifts. Note that DSP=disp and W=l,p refer to the dispersion and zero-point of the new final scale (i.e. AFTER removing the net combined effect)

Other keywords provide a variety of options as follows:

LOG
Puts the image on a logarithmic wavelength scale such that
  (lambda) = Ln(Lambda0) + b * pix,
and the DSP=disp keyword specifies the dispersion at the wavelength specified by the W=l,p keyword.

NW=n
ALIGN generates an output image covering the wavelength range of the input image. NW=n specifies the number of columns of the output to cover larger (filled with zeros) or shorter wavelength ranges.

MS=n
Forces the new scale to match that of a previously aligned image in buffer 'n'.

FLIP
will reverse the order of the dispersion by flipping it about the center of the image.

SILENT
Prevents printout of the new scale.
Examples:
ALIGN 3 DSP=5.75 W=6000,1
re-bins the row of image 3 into a linear wavelength scale with a linear dispersion of 5.75 Angstroms/pixel, and with 6000 Angstroms at pixel 1.

ALIGN 3 DSP=5.75 W=6000,1 SINC
Same as above, but sampling only at the center of each new pixel.

ALIGN 3 DSP=5.0 W=6000,5 LOG
Transform image 3 to a logarithmic wavelength scale in which the dispersion is 5.0 Angstroms/pixel at 6000 Angstroms. Pixel 5 corresponds to 6000 Angstroms.

ALIGN 1 DSP=8.0 W=(4300,1) Z=0.0035
Removes a redshift of 0.0035 from spectrum 1 and creates a final de-redshifted spectrum which has a dispersion of 8 Angstroms/pixel and begins at 4300 Angstroms in pixel 1.