ALIGN: Linearize or Transform a Wavelength-Calibrated Spectrum



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:

Examples:
\begin{example}
\item[ALIGN 3 DSP=5.75 W=6000,1\hfill]{re-bins the row of image...
...on of 8 Angstroms/pixel and begins at 4300
Angstroms in pixel 1.}
\end{example}