Next: Useful recipes
Up: Gauss-A Figaro program for interactive Gaussian fitting
Previous: Introduction
Running the program
`gauss' requires an input spectrum in which the data points are
equally spaced in wavelength. If you supply a spectrum with
unequally spaced points it will abort with an error message. A
spectrum with unequally spaced points can be converted to one with
equally spaced points using Figaro command `scrunch' (see
Section
).
Before running `gauss' make sure that a soft and a hard plot device
have been allocated using the Figaro commands `soft' and `hard'.
These are required for graphics (although use of the `hard' device is
not mandatory). The program will fail if `soft' has not been
specified.
The program will prompt for the following:
- Name of spectrum file
Name of spectrum file to be fitted. Must be 1-d. If no errors are
available (.VARIANCE) then a message is written to the terminal to
this effect and the goodness of fit will be in terms of rms only.
If `soft' and `hard' have not been set, then the program will
terminate at this point.
- Label for plot
Label written to top of soft and hard plot, and recorded in the
results data file.
- Are Gaussian fit results to be recorded on a file
If `yes' then name of file is prompted for. If `no' results will be
written to terminal only.
- Name of data file for results
This is the name of the data file (.dat) to which results are
written. If a file of this name already exists then the results are
simply appended to this file. If not, then a new file of this name is
created.
- Use whole of spectrum for line analysis
If `yes' then all the spectrum is displayed. If `no' the `xstart' and
`xend' of the region to be displayed is prompted for (cf. `splot').
- Scale so all of spectrum fits
If `yes' then whole Y extent plotted. If not `high', `low' and `bias'
are prompted for (cf. `splot').
The spectrum is then plotted on the soft device in the lower box. If
errors are available, then these are displayed in the upper box. The
upper box is used for residuals on line and continuum fit. The scalar
for the residuals indicates the ratio between the range of spectrum
data to the range of residuals data, i.e. smaller errors and
residuals have a larger scalar on the residuals box.
The continuum fitting menu next appears. The line or lines are
demarcated from the continuum using the cursor, the parameters of the
polynomial fitting set, and the fit performed. When satisfactory the
fit and residuals are plotted ready for Gaussian fitting.
The options are as follows:
- CUR: Use the cursor to indicate the left and right edges of one or
more regions of continuum. There is no limit to the number of
continuum regions that can be so demarcated. Usually these regions
will bracket the lines of interest.
- ORD: Order of polynomial fit to continuum points.
- SIG: Factor times sigma on last continuum fit such that points
whose deviation from the last fit exceed this value are not used for
the subsequent fits.
- ERR: Factor times the individual error on a point such that a
point whose deviation from the last fit exceeds this value is not
used in subsequent fits (only usable if errors are available)
- ITN: Number of iterations performed for rejecting points with
deviations exceeding the rejection value
- FIT: Apply the polynomial fit specified by ORD,ITN and SIG/ERR to
the continuum. (CUR must have been set for this to occur.) If ORD,
SIG, ERR, or ITN have not been set then the default values are 3,
2.0, 1.0, and 1 respectively. For each iteration, the iteration
number, the rms on the fit for each order (up to a maximum of 7), the
number of rejected points and the number of fitted points are printed
to the terminal (cf.
`abline').
In the case when errors are available,
the mean value of the deviation as a factor times the actual error
bar is printed out as a function of the order. The aim is to take the
lowest order and minimum number of iterations so that the rms (or
mean fractional error) and number of rejected points level out. The
values of SIG/ERR, ORD and ITN can be altered until this condition is
achieved. The continuum fit highest order, highest iteration number
fit is plotted on the `soft' device from the left edge of the left
section to the right edge of the right section. The residuals on the
continuum fit appear in the residuals box over the extent of the
fitted continuum (excluding the line(s)).
- GAU: Continuum fitting complete; move to GAUssian fitting.
The Gaussian fitting menu now appears. The line or lines are
simulated by one or more Gaussians.
The options are as follows:
- LIM: Left and right edges of observed profile to be fitted are
indicated by the cursor. If this option is omitted the profile edges
are taken as the nearest edges of the continuum sections, and a
warning to this effect is issued.
- SIN: Fit a single Gaussian to a profile. This is a quick way to fit a
line by a single Gaussian involving minimum user interaction. With
the cursor the peak position of the line is indicated. The peak
height of this line is found and the half height points taken to get
the line width. These initial values are then used to optimise the
fit. If the fit is successful then the results-peak
position, peak
height, sigma (= FWHM/2.3540), flux in the line, equivalent width of
the line and the rms deviation on the fit (mean deviation in terms of
the error bars if errors are available) are written to the screen and
to the data file if appropriate. See OPT below for details of what
happens if the optimisation fails.
- NEW: Introduce a Gaussian at a cursor defined position, of height the
same as the data value and width 4 X channels.
- NEX: Introduce another Gaussian to a profile where one or more
Gaussians have been fitted. A new Gaussian is introduced at the peak
of the residuals (observed - fitted). This can have
negative height
(absorption line) in an emission profile, or vice versa, if residuals
are small, so watch out. At any time at most ten Gaussian lines can
be kept, an attempt to specify more lines is rejected.
- INCH: Interactively alter the position, height or width of a
Gaussian. The latest Gaussian introduced, or the one SELected (see
below) is changed thus:
- P: position
- H: height; followed by a number to give additive modification
- W: width
- S: stop the alteration
For example: `P100' shifts a Gaussian right by the profile extent;
`H-20' decreases the Gaussian height by 20% of the peak height of the
original line; W10 widens the line by 10% of the total profile
extent. At each change the old fit is erased and the new fit is
redrawn.
S stops the alteration and re-plots the whole display, including
residuals, on the latest fit. The rms (or mean fractional deviation
in terms of the error bars) on the fit is written to the terminal.
- LIS: Lists the fitting Gaussians in order of introduction, giving
position, height, sigma and flux (proportional to height x FWHM).
- SEL: Set index number to that of the Gaussian whose parameters are
to be modified. The list of fitting Gaussians is printed and
selection made.
- DEL: Set index number to that of the Gaussian which is to be deleted.
The list of fitting Gaussians is printed and selection made. The
display is redrawn and the new sum of fitting Gaussians and their
residuals are plotted.
- OPT: Optimises the fit. Any of the Gaussian
parameters-position, height or
width-can be constrained so that the value does not
change during the optimisation process. If such single constraints
are required then the index number of the Gaussian and the parameter
to be constrained are entered in response to the `npcon' prompt. Sets
of Gaussians can also be `chained' so that their values vary
together: for example the separation of two Gaussians can be kept
fixed when fitting a doublet with known separation. The index number
of the Gaussians, the parameter to be chained and relation between
the parameters is entered in reply to the `ichain', `chain' and
`rchain' prompts. Different sets of parameters can be chained, e.g. in a three Gaussian fit the positions of Gaussians 1 and 2 could be
chained and the relative heights of Gaussians 2 and 3. However if a
parameter of a Gaussian is already constrained it cannot be included
in a chain.
The form of weighting for the residuals are prompted. Three options are
available:
- a) no weighting (i.e. unit weights);
- b) weighting by signal value (without continuum subtraction);
- c) weighting by inverse square of errors (when available).
By employing weights more emphasis on points with either higher value
or lower errors can help to constrain the fit. Method c is analogous
to minimising chi-squared. Success cannot be guaranteed with the
minimisation routine. In particular if constraints or chaining are
employed then the optimisation can be more troublesome.
Usually a small change to the interactive fit will enable a minimum
to be found if a failure occurs. However don't expect miracles. The
algorithm only finds a local minimum. If you don't believe the fit,
try another interactive fit and optimise again. The general rule is
to try for a fit by a minimum number of Gaussians and to check that
the deviations on the line fit are greater than or equal to the error
bars, or the deviations on the continuum fit if errors not available.
If the optimisation is successful or the interactive fit is adopted,
then position of peak, peak height, sigma and flux in each fitting
Gaussian as well as the equivalent width on the whole profile and the
simple (i.e. unweighted) rms deviation on the fit (mean deviation in
terms of the error bars if errors are available) are written to the
terminal and recorded on the data file (if applicable). On the `soft'
display, the fitting Gaussians, their sum and the residuals on the
fit are displayed.
- REC: Recall a previous Gaussian fit to the profile. The name of the
data file on which the fit was recorded is prompted for. The
position, height and width of the recalled Gaussians, equivalent
width and rms/mean error on the fit are written to the terminal and
the individual Gaussians and their sum and residuals displayed. Any
of the individual lines can then be altered by SEL and INCH. If any
recalled line falls outside the line extent (which must have been set
previously) a warning is issued and the line ignored. There is no
safeguard against the case where more than ten lines are read from
the file. You have to take care that this does not happen, otherwise
the internal storage of `gauss' gets messed up in an unpredictable
way.
- HARD: Plot final fit on the specified hard-copy device. Produces a
file which needs to be sent to the appropriate printer.
- SAV: Save the continuum and Gaussian fit spectrum. The sum of the
Gaussian fit on the continuum is saved as a spectrum file. The name
of this file will be prompted for on quitting from the Gaussian
fitting menu.
- CON: Move on to next section of the spectrum for more line and
continuum fitting (returns to point where `xstart' and `xend' are
specified).
- QUIT: Quit from program (fit finished). If the fit is to be saved
then the name of the output spectrum is prompted for:
- Fitted spectrum to be saved
Name of 1-d spectrum file to be produced. Note that the continuum
on this spectrum only extends from the minimum to the maximum X values
delimited in the continuum fitting (CUR), but the range of the X values
is the same as that of the input spectrum.
Next: Useful recipes
Up: Gauss-A Figaro program for interactive Gaussian fitting
Previous: Introduction
FIGARO A general data reduction system
Starlink User Note 86
Keith Shortridge, Horst Meyerdierks,
Malcolm Currie, Martin Clayton, Jon Lockley,
Anne Charles, Clive Davenhall,
Mark Taylor, Tim Ash, Tim Wilkins, Dave Axon,
John Palmer, Anthony Holloway and
Vito Graffagnino
2004 February 17
E-mail:starlink@jiscmail.ac.uk
Copyright © 2013 Science and Technology Facilities Council