Programme: ELLFIT
Purpose: Programme fits an ellipse to an user defined bunch of points.
Category: ANALYSIS, FITTING, TABLES
File: ellfit.c
Author: K.G. Begeman
Description: ELLFIT will fit an ellipse to an user defined bunch of points.
The data set currently displayed will be used. The user can
define his points by choosing two contourlevels, in between
lying points are taken as points belonging to an arbitrary
ellipse (five parameters). The user can remove points with
the cursor. Next a least squares fit to these points X(i), Y(i)
is done, with an error calculation. If the fit was successfull,
the fitted ellipse will be displayed.
The results of the ellipse fit are stored in table ELLFIT.
Keywords:
** DISPLAY= Display device [DEFAULT_DISPLAY].
** COLOUR1= RGB intensities for graphics plane which defines the region
of interest; only coordinates inside this region will be
used for fitting the ellipse [1.0, 1.0, 1.0].
** COLOUR2= RGB intensities for graphics plane which defines the
coordinates which have data values in the range specified
with the RANGE= keyword [1.0, 0.0, 0.0].
** COLOUR3= RGB intensities for graphics plane which allows the user
to undefine points selected with the RANGE= keyword
[0.0, 1.0, 0.0].
** COLOUR4= RGB intensities for graphics plane which displays the
fitted ellipse [0.0, 0.0, 1.0].
** PLOT= Plot fitted ellipse [Y]?
---------------------------------------------------------
The user can now define the search area, that is the region
of interest. Coordinates on the ellipse can only be taken
from this region.
Next the programme goes into a loop which allows the user
to fit as many ellipses as he wants.
---------------------------------------------------------
RANGE= Two data values in between which the points on the ellipse
are defined. After these have been supplied, the points
inside this range are shown on the display.
EDIT= Edit points on ellipse? [Y]. The user can remove some of
the unwanted points with the cursor. The user can draw
polygons on the screen in a similar way as in defining the
search area. Any point selected by RANGE= inside a polygon
is unselected.
** AUTO= Automatic initial estimates or user supplied [Y].
If AUTO=N, ELLFIT prompts for the initial estimates with
the following keyword:
INIPAR= Enter initial estimates for RADIUS, INCL, XPOS, YPOS and
PA.
Next the program will load the positions and do the least
squares fitting. In case you want to keep some parameters
fixed for your owm special purpose, you should type the
appropriate keyword with the desired value (see keyword list
below). When you want to free a parameter again, just type
the corresponding keyword without any value.
** RADIUS= Semi Major axis of ellipse (arcsec/pixels).
** INCL= Inclination angle of ellipse (degrees).
** XPOS= X position of centre of ellipse (grids).
** YPOS= Y position of centre of ellipse (grids).
** PA= Position of major axis (degrees).
---------------------------------------------------------
After the fit the programme will display the results
with the corresponding errors and prompt the user whether
is should stop or continue.
---------------------------------------------------------
CONTINUE= Continue fitting ellipses? [Y].
FILE= Name of file to save fitted results [ellfit.dat].
Updates: Jan 28, 1991: KGB Document created.
Jun 23, 1993: KGB Results in GDS table.
May 23, 2002: JPT Increased maximum set name length.
Apr 15, 2009: VOG Replaced nint() by a function that uses floor()
to be compatible with other routines that
process coordinates.