Band tempband of each template spectrum in the list templates and list of multispec apertures, tempnum, is loaded. Template files are all read from the directory specified by tempdir, but full or relative pathnames may be used in templates, and tempdir may be null. If echelle is yes, tempnum is ignored, and the multispec lines used for templates track those used for object spectra. If temp_plot is yes, the template spectrum is plotted as shown in Figure xcsao2.
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, an optional template-dependent velocity shift from the TSHIFT parameter in the header, and an optional constant velocity shift from the tshift parameter, 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 guess, 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.
First, the continuum, and, optionally, emission lines, are removed from the rebinned object and template spectra. Parameters for fitting the continuum are in the IRAF pset task named contpars. The IRAF curve fitting subroutines fit 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. The continuum may be fit interactively by setting c_interactive to yes, in which case, a plot such as those in Figure xcsao3 is displayed.
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. A graph, as shown in Figure xcsao4, of the continuum-removed data is displayed if the contsub_plot parameter is yes.
The continuum is also subtracted from the template spectra 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.
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 as shown in Figure xcsao5 if the apodize_plot parameter is yes.
The spectra are then Fourier transformed. The Fourier power spectra of the object and template spectra are displayed as in Figures xcsao6 and xcsao7 if fft_plot is set to yes.
The transformed spectra are then filtered with a cosine-bell filter. 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. If tfft_plot is set to yes, the filtered Fourier power spectra of the object and template spectra are displayed as in Figures xmsao8 and xcsao9.
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 as in Figure xcsao10, and a specific peak may be selected using the cursor if curmode is yes. In that case, 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.
After all of the template spectra have been correlated against an object spectrum, the template with the highest R-value is selected. The results are displayed as text to the devices specified by logfiles in the format specified by report_mode. Figure xcsao11 shows the default report.
IRAF rvsao.xcsao 2.0b mink@cfa0 21-Oct-1997 16:17 1995.1122.0113.311.062165.ms Object: 311.062165 RA: 08:13:29.34 Dec: 29:02:12.0 $.1f23-Nov-1995 10:37:37.00 =HJD2450044.9457 BCV: 25.30 3679.9A- 7551.7A 4096x2 points, filter: 5 20 125 250 apodize 0.05 fit 0.5 best 2 Temp: fabtemp97 vel: 0.00 tsh: 0.00 HCV: 0.00 Peak: 14415.2 h:0.223 R: 2.88 CZ: 14441.7 +/- 71.592 1 +tc Temp: femtemp97 vel: 0.00 tsh: 0.00 HCV: 0.00 Peak: 14369.4 h:0.891 R: 16.38 CZ: 14395.9 +/- 7.898 1 +hi -tf +tcFigure xcsao11. Report of results of cross correlation of a spectrum against absorption and emission templates.
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.
If displot is yes, the spectrum and, optionally, the selected correlation peak, are plotted to device in the format specified by dispmode. Figure xcsao12 shows the summary graph if dispmode is 1. Figure xcsao11 shows the dispmode 2 summary graph, with emission and absorption lines labelled. 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, as shown in Figure xcsao13.
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. For example, figure xcsao14 shows the correlation result for the second best template, selected using the T cursor command.
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, as in Figure xcsao15
VELOCITY= 14387.9287199659 CZERR = 16.4555476849055 VELQUAL = '_ ' BCV = 0. CZXC = 14395.9304076156 CZXCERR = 7.8982947339756 CZXCR = 16.3766072577413 BESTTEMP= 'femtemp97' CZPARAMS= '2 4096 2 5 20 125 250 0.05' XCTEMP1 = 'fabtemp97 14441.680 71.592 2.87811 0.223 367.772 0.000 0.000 0 0' XCTEMP2 = 'femtemp97 14395.930 7.898 16.3766 0.891 183.427 0.000 0.000 0 3' XCSAO = 'rvsao.xcsao 2.0b 21-Oct-1997 16:33 CZXC = 14395.93 R = 16.38'Figure xcsao15. Header parameters added by xcsao.