HELP · SEE_ALSO

## NAME

woffsets -- Find wavelength offsets using a cross-correlation function.

## USAGE

`woffsets input1 wave input2 table tabstat`

## DESCRIPTION

This routine computes the wavelength offsets of two input spectra by cross-correlating the spectra. The spectra are divided into a user-specified number of equal size boxes, or regions. A separate offset is computed for each box. The correlation used in this task is the normalized mean and variance correlation given by the following equation:

TOTAL[ (x(i) - xmean) * (y(i - k) - ymean) ] corr(k) = ------------------------------------------------ SQRT(TOTAL[ (x(i) - xmean)**2 ]) * SQRT(TOTAL[ (y(i - k) - ymean)**2 ]) where: corr(k) - is the measure of correlation at offset k, x(i) - are the values in the first spectrum, xmean - is the mean value of X in the region being correlated, y(i) - are the values in the seconds spectrum, ymean - is the mean value of Y in the region being correlated, and TOTAL[ ... ] - is a sum over i.

The peak of the correlation function is located and computed to a sub-pixel precision using quadratic refinement (i.e., the offset is the position of the maximum of the quadratic through the peak value and its two neighbors).

## PARAMETERS

- input[file name]
- Name of the first GHRS spectral image. This image will normally be for a small science aperture spectrum. Valid lengths are 500, 1000, or 2000 data points (corresponding to no-substepping, half-stepping and quarter-stepping, respectively)

- wave [file name]
- Name of the wavelength image for corresponding to the images specified
by
`input1`.

- input[file name]
- Name of the second spectrum image. This image must have the same length
as the first spectrum,
`input1`. It will normally be a large science aperture spectrum, taken without carrousel motion, between the observations in`input1`and`input2`.

- table = "woffsets" [file name]
- Name of the output table produced by this task;
it will have the following columns:
'CARPOS' - Carrousel position (integer). 'ORDER' - Spectral order (this will be 1 for first order gratings) (integer). 'SAMPLE' - Photocathode sample position at the center of the region correlated (double). 'WAVELENGTH' - Wavelength at the center of the region correlated (double). 'DELTAS' - Offset in sample units (double). 'DELTAW' - Wavelength offset in line units (double). 'TOTAL1' - Total flux in first spectrum for the region (double). 'TOTAL2' - Total flux in the second spectrum for the region (double).

- tabstat = "write" [string, allowed values: write | append]
- Method used to store output results from this task. If
`tabstat`is set to "write", a new table will be created with the file name specified by the`table`parameter. If`tabstat`is set to "append", the results will be written to the end of an existing table.

- (nbox = 5) [integer, min=1, max=100]
- The number of equally-sized regions into which to divide the spectra. An offset is computed for each region.

- (maxdist = 10) [integer, min=1, max=100]
- The maximum distance---in data points---in which to
search for the correlation peak.
If the peak is found at the edge of the correlation image
(i.e., at
`maxdist`), it is assumed that the peak was not found and no entry for the box will be placed in the output table.

- (fwidth= 1) [integer, min=1, max=51]
- Optional mean filter width to apply to the first spectrum before
cross-correlation is performed. This parameter can be used
to match the resolutions of the
two spectra. This parameter must be passed an odd number. If an even
number is passed to
`fwidth1`, it will be incremented.

- (fwidth= 1) [integer, min=1, max=51]
- Optional mean filter width for the second input spectrum before cross-correlation is performed. This parameter requires an odd value and any even values passed to it will be incremented.

- (aperture= " ") [string]
- Three character aperture name for the first input spectrum.
If no value is specified for
`aperture1`, then the aperture name will be determined as ssa (small science aperture) or lsa (large science aperture) based on the substep bin ids.

- (aperture= " ") [string]
- Three character aperture name for the second input spectrum. If not supplied, it will be determined from the substep binids.

## EXAMPLES

1. Compute the offsets between spectra `ssa1` and `lsa1`. Smooth the
small science spectra with a mean filter of width of 7 to match the
large aperture data. Write the results in a new table called `off`.
The wavelengths image corresponding to `ssa1` is in the file
`wavessa1`.

hr> woffsets.fwidth1 = 7 hr> woffsets.table = "off" hr> woffsets ssa1 wavessa1 lsa1

2. Add the results for spectra images `ssa2` and `lsa2` to the same table.

cl> woffsets ssa2 wavessa2 lsa2 tabstat="append"

## BUGS

## REFERENCES

## HELP

For assistance using this or any other tasks, please contact help@stsci.edu or call the help desk at 410-338-1082.

## SEE ALSO

incidence