Cross-Correlating a Spectrum in rvsao.xcsao

  • Preprocess Spectra
  • Set up Template
  • Compute Velocity Zero Point
  • Remove Continuum
  • Fourier Transform and Filter
  • Cross-Correlate
  • Report Results
  • Display Results Graphically
  • Save Results

    Preprocess Spectra (XCFIT subroutine)

    For each object spectrum file from the input list spectra, and/or each aperture specified in the aperture list specnum, the fitting subroutine, XCFIT, is called. If more than one band is present in a spectrum, specband specifies the band to be read. Each spectrum file is read from the directory specified by specdir, unless a full pathname is specified in spectra. Relative pathnames may be used in the elements of spectra. Pathnames are relative to the current working directory if specdir is null. Each spectrum is loaded--and renormalized, if renormalize is set to yes--and plotted if obj_plot is yes. If fixbad is yes, regions specified in the file named by badlines are replaced by straight lines.

    Set up Template (XCFIT subroutine)

    Each template in the template list templates and/or specified 2-D or multispec aperture tempnum is loaded. tempband specifies the band to be read. Each template file is read from the directory specified by tempdir, unless a full pathname is specified in templates. Relative pathnames may be used in the elements of templates. Pathnames are relative to the current working directory if tempdir is null. If echelle is yes, tempnum is ignored, and the multispec lines specified by specnum are used for templates, tracking those used for object spectra.

    Compute Velocity Zero Point (XCFIT subroutine)

    A zero-point redshift is computed by adding the solar system barycentric velocity correction, from a source specified by svel_corr, the redshift of the template from the VELOCITY parameter in the template header, a template-dependent velocity shift from the TSHIFT parameter in the header, and a constant velocity shift, tshift, and subtracting the barycentric velocity correction for the template, from a source specified by tvel_corr.

    An initial redshift source may be specified by vel_init; if , this is from czguess; otherwise, if not zero it can be read from an object spectrum header parameter VELOCITY (combination), CZXC (correlation), or CZEM (emission). If such an initial redshift has been called for, or if this is the second pass or greater (nzpass &> 1), the template log-wavelength limits are shifted by that initial redshift (on the first pass)or the current correlation redshift. The wavelength region over which the template and object spectra overlap is computed. If the wavelength in Angstroms specified by st_lambda, is greater than the blue limit of the overlap region, it becomes the new limit. If the wavelength in Angstroms specified by end_lambda, is less than the red limit of the overlap region, it becomes the new limit. The two spectra are rebinned into log-wavelength with a number of pixels, set by ncols using an interpolation mode specified by interp_mode.

    Process Spectrum/Template Pair (XCORFIT subroutine)

    First, the continuum, and, optionally, emission lines, are removed from the rebinned object and template spectra.

    Remove Continuum (ICSUBCON subroutine)

    The IRAF curve fitting subroutines may be used interactively by setting c_interactive to yes. A function specified by c_function of order order is used to fit the portion of the spectra specified by sample, averaged in groups of naverage pixels. Points outside of limits s_low_reject and s_high_reject, specified in standard deviations of the fit, are eliminated through niterate iterations, with grow pixels rejected on each side of the rejected point. For templates, the rejection limits are t_low_reject and t_high_reject.

    Replace Lines with Continuum (ICSUBCON subroutine)

    Emission and/or absorption lines may be removed from either or both of each spectrum-template pair. s_emchop controls whether lines will be removed from the object spectrum. If the template header parameter SUBCONT is present, its value overrides that of s_emchop. s_absrej and s_emrej set the lower and upper acceptable limits for object spectrum pixels to be used in the continuum fit.

    t_absrej and t_emrej set the lower and upper acceptable limits for template pixels to be used in the continuum fit to the template if t_emchop is set to yes. A graph of the continuum-removed, apodized data is displayed if the contsub_plot parameter is yes.

    Apodize (XCORFIT subroutine)

    Both spectra are then apodized, tapered at each end for the fraction bell_window of the entire spectrum. If zeropad is yes, the template and object spectra are padded with an equal length of null (zero) spectrum to reduce noise in the Fourier transform. A graph of the continuum-removed, apodized data is displayed if the apodize_plot parameter is yes.

    Fourier Transform and Filter (XCORFIT subroutine)

    The transformed object and template spectra are then filtered with a cosine-bell filter where the low frequencies are filtered from low_bin to top_low and the high frequencies are filtered from top_nrun to nrun. The template header parameter FI-FLAG controls whether the template transform is filtered and whether the high-frequency filter is turned off for both template and object transforms to leave in emission lines. The Fourier power spectra of the object and template spectra are displayed if fft_plot is set to yes. The filtered Fourier power spectra of the object and template spectra are displayed if tfft_plot is set to yes.

    Cross-Correlate (XCORFIT subroutine)

    The filtered transforms are then cross-correlated and normalized. If uxcor_plot is yes, the unfiltered correlation is displayed. If the xcor_plot parameter is yes, this result is displayed, and a specific peak may be selected. The maximum value within pksrch pixels of the cursor position is used. Otherwise, the highest correlation peak between the velocities minvel and maxvel is used. The redshift is calculated by fitting a parabola or similar function specified by pkmode to the portion of the peak above pkfrac of the maximum value of that peak. The R-value and error are computed, and control returns to XCFIT to set up the template for the next pass.

    Report Results (XCFIT subroutine)

    After all of the template spectra have been correlated against an object spectrum, the template with the highest R-value is selected. The are displayed as text to the devices specified by logfiles in the format specified by report_mode.

    Combine Emission and Cross-Correlation Velocities (VCOMBINE)

    If there is only a cross-correlation velocity for this spectrum, that becomes the final velocity and the final velocity error is based on the correlation error. If there is only an emission line velocity, it becomes the final velocity, and the final velocity error is based on the emission error. If both velocities are present and their difference squared divided by the sum of the squares of their errors is less than 8, the error is the two errors added in quadrature and the final velocity is the error-weighed sum of the velocities. If they differ and the correlation R-value is greater than 10 or it is greater than 4 and there are only one or two emission lines found, that velocity is used. Otherwise, the emission line velocity is used. In all cases, an assumed dispersion error of 15 km/sec added in quadrature to the final error value.

    Display Results Graphically (XCPLOT subroutine)

    If displot is yes, the spectrum and, optionally, the selected correlation peak, are plotted to device in the format specified by dispmode. If hardcopy is yes, the same graph is sent to plotter.

    If nsmooth is yes, the displayed spectrum is smoothed by a 1-2-1 sliding filter nsmooth times. The filtered cross-correlation with the best R-value is displayed centered on the redshift cvel (in km/sec) with a width in km/sec of dvel. If cvel is INDEF, the fit redshift is used; if dvel is INDEF, the width is set to 20 times the peak width. If the correlation is not displayed, absorption lines (ablines=yes) and/or emission lines (emlines=yes) may be labelled from line lists in the directory linedir.

    If curmode is yes, the user can interact with the display using the terminal cursor to zoom in on portions of the spectrum, rerun the cross-correlation, change the display format, edit the spectrum, or several other functions.

    Save Results in Image Header (XCFIT subroutine)

    If save_vel is yes, cross-correlation redshift results are written into the spectrum image header in a form appropriate to the spectrum format: two entries plus one per template if multispec; otherwise one, value per keyword.

    Last updated July 29, 1998 by Doug Mink dmink@cfa.harvard.edu

    Telescope Data Center [XCSAO]