ISAP Line fitting module
Overview:
This module has three basic functions: it allows you to fit models to your
flux continuum and spectral line data and reports the salient results;
it allows you to replot your data on a velocity axis with respect to a
given rest wavelength; and it will assist you in identifying spectral lines.
If your source velocity (V_helio) is significantly different from 0
km/s, we recommend entering the source velocity as your first action upon
entering this module. (The three functions above will provide more useful
information if the source velocity is entered.)
Three warnings: 1) We recommend averaging your data prior to entering
this module: unaveraged data may have spurious points that can throwoff
the convergence of fits. 2) If you have SWS data, or any other data in
the units of Jy, use the Special Functions button "Change Units" and convert
your fluxes to W/cm^2/um. (Future versions of Line Fit will accept Jy.
3) If you have LWS FP data, we recommend that you first use the "arithm"
routine to divide your spectrum by the resolution element of the LWS (in
microns), which may be found in the LWS User's Manual. This will put your
data into flux density units (W/cm^2/um) although it will not change the
label, which are units that are natural to the module. (The module also
accepts flux density in Jys as from SWS.)
Note: there is a message subwindow at the bottom of this window, and
when fits do not converge, etc., there will be a message there saying why.
In fitting lines, you may choose one of the two fitting method:
Gaussian (also multiple components) or Lorentzian. you may follow one of
three paths: The first path is the "composite fit," where you fit the Gaussian
line and polynomial baseline simultaneously. The second possible path is
"twostep baseline and Gaussian or Lorentzian fit," where you first identify
baselines regions for the fit and remove (subtract) a polynomial baseline
from the data, and then you identify line(s) region and fit a desired
profile to this. The third path, "twostep baseline and moment fit" is
much like the second, but here, after removing the baseline, you determine
the "moments" of the data. The details of these operations are discussed
below.
Setting Source Velocity:
Redshift:
This subwindow allows you to set a v_helio velocity, or specify a source
redshift, z (z = V_helio / c).
The redshift law used in this module is always the nonrelativistic
optical definition of redshift:
lambda_shifted = lambda_rest x (1 + V_helio/c),
and likewise:
lambda_shifted = lambda_rest x (1 + z)
The source velocity is used in many places in this module. When a fit
is performed, any cataloged lines found within 1 HPBW of the fitted line
center in the source's velocity frame are reported. The nearest is referred
to as the "identified line." The velocity associated with the line's fitted
center (with respect to the rest wavelength of the identified line) is
also reported. When the user plots the data against heliocentric velocity
(the "Plot in Vspace" option) the velocities shown on the xaxis are velocities
with respect to the rest wavelength of the identified line. The identified
line wavelength is indicated on the wavelength plots with a pointer and
a label. The wavelength pointed to is the redshifted wavelength using the
entered source velocity.
When velocities are reported, they are always computed using the law:
V = c x (lambda  lambda_rest) / lambda_rest
no matter how large the velocity. Note that the ISO satellite always
reports wavelengths in the V_helio frame.
Three Methods of Fitting the Continuum and Line:
1) The Composite Fit: Here a polynomial baseline and a Gaussian
line are fitted simultaneously to the data. The advantage of the composite
fit is that no assumptions are made as to where the line ends and the baseline
begins. For this reason more data points are used for each component than
would available were the dataset separated, and so the results are more
accurate.
The steps in this mode are :

Select the "Order of Baseline Fit" for
the polynomial baseline fit. Using order 0 or order 1 for the Baseline
is strongly recommended. Higher order baselines tend to not be separable
from the Gaussian component, and the fits will usually not converge.

Select region for Composite Fit : When this button is set, any subsequent
right mouse selection of spectrum will be used for the composite fit. If
the button is not set, or no right mouse selection is made, then the whole
input spectrum will be used in the fit (which is often the fastest method).

Method of Fit : You must have selected the
Gaussian (single line) option or an error message will result.

Line Parameters : you may chose to fix
any of the three Gaussian line parameters (height, width, and center) and
thus exclude them as free parameters in the fit.

Fit Baseline and Line (Composite Fit) : The actual fit is done when
this button is set. The window containing Line
Fit Results pop up if the fit is successful and convergence achieved.
How the method works: An initial baseline guess (zeroeth or first
order only) is made from the endpoints of the data set, and this function
is subtracted from the data to guess the Gaussian line parameters. The
Gaussian height and center are guessed from the extreme data point (negative
or positive flux) and the lambda variance with respect to this guessed
center provides a guess for the width. A modified interactive IDL curvefit
routine, equipped with the parameter partial derivatives is set to work
on the original data to perform a gradient search on the chisquare of
the fit. Convergence is determined by a nonchanging chisquare and uncertainties
are determined from the product of the central diagonal of the covariance
matrix of the parameters and the reduced chisquare. The data are not weighted
by their own standard deviations as these are often unreliable.
2) TwoStep Baseline and Line Fit: Here the user specifies baseline
regions, fits and removes the baseline, then specifies a line region
, and fits a Gaussian or Lorentzian to this, or select multi Gaussian
fit menu to identify and fit multiple regions The advantages to this method
are that the user may avoid poor segments of the baseline in the fit, and
may judge the results of baseline fitting before removing it and proceeding.
If the user wants to fit a single or multiple lines in this two step
method, the user must remove the baseline fit from the data. The user also
records the baseline fit, and it is remembered by the module so that the
user may overplot the data, baseline fit and line fit when finished. The
user may also look back at the line fit reports or write them to disk.
The first step of this method is baseline removal. Note, if this
step is skipped, then when the user subsequently fits a line (Gaussian
, Lorentzian, or Moment), the routine will consider any underlying continuum
as part of the line shape. The steps are:

