**IRIS TUTORIALModelisation
by ellipse fitting**

We describe a performant tool for
modeling and photometric analysis of extended object like galaxies and comets.
For exemple this command is intended to model elliptical galaxies in order to
study their morphology and their deviation from ellipticity. The morphological
analysis is based on determining the parameters of elliptical isophotes from
measurements of second order moments of inertia, for each real isophote.
Higher order moments of inertia are also measured in order to determine the
value of the coefficients (a3,b3,...a6,b6) associated with each isophote.
These coefficients are defined by the Fourier series expansion of the deviations
dr from the elliptical contour calculated for each real isophote:

dr = a3.cos(3.a) + b3.sin(3.a) + ... + a6.cos(6.a) + b6.sin(6.a)

where a is the azimuth angle.

Note that this analysis is adapted to objects with exponentially decreasing luminosity from the center, for example, elliptical galaxies.

Exemple, load the image U4170 from the console (click here for download the image of the elliptical galaxy UGC 4170, size = 20Kb):

>LOAD U4170

>VISU 560 370

The galaxy UGC 4170

Run the command **Fit
ellipses** from the **Processing** menu, then enter
the following parameters:

**Xmin, Ymin and Xmax, Ymax**are the coordinates of two points framing the object under study (the lower left-hand and upper right-hand corners).**XC and YC**are the position of the center of the object to analyze, to within 3 pixels, along the X and Y axes.**Background**is the level of the sky background (use BG command for exemple for evaluate this value).**Y/X ratio**is the ratio of the dimension of the pixels along the Y and X axes (Y/X).**a3 and b3 coefficients:**flag to include the Fourier coefficients a3 and b3 in the model.**a4 and b4 coefficients:**flag to include the Fourier coefficients a4 and b4 in the model.**a5 and b5 coefficients:**flag to include the Fourier coefficients a5 and b5 in the model.**a6 and b6 coefficients:**flag to include the Fourier coefficients a6 and b6 in the model.

For each analysis, the ASCII file ELLIPSE.LST is generated. The lines of this file give the characteristics of an ellipse starting from the center of the object. The column contains the following information:

- the number of the ellipse (starting from the center).
- the equivalent radius of the isophote in arcsec to the power 1/4.
- the magnitude in arcsec2 of the surface defined by the ellipse (arbitrary zero scale for this version).
- the shift in pixel from the center of the ellipse with respect to XC.
- the shift in pixel from the center of the ellipse with respect to YC.
- the ratio b/a of the ellipse (semiminor axis/ semimajor axis).
- the position angle of the semimajor axis of the ellipse.
- the value of the Fourier coefficients from a3 to a6 and from b3 to b6.

Note that:

- a galaxy with a4>0 is called 'disky'

- a galaxy with a4<0 is called 'boxy'

- a galaxy with a6>0 is called 'lemon'

Click **OK**. The result image contains the model of the galaxy.
The file ELLIPSE.LST contains the numerical output of the analysis.

The numerical model of
UGC 4170

At this stage, to know if the modeling is correct, it is useful to subtract the model from the original image:

>SAVE R

>LOAD U4170

>SUB R 100

>VISU 150 80

The difference of the
original image and the model.

The image of the galaxy has pretty much disappeared.
Only the stars remain., The concentric central zone comes from calculation artefacts
and is thus not real. Note also a dark arc near the star at (50,90). This is
also an artefact of the calculation. To verify this, we recommend that you suppress
this star in the original image and then re-start the processing. For this use
the **SUBSTITUTE** command. This allows you to compare, pixel by pixel,
the original image and the first model of this image. Any pixel on the original
image outside a given threshold will be replaced by its equivalent in the model.
If the threshold is well chosen, the pixels on the original image (first parameter
of **SUBSITUTE**) that have
the level of stars will be given the value from the model (second parameter
of **SUBSITUTE**), and thus eliminated.

Be careful, however; if the threshold (third
parameter of **SUBSTITUTE**) is too
low, you may suppress details in the image that can be modeled. If the threshold
is too high, the stars may not be attenuated. The right balance can be
found by trial and error.

For the image UGC 4170 and its first model, we have chosen the threshold value 30. We write:

>SUBSTITUTE U4170 R 30

>SAVE R2

Result of the **SUBSTITUTE**
command (R2 image).

There are only faint marks where the stars were
(the command **SYM** can
be also very useful for situations
of this type).. We can now iterate with *fit
ellipse* algorithm, this time on the image
R2.PIC:

Difference from the original
image (U4170) and the model synthetised with R2 image.

The artefacts are definitely attenuated.

Now, let's look at the galaxy UGC 4367 (click here for download U4367 image, size = 20Kb):

>LOAD U4367

>VISU 450 180

The UGC 4367 galaxy.

We will process this galaxy with the parameters:

A cross shaped residual is clearly visible. This is because UGC 4367 is a typical "disky" galaxy:

Residual of the modeling
for UGC 4367.

We should redo the model, taking into account the coefficients a4 and b4 (reload the image before):

This time, the result is very satisfying. Note in particular the presence of faint stars that appear in front of the galaxy. They would have been invisible if the galaxy had not been removed:

A better fit.

In general, calculating a model for a galaxy, then subtracting this model, can bring out less visible structures - globular clusters, shells, supernovae. It is also usefull for detection of faint structures in coma of comets.