Ellipse Things

It seems that everything that uses an ellipse manages to follow a different convention for how the position angle is represented. I cover a lot of different thinsg in the present doc, but as I determine the ellipse position angle conventions I use in different tasks, I document them here at the top.




ds9 ellipse regions
  1. Semi-major axis on X, angles are measured from +X axis
  2. Semi-major axis on Y, angles are measured from +Y axis
  3. Angles are measured COUNTER-CLOCKWISE
  4. Angles cover range 0 to 360
FIGURE 0: Because I use ds9 ellipse markers for a lot of things I made this figure to illustrate how the zero position of a ds9 ellipse region depended on the axis on which the semi-major (long) axis of the ellipse is set. The user might use the mouse to adjust the axis ratio by putting the long axis along the X or Y axis. Then, he/she will rotate the ellipse to desired position angle. In the above examples we see examples of the long axis being set on the X axis (left) and on the Y axis (right). In both cases, the position angle is measured as POSITIVE in the COUNTER-CLOCKWISE sense. It should be noteed that NEGATIVE angles are not used (if you type angle=-120 into the Ellispe box, then it adjusts to be angle=360-120=240).


ellradius.sh == make an elliptical aperture radius map
  1. Angles are measured from +Y (vertical)
  2. Positive angles are measured CLOCKWISE
  3. Negative angles are measured COUNTER-CLOCKWISE

The pa values in Figure 1 below show examples of different position angle settings used in ellradius.sh runs.



GALPHOT ellipse fitter (ellipse.f is a library subroutine)
  1. Semi-major axis is set on +Y axis (vertical)
  2. Angles are measured from +Y axis
  3. Positive angles are measured CLOCKWISE
  4. Negative angles are measured COUNTER-CLOCKWISE
  5. Negative angles cover range 0 to -90
  6. Positive angles cover range 0 to +90

The PA values in Figure 2 below show examples of different position angle values from ellipse.f runs.




Ellipse Angles with Test_Data_for_Codes/T_runs/ellradius/ex0/RUN

Below I describe some rather convoluted scripts (for Test_Data_for_Codes) They demonstrate the ellipse parameter conventions used with my fortran ellipse fitting routine ellipse.f (this routine usually resides in a library like SCOLIB or OTWLIB). Below we consider an example of a multiple task script that I used to produce test images of ellipse figures. I wanted to confirm that my ellipse fitting routine was finding the position angle correctly. In the example below, I use the ellradius procedure to make the test imges. I used the thresh and STACKER routines to make a final test images. I then processed this image through the point of momcat to get my answers:

% pwd
...../Test_Data_for_Codes/T_runs/ellradius/ex0/RUN

As an immedaite example, I show a figure below that illustrates angle values used by the ds9 ellipse regions (Angle_ds9) and the position angle used by my elliptical radius image code named ellradius (pa in the figure below). As fate would have it, the ellipse.f routine would represent the major axis position angle with yet another convention. In the script below, I show I how to generate a useful image that demos the angle convention for ellipse.f (as it is used on the moments-based catalog routine momcat.sh).


FIGURE 1: Radius maps from ellradius. In every case above an ellipse with b/a=0.35 and a semi-major axis length of asemi=150 pixels was generated with different pa (Position Angle) values. The value of each pixel in the output radius map (rad.fits) is the radius in the deprojected (original) circle. The color scale at the bottom of the figure shows that the maximum radius values run from 0 to about 150 pixels. The pa values are measured from the POSITIVE-Y axis in a CLOCKWISE direction. For comparison we also show the corresponding ds9 Angle value used to plot a vector representing the semi-major axis of the projected ellipse.



Ellipse Angles with Test_Data_for_Codes/T_runs/ellradius/ex0/RUN

A fairly long routine called "RUN" uses various image processing routines to generate elliptical shapes and fit their contours with ellipses. The full code can be viewed HERE.

 
% RUN 10 80 100 170 

The ellipse results (from just_ellipse.list): 

      X       Y  A_semi     B/A      PA 
    100     100      45    0.266     10
    300     100      45    0.267     79
    100     299      45    0.266    -10
    300     299      45    0.267    -79

% ds9 PA_test.fits & 

 Manually load legend.reg 
The table printed at the end of the run tells me the PA values derived by ellfit.f in each case. I use the X,Y values in the table to identify the respective ellipse figure when I view the ds9 image of the final FITS file called PA_test.fits. From this little exercise one can see that the ellfit.f uses the following position angle rules:
 
 
* Angles are measured from +Y (vertical) 
* Positive angles are measured CLOCKWISE
* Negative angles are measured COUNTER-CLOCKWISE

FIGURE 2: The small print "pa=" values show the position angle used by the ellradius.sh routine to generate the ellipse. The larger text "PA=" values (in yellow) show the fitted position angle derived with the fortran routine ellipse.f (in OTWLIB).



Back to TEST DATA page
Back to SCO CODES page