Select Baseline region(s) : when this
button is set, the plot works in the "Baseline selection mode", which means
that all successive rightmouse selections are recorded for further baseline
fit. If none is selected the baseline is fitted on the whole spectrum.

Reset selection : to start the selection from scratch (ignores all
the previous selections).

Order of Baseline Fit : choose the order
of the polynomial fit :

Fit Baseline : The baseline fit is performed when this button is
set. The fitted baseline is plotted over the input spectrum, and a window
popsup showing the Baseline Fit Report. At this point, you have an option
either to Cancel the fit and try another one, or Record or Remove/Record
the current fit and go on to the Line Fit.
After performing the baseline fit, "Select Line Region" is automatically
set, which means that all subsequent rightmouse selections will be used
to select line range and identify possible lines in this wavelength from
the line database.
The second set of the method is line fitting:

Select region for Line Fit : when this is set then any subsequent
right mouse selection of spectrum will be used for line fit. If none is
selected then the whole spectrum will be used.

Order of Baseline Fit : choose the order
of the polynomial fit :

Method of Fit : choose the Gaussian
or Lorentzian Fit for single line, Multi Gaussian for multiple lines, or
Moment.

Line Parameters : choose the line parameters
to hold frozen (if any); note that a dedicated widget for initial fit parameters
will popup if the multiple gaussian line fit option is chosen.

Fit Line : The actual fit is done when this button is set. The window
containing Line Fit Results will popup
if the fit is successful and convergence is achieved.
When fit is done, the baseline fit (green) and line fit (blue) are overplotted
on the spectrum and the line residual is shown in red. A plot with the
residual absent may be acquired by pressing the Replot Line and Fit button.
The plot is also labeled with the nearest line in the source velocity frame
found in line database, but if one is found within 1 HPBW of the fitted
line center. The data range used for the line fit used marked with two
vertical cyan bars. The results of the line fit are displayed in a popup
window.

lines parameters (height, width, center and flux) and their errors, equivalent
width.

Note  the equivalent width is determined from the formula: EW = integral
{ (feature  continuum) / continuum } where the feature is comprised
of the data points (line and continuum), and the continuum is the point
by point baseline fit, taken from plus to minus 5sigma from the line center.

baseline flux density w.r.t line center, Mean baseline flux density in
Jy, RMS, SNR.

Delta V_helio w.r.t nearest line found

list of existing element or molecules who emits inside this line width,
if a redshift is given, it is taken into account before extracting this
list.
The user can then Record these parameters into Line
Fit Results or Cancel and try to fix some parameters or select
a new range.
Note that when the multiple gaussian option is chosen, an additional
possibility is offered: a set of lines (2 up to 8) can be fitted keeping
the distance between line centers fixed. This mode can be activated pressing
the 'yes' button at the option 'Bounded Gaussians'. In this case, the linecenters
for the selected number of gaussians will be held to a fixed distance from
the linecenter of the first gaussian and the whole pattern can float as
a whole during the fitting procedure. IMPORTANT: when this option is
active, the numbers given in input in the 'linecenter' text field of the
mutigaussian widget, which normally are the absolute linecenter values,
will instead hold the distance of the linecenters with respect to the first
gaussian (in microns). If this option is selected, the errors on the
linecenters of the multiple gaussians will be equal to the error on the
linecenter determination of the first gaussian.
Main Functions :
Input Options :
Spectrum Region(s) of Interest:
All selections are done by pressing the right mouse button.
Plot Buttons
Line Fit Output:
Line Fit Additional Buttons:

Help : this html

Exit : quit Line Fit window and save current AAR

Quit : quit Line Fit window
WARNINGS : Crazy fits
The selection is not large (short) enough. You need to select
a range for which your line highest inside the plot
Wrong line shape . If the fit you choose does not correspond
to your line you may have a fit completely different from the signal, for
instance sinus pattern is often much too thin for LWS emission lines. Fit
simple line with blended pattern does not give good result anymore.
Wrong fixed parameters . If you fix a line wavelength outside
your plot, it will NOT be taken into account.
Wrong baseline . If you fit a baseline without selecting baseline
parts, the whole spectra is used which may give unusable baseline for faint
lines.
Noise . It is not possible for the moment to fit correctly nor
simply a faint line merged with noise or fringes. The better solution is
to fix all known parameters (wavelength and width), then select a small
part around the line, select inside part corresponding to the baseline
and fit a very curved one (poly 2 or 3), then fit your line and hope.
Fit Parameters :

