## Fit Continuum and Compute Moments¶

Button Function
Define intervals to estimate continuum and moments

### Defining the guesses¶

Once clicked on the icon under the spectrum, a dialog window will ask to select:

• to fit the continuum with a constant or a line
• the boundary condition for fitting (continuum has to be positive or not)
• the kernel used to compute the spectrum (1, 5, or 9 pixels around the position of each spatial pixel)
• the number of regions to tesselate the image where different guesses can be defined
• the number of lines (emission and absorption) that can be defined

After a choice is made, the tessellation chosen appears on the image and it is possible to define a first estimate of the region where to define the continuum by clicking and draggind the mouse on the spectral window.

This is the initial choice which is applied to all the regions defined on the image. In many cases it is useful to define different guesses in different parts of the sky (e.g. when the velocity of a line changes in different parts of an object). To do this, move the cursor on the interested region and modify the two intervals on the spectrum by clicking and dragging their extremes.

Once happy with one guess, it is possible to export this to a file (which will include also the modified redshift and reference wavelength) by clicking under the "File" menu the "Guesses I/O"->"Export" option. The data are then saved in a json file which can be reimported in a second moment by clicking under the "File" menu the "Guesses I/O"->"Import" option and specifying the file.

To define another guess, reclick the icon and restart the process.

Button Function
Compute continuum and moments

### Computing continuum and moments¶

Under the image, click the icon. A dialog will ask first to fit the continuum. Then, once the continuum is defined, reclicking on the same icon will ask to compute the moments.

It is possible to redo these actions only on a region to see how redifining the guess for this region is changing the result. It is advisable to rerun the fit for the entire cube once all the guesses are redefined. In fact, a smoothing is applied to guesses in the adjacent regions to avoid abrupt changes of the estimates.

If the reference wavelength changes, it is possible to recompute C0 by clicking in the menu: "Fit"-->"Recompute C0,v,sv".

## Lines¶

The fitting of lines over the cube is under implementation. So far, it is possible to fit two emission lines only. The general case will be develop in the near future.

### The moments¶

These are the definitions used.

Zeroth moment: $M_0 = \int F_\lambda d\lambda$.

First moment: $M_1 = \int \frac{\lambda}{M_0} F_\lambda d\lambda$

Second moment: $M_2 = \int \frac{(\lambda-M_1)^2}{M_0} F_\lambda d\lambda$

Third moment: $M_3 = \int \frac{(\lambda-M_1)^3}{M_0 \sigma^3} F_\lambda d\lambda$

Fourth moment: $M_4 = \int \frac{(\lambda-M_1)^4}{M_0 \sigma^4} F_\lambda d\lambda - 3$

with $\sigma = \sqrt{M_2}$.

The zeroth moment (once the continuum emission is subtracted) gives information about the intensity of the line (or lines).

The first moment gives information about the velocity field of the reference line:

$v = (M_1-\lambda_0) c /\lambda_0$,

where $\lambda_0$ is the reference wavelength:

$\lambda_0 = \lambda_{line} (1+z)$.

To obtain velocities relative to the mean velocity of the structure, one has to subtract $cz$.

The second moment gives information about the velocity dispersion of the reference line:

$\sigma_v = \sqrt{M_2} c /\lambda_0$.

The third moment, normalized skewness, tells if a distribution is slanted to the right (positive values) or the left (negative values).

Finally, the fourth moment, kurtosis excess, tells if the distribution is platykurtic (more plate than the Gaussian) or leptokurtic (narrower than a Gaussian). The normalized kurtosis of a Gaussian is 3. This is the reason that subtracting 3 we compute the kurtosis excess with respect to a Gaussian distribution.