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: 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

Bugs

See Also

identify reidentify fitcoords transform mktracer ydistcor
The cl script xdistcor.cl
The package wmkonspec