Baseline Polynomial :

poly 0 : Baseline fit is constant.

poly 1 : Baseline fit is linear.

poly 2 : Baseline fit is a 2 degree polynomial.

poly 3 : Baseline fit is a 3 degree polynomial.

Line fit method :

Gauss (single line) : line is fitted with a gauss function (like IDL
routine Gaussfit)
flux = exp(((wavelength  line_center)/line_width)^2/2) * line_height
+ a0 + a1*wavelength + a2*wavelength^2 + a3*wavelength^3
where a0, a1, a2, a3 are the baseline coefficients. For noncomposite
fits, these parameters are set to zero.

Lorentzian (single line) : line is fitted with a Lorentzian function.
Note that this method does not allow the baseline fit and line fit
together as in Gaussian method.
flux = (1. /(1. + 0.5 * (wavelength  line_center)/line_width)^2
) ) * line_height

Moment : Statistical Parameters on selected line region

Line Parameters : Single Lines have 3 parameters
:

line height (flux) can be set writing it manually
in "Fix/Free Line Height" text window.

line position (wavelength) can be set writing it
manually in "Fix/Free wavelength" text window.
Wavelengths are fitted if 0, or outside plot window current range.

Full Width Half Max (FWHM) can be set by selecting
the following buttons in "Fix/free line width" .

LWS : Line Fit will compute the value of FWHM for LWS as follows:

For AOT 1,2 det 0  4 , FWHM = 0.29

For AOT 1,2 det 5  9 , FWHM = 0.6

For AOT 3,4 (FP) table look up

SWS : Line Fit will compute the value of FWHM from the calibration file
"cal19.fits". The program computes the mean AAR data point of selected
range, obtains aot band, speed, name and aotname, finds the entries in
cal19 using these parameters, and interpolates the value of FWHM for the
given wavelength.

Free : reset to zero (width will be fitted). Default

Enter : Type the FWHM value in the text window
The gaussian width is = FWHM/2.354
The Lorentzian width is = FWHM/2.*sqrt(2.)
Line Database Access:

Show Linelist : when this button is set, all entries of the Line list
database are displayed (as non exclusive toggle buttons) with both rest
and shifted wavelengths. If the line is already fitted, the button containing
the nearest line will be selected upon entering into this window. The user
has a choice to select/ deselect, select similar species, plot and write
the selected entries to disk file.

Show Cataloged Lines in region : when this
mode is set, you can select a wavelength range (right mouse selection),
then a window appears with the list of existing lines inside the range
(corrected with redshift on wavelength : Velocity window)
Line database :
The database currently records a list of about 800 lines. Each line
is defined by a wavelength (in microns), an element or molecule formula,
a transition name (when available) and a precision (not currently used).
It has been created merging three lists available from MPE web server (http://www.mpegarching.mpg.de/iso/linelists/index.html)

HI, DI and HeII Lines : 1196 microns (Peter van Hoof)

FineStructure Lines : 2205 microns (D.Lutz)

Selected Molecular Lines : 53186 microns (compiled by E.F. van Dishoeck)

Unidentified Lines/Bands. (refer to http://www. ipac.caltech.edu/iso/lws/unidentified.html)
Warnings :
The database is not complete, it contains only the most frequently
observed molecules or elements. Moreover, possible lines from sources with
very high redshift may not be recorded as we limit the list to the ISO
range. People who are looking for specific elements (or who observe sources
with high redshift) are kindly requested to use their own line list. Some
are available at ISO centers e.g. (http://www.mpegarching.mpg.de/iso/linelists/index.html).
Line Fit Output:

Line Fit Results: Recorded lines are
stored inside a report handled by 3 buttons :

show recorded lines : display a window with the list of lines and their
parameters,

print recorded lines : print the list of recorded lines (same format
and as show button) on a file,

clean recorded lines : erase all recorded information.

Write Ascii Fit: writes the (wave, flux) values
of the latest fit to a disk file.
Line Fit specific plots buttons:

Set Plotstyle: choose Line style, Color, Symbol, Error bars, Masked
data, Linear/log

Plot in VSpace : Plot the latest fit in Vspace w.r.t Rest Wavelength
of nearest line

Reset original data : Replots original AAR spectrum and deletes all
baseline selections

Replot original data and fit : Replots original spectrum, overplot the
last recorded baseline, line fit, and write the nearest line name.

Replot fitted data : plots spectrum from working AAR (may be original,
or baseline removed, or /baseline & line removed)
GUI Buttons
ISAP Home Page
Last update: 03December1999