xdistcor

xdistcor.cl

Name

xdistcor -- remove 'x' (column) distortion from NIRSPEC low-d images

Usage

xdistcor input output ref
    

Parameters

input
List of images to be corrected
output
List of corresponding names for corrected output images
ref
Name of the reference image to use for defining the ends of the spectrum
verbose = yes
Print feedback on operations to the terminal?
useold = yes
If a solution for the reference image already exists, use it rather than define a new one?

Description

This procedure is used to remove the row distortion inherent in NIRSPEC low-dispersion 2-D spectra, a correction that is required for subsequent alignment of night sky lines via the ydistcor task. Before running this program, you should generate an image which can be used to define the "trace" of the spectrum. Here are two ways to do this:
  • Create an image with strong spectra at several place along the slit, perhaps by co-adding images of your target (if it's bright) or of standard stars (assuming the spectrograph was not moved in between your science images and the calibration star images).
  • If you have a flat image taken with the same instrumental setup as your science images, use the task mktracer to generate a trace image from the flat; e.g.
    mktracer 24des0057 trace
The task will first check whether the database directory already contains a transform solution for your trace image (specified as parameter ref). If so, you will be prompted whether to use this existing solution to correct the images, or derive a new solution. If no transform solution is found, the program will proceed with deriving a new one.

If a solution is to be derived, the program will first invoke the identify task and allow the user to mark features to be traced. Mark the two (or more, if you used a stellar trace image) peaks by placing the cursor on them, pressing the m key, and pressing the Enter key when prompted for a wavelength of the feature. The resulting plot should look like this.

Press f to perform a fit to the two points, then q twice to quit this step.

xdistcor will now try to re-identify the features you marked at other rows along the image. If you specified verbose=yes when you ran the program, you will see the results of the fit. Check that all of your features were found in other rows.

Next, the program will try to make a fit to the data in order to derive the coordinate tranformation required to straighten the image. The program will prompt whether you want to perform a fit interactively; answer yes. It will show a plot of fit residuals; press x to change the x-axis plotting coordinate, then enter y to plot residuals versus row number, and press f again to redo the plot. The resulting plot may show some obvious outliers which you can delete manually by placing the cursor on them, pressing d and then p to nuke the offending point. When outliers have been excised, press f to redo the fit. Delete additional outliers and re-do the fit as needed. Press q to quit the fitting, and press Enter when prompted

Write coordinate map to the database
      (yes)?

With the transformation now defined, the program will proceed to remove the x distortion from all of your images.

If you included the reference image among those to be corrected, you should inspect the resulting corrected reference image to ensure that the spectra are now well aligned with the image columns.

Examples

The user has already use the mktracer task to create a reference image called trace.fits. Given a list of the input images (in.lst) and output images (out.lst), the following command will generate corrected images:
xdistcor @in.lst @out.lst trace
The corrected version of the trace image will be ctrace.fits.

Notes

  • User must have write access to the working directory.
  • Numerous temporary files will be generated in the working director. These are removed on successful completion.

Bugs

See Also

identify reidentify fitcoords transform mktracer ydistcor
The cl script xdistcor.cl
The package wmkonspec
Last modified: 07/13/2017 02:41
Send questions or comments to:NIRSPEC Support

The information on this page is the property of the W. M. Keck Observatory. The contents of this page or any part thereof shall not be copied or otherwise reproduced or transferred to other documents or used or disclosed to others for any purpose other than observing support at the W. M. Keck Observatory and the subsequent analysis and publication of scientific data obtained from observations conducted at the W. M. Keck Observatory. All rights reserved. © W. M. Keck Observatory.