Fitting Redshifted Lines in a Spectrum in EMSAO

Read Spectrum (EMFIT) (flow chart)

For each object spectrum file from the input list spectra, and/or each aperture specified in the aperture list specnum, the fitting subroutine, EMFIT, is called for the spectrum in the multispec band specbandspecdir. Full or relative pathnames may be used in spectra, and specdir may be null.

Sky Spectrum for Noise Calculations (EMFIT)

If skynum is not zero, a sky spectrum is read from that multispec aperture in the same file as specnum. If If skyband is not zero, a sky spectrum is read from that multispec band for the aperture specnum. The sky spectrum, use to get the noise for error computations, is plotted if obj_plot is yes.

Preprocess Spectrum (flow chart)

The spectrum is loaded--and renormalized, if renormalize is set to yes. If fixbad is yes, regions specified in the file named by badlines are replaced by straight lines. The spectrum is then smoothed nsmooth times. If obj_plot is yes, the spectrum is plotted and the plot is kept on the screen available for examining and editing until a q is typed.

Remove continuum for line search (ICSUBCON) (flow chart)

A continuum computed by the IRAF interactive curve fitting subroutine driven by the parameters set in contpars is subtracted from the spectrum. If contsub_plot is yes, the spectrum is plotted with the continuum removed.

Initial Redshift (EMFIT) (flow chart)

An initial redshift source may be specified by vel_init; if guess, this is from czguess. If search, one line in the spectrum is identified using the table specified by emsearch, which lists line centers in Angstroms and the wavelength range over which each one should be the strongest line. This table can be modified by the user to match a given dataset. If combination, the initial redshift velocity is read from the spectrum header parameter VELOCITY; if correlation,it is read from CZXC; and ifemission) from CZEM. If (linefit is no, all of the fitting below is skipped and the results are displayed.

Find Initial Redshift (EMGUESS)

If vel_init is search, EMFIND is used over each region in the search list specified by emsearch. The brightest line in each region is assumed to be the one in the table, and its observed wavelength is saved. The redshift of the brightest of those lines is returned as an initial value to be refined by looking at more lines.

Find Bright Emission Lines (EMFIND)

All emission lines within a specified wavelength region are found. A spectrum pixel is assumed to be a line center if the pixel value is the max of the npfit neighbors on either side, and greater than linesig times the square root of the average counts in those pixels. A second order fit is then made to the (2*npfit)+1 points centered on the peak to refine the center and peak height.

Find All Emission Lines (EMSRCH) (flow chart)

Search regions in the list specified by emlines are shifted by the redshift specified above and expanded in each direction by wspan Angstroms.

Find Emission Lines (EMFIND)

All emission lines within a specified wavelength region are found using the criteria specified above.

Keep Brightest Emission Lines (EMSRCH)

The brightest line in each region is kept unless it has already been identified. Order matters--the brightest line in a region should be listed first, so that if it is the only one present in overlapping regions, it is correctly named.

Smooth Spectrum for Line Fit (EMFIT) (flow chart)

A copy of the spectrum is smoothed esmooth times. esmooth should be left at zero unless the data is especially noisy. It is best never to go above 2.

Remove Continuum for Line Fit (ICSUBCON)

The continuum is removed from the newly smoothed copy of the spectrum using the same parameters as above.

Fit Emission Lines (EMLFIT) (flow chart)

Check each identified line to see if it is part of one of the groups of close emission lines listed in the file specified by emcombine. If it is, all lines in the combination will be simultaneously fit. Those members of a line combination which are not found are initialized at the redshift of the most recently found line of the group with a height proportional to the most recently found line according to the relative heights in the emcombine file. The lines are fit by one to three Gaussians, along with an optional local continuum level using none to three additional coefficients as set by nlcont. Redshift (computed from the wavelength of the center pixel coordinate), width, height, and errors are returned for each line.

Fit Single Velocity (EMVFIT) (flow chart)

Each emission line is checked to see whether: The number of the first test a line fails is given after an X in report_mode=1 output. If a Gaussian has been fitted (i.e., not in 1 and 7), however, all of these rejection criteria can be overridden interactively using the + and - commands in cursor mode from the summary display, if curmode = 1, If report_mode = 1 and verbose is yes, or wavelengths and redshifts are printed for each line, with an X followed by the rejection code at the end of entries which were omitted from the fit. If a line has been added or subtracted in cursor mode, a + or - at the end of the entry indicates that fact. If dispmode = 1, the same information is printed on the summary display. A mean emission line velocity is computed, weighted by the square of the error in the line centers and returned.

Adjust Combined Velocity and Error (EMFIT)

After all of the lines have been fit and a combined velocity has been computed, A zero-point redshift is computed by adding the solar system barycentric velocity correction, from a source specified by svel_corr. If only a single line is found, the error is set to sigline, which should be set to the uncertainty in the dispersion function in Angstroms. This is usually significantly greater that the error in the fit to the center of the Gaussian.

Combine Emission and Cross-Correlation Velocities (VCOMBINE)

If there is only an emission line velocity for this spectrum, it becomes the final velocity, and the final velocity error is based on the emission error. If there is only a cross-correlation velocity, that becomes the final velocity and the final velocity error is based on the correlation 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.

Print Results (EMFIT) (flow chart)

The results are displayed as text to the devices specified by logfiles in the format specified by report_mode. Options include 1) one line per found emission line under a self-documenting summary, 2) a single line report listing the lines which are found, and 3) a single line report listing a velocity for each searched-for line.

Display Results Graphically (EMPLOT) (flow chart)

If displot is yes, the spectrum is plotted to device in the format specified by dispmode. If hardcopy is yes, the same graph is sent to plotter.

If nsmooth greater than zero, the displayed spectrum is smoothed by a 1-2-1 sliding filter that many times. Absorption lines listed in the file ablines are labelled if dispabs=yes Emission lines listed in the file emlines are labeled (dispem=yes) Both files are found 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, identify lines and refit the emission lines, change the display format, edit the spectrum, or several other functions.

Save Results in Image Header (EMFIT) (flow chart)

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

[rvsao] [emsao] [emsao Flow Diagram]


Last updated 13 December 2007 by Doug Mink

Telescope Data Center