The spectral line fitting window allows you to measure the wavelength and equivalent width of emission or absorption lines and to fit various standard profiles to the lines.

The standard profiles offered are Gaussian, Lorentzian and Voigt, as well as a model independent intensity analysis measure.

**Background type:** Choose a type of background estimate to be subtracted from the spectrum
before fitting. The choices are **Constant** and **Polynomial**. If you have already subtracted the
background from the spectrum, or have applied a normalisation (so that the background is
flat, usually with a value of 1) then you need to choose **Constant** and provide a suitable
value. Otherwise choose **Polynomial** and select a spectrum from the list in **Background
fit**.

**Background fit**: For emission lines you would normally define a background spectrum
using the polynomial fitting tool. In this case select the **Polynomial** option and choose the
background spectrum you have created. Note that you can actually use any spectrum
from the global list as the background (so you are not restricted to what SPLAT-VO,
provides) but if you choose the same spectrum as is being measured then a background of
$0$ is
assumed.

The default background should be set to the first polynomial found on the global list.

**Use error as weights**: If your spectrum has associated error measurements then you can select this
checkbox to use the errors as weights in the fitting procedure.

**Coordinate ranges**: This table shows the upper and lower coordinate range for each line that you
want to measure.

To add a line to this list press the **Add** button. Now drag out a region on the plot display
area that encompasses the spectral line. You should now see a yellow rectangle over the
line:

Note that the rectangle is just defining a range, not an area, so you just need to worry about its width and position along the X axis, not its height.

To adjust the rectangle position select it and either drag it around, or use the grips on the exterior to
resize it. You can see the physical extent of the region in the **Coordinate ranges:** table. To set these to a
known value double click on the value you’d like to set, make the change, and then press `<Return>`

to
apply it.

The extents of lines can be saved to a simple text file and re-read. The format is simple. It should have two fields separated by whitespace or commas. Comments are indicated by lines starting with a hash (#) and are ignored.

**Types of fit:**

Once you have defined the extents of your spectral lines and chosen a background,
you can proceed to make the measurements you want. Just select the types of fit
you want from the list **Gaussian**, **Lorentzian** and **Voigt**. Note you can de-select all
these and just get a **Quick** measurement.

All types except **Quick** use a non-linear least squares (Levenberg-Marquardt)
minimisation stage to perform the actual fit of the model to the data (possibly with
weighting, if the spectrum has any error measurements). So it is necessary to have
some idea of the shape of the line, before attempting to fit it. This job is done by the
**Quick** fit, which is compulsory. The description of each of the types and what their
measurements represent is given below.

The error estimates are based on the variances produced by the fit. If you have errors for the data values, these will be used as weights and providing they are realistic the errors will be correct. In the absence of data errors the errors produced will be decided assuming that the fit is good (the chi-square statistic will be artificially forced to have a value of 1).

**Quick**: The default line measurement type. This is based on the ABLINE technique
described in the FIGARO documentation. This just uses an analysis of the intensities in the
selected region and the chosen background. The results you get are:

`ID`

, just a unique integer to label the line. This is the same for all fits.`Peak`

, the peak, background subtracted, intensity in the region. Negative for absorption lines.`Centre`

, the position of the median value*i.e.*that for which half of the total, background subtracted, area of the line, within the given region, lies to the left and right.`Width`

, width of the line. For a Gaussian this would be $\pm 1$ standard deviations wide.`Equiv`

, the equivalent width of the line. This will be $0$ if a zero background is given or assumed.`Flux`

, the background subtracted integrated intensity of the line over the selected region. Requires a linear coordinate step.`Asym`

, an asymmetry value for the line. This is a measure of the relative displacement of the centre of the line from the centre as measured by the upper and lower half widths.

**Gaussian**: The formula used for the Gaussian is:

$$y\left(r\right)=A\ast exp\left(-0.5\ast {\left(\frac{x-c}{\sigma}\right)}^{2}\right)$$

where $A$ is the scale height, $r$ is the distance from the centre, $c$ is the centre, $x$ the distance from the origin and $\sigma $ is the Gaussian sigma. The $y$ values are background subtracted.

The values measured for this line shape are:

`ID`

, integer identifier (same as other fits).`Peak`

, the Gaussian peak ($A$).`PeakErr`

, an estimate of the error.`Centre`

, the position of the Gaussian peak ($c$).`CentreErr`

, an estimate of the error.`Width`

, the Gaussian sigma ($\sigma $).`WidthErr`

, an estimate of the error.`FWHM`

, the full width of profile at half maximum.`FWHMErr`

, an estimate of the error.`Flux`

, the integrated flux of the Gaussian.`FluxErr`

, an estimate of the error.`Rms`

, the root mean square difference between the Gaussian and the line data.

**Lorentzian**: The formula used for the Lorentzian is:

$$y\left(r\right)=\frac{A}{1+0.5\ast {\left(\frac{x-c}{w}\right)}^{2}}$$

where $A$ is the scale height, $r$ is the distance from the centre, $c$ is the centre, $x$ the distance from the origin and $w$ the Lorentzian width. The $y$ values are background subtracted. The full width half maximum ($fwhm$) of the curve is:

$$fwhm=w\ast 2\sqrt{2}$$

The values measured for this line shape are:

`ID`

, integer identifier (same as other fits).`Peak`

, the Lorentzian peak ($A$).`PeakErr`

, an estimate of the error.`Centre`

, the position of the Lorentzian peak ($c$).`CentreErr`

, an estimate of the error.`Width`

, the Lorentzian width ($w$).`WidthErr`

, an estimate of the error.`FWHM`

, the full width of profile at half maximum.`FWHMErr`

, an estimate of the error.`Flux`

, the integrated flux of the Lorentzian.`FluxErr`

, an estimate of the error.`Rms`

, the root mean square difference between the Lorentzian and the line data.

**Voigt**: The formula for a Voigt profile (a convolution of a Gaussian and Lorentzian)
is:

$$K\left(a,b\right)=\frac{b}{\pi}{\int}_{-\infty}^{\infty}\frac{\mathrm{exp}\left(-{t}^{2}\right)}{{\left(a-t\right)}^{2}+{b}^{2}}dt$$

where:

$$a=\sqrt{ln2}\phantom{\rule{0.3em}{0ex}}\left(\frac{x-c}{\sigma}\right)$$

and

$$b=\sqrt{ln2}\phantom{\rule{0.3em}{0ex}}\left(\frac{w}{\sigma}\right)$$

In these equations $c$ is the central wavelength, $x$ the distance from the origin, $\sigma $ is the Gaussian width and $w$ the Lorentzian width. Which is complex to solve. However, if we take a complex variable $z=a+ib$, then the Voigt function is, within a scale factor ($A$), also the real part of the complex error function:

$$w\left(z\right)=\mathrm{exp}\left(-{z}^{2}\right)\phantom{\rule{0.3em}{0ex}}\mathrm{erfc}\left(-iz\right)$$

which has been approximated by various numerical codes. Using this fact with a non-linear minimisation routine (plus some derivatives) is how SPLAT performs its Voigt fitting.

The values measured for this line shape are:

`ID`

, integer identifier (same as other fits).`Peak`

, the Voigt peak ($A$).`PeakErr`

, an estimate of the error.`Centre`

, the position of the Voigt peak ($c$).`CentreErr`

, an estimate of the error.`Gwidth`

, the Gaussian width ($\sigma $).`GwidthErr`

, an estimate of the error.`Lwidth`

, the Lorentzian full width at half maximum ($w$).`LwidthErr`

, an estimate of the error.`FWHM`

, the full width of profile at half maximum (estimate).`FWHMErr`

, an estimate of the error.`Flux`

, the integrated flux of the Voigt profile.`FluxErr`

, an estimate of the error.`Rms`

, the root mean square difference between the Voigt and the line data.

The measurements, as shown in the **Spectral fitting results:** table can be written out to a
text file. Just select the **File->Save line fits** item and either pick an existing file to overwrite,
or enter a new file name. The format of this file is very simple, as shown by the following
example (long lines are wrapped for presentation):

# File created by Starlink SPLAT-VO

# Quick results:

# ID Peak Centre Width Equiv Flux Asym

0 0.5280543 4101.737 9.664325 0 8.636 1.046

# Gaussian results:

# ID Peak PeakErr Centre CentreErr Width WidthErr FWHM FWHMErr

# Flux FluxErr Rms

0 0.47457 0.013518 4101.637 0.20611 6.266466 0.2061116 14.7564 0.4853556

7.454487 0.3243526 0.03108123

# Lorentzian results:

# ID Peak PeakErr Centre CentreErr Width WidthErr FWHM FWHMErr

# Flux FluxErr Rms

0 0.5306862 0.00502416 4101.669 0.05490553 4.108373 0.05540269 11.62023 0.1567025

9.686626 0.1596041 0.009050248

# Voigt results:

# ID Peak PeakErr Centre CentreErr Gwidth GwidthErr Lwidth

# LwidthErr FWHM FWHMErr Flux FluxErr Rms

0 0.5308469 0.0120453 4101.668 0.05545499 0.6207013 0.7700358 11.48657 0.3663733

11.68279 0.4136257 9.687501 0.1166889 0.009053993

So each fit type has a section in which the results for each line are shown. Lines are
uniquely identified by their `ID`

value.

**Accelerator keys**

**Control-f**Do line fits to all ranges.**Control-r**Reset interface clearing all ranges and fits.**Control-i**Delete any fits.**Control-d**Add a coordinate range (interactive or non-interactive).**Control-e**Delete the selected coordinate ranges.**Control-w**Close the window.**F1**Display help on SPLAT-VO.**Shift-F1**Display help on window.