GNU Astronomy Utilities

Next: , Previous: , Up: Arithmetic operators   [Contents][Index] Elliptical shape operators

The operators here describe certain functions that will be necessary when dealing with objects that have a certain elliptical shape.


Return the width (along horizontal) and height (along vertical) of a box that encompasses an ellipse with the same center point. The top-popped operand is assumed to be the position angle (angle from the horizontal axis) in degrees. The second and third popped operands are the minor and major axis lengths respectively. This operator outputs two operands on the general stack. The first one is the width and the second (which will be the top one when this operator finishes) is the height.

If the value to the second popped operand (minor axis) is larger than the third (major axis), a NaN value will be written for both the width and height of that element and a warning will be printed (the warning can be disabled with the --quiet option).

As an example, if your ellipse has a major axis length of 10 units, a minor axis length of 4 units and a position angle of 20 degrees, you can estimate the bounding box with this command:

$ echo "10 4 20" \
       | asttable -c'arith $1 $2 $3 box-around-ellipse'

Alternatively if your three values are in separate FITS arrays/images, you can use the command below to have the width and height in similarly sized fits arrays. In this example a.fits and b.fits are respectively the major and minor axis lengths and pa.fits is the position angle (in degrees). Also, in all three, we assume the first extension is used. After its done, the height of the box will be put in h.fits and the width will be in w.fits. Just note that because this operator has two output datasets, you need to first write the height (top output operand) into a file and free it with the tofilefree- operator, then write the width in the file given to --output.

$ astarithmetic a.fits b.fits pa.fits box-around-ellipse \
                tofilefree-h.fits -ow.fits -g1

Finally, if you need to treat the width and height separately for further processing, you can call the set- operator two times afterwards like below. Recall that the set- operator will pop the top operand, and put it in memory with a certain name, bringing the next operand to the top of the stack.

For example let’s assume catalog.fits has at least three columns MAJOR, MINOR and PA which specify the major axis, minor axis and position angle respectively. But you want the final width and height in 32-bit floating point numbers (not the default 64-bit, which may be too much precision in many scenarios). You can do this with the command below (note you can also break lines with \, within the single-quote environment)

$ asttable catalog.fits \
           -c'arith MAJOR MINOR PA box-around-ellipse \
                    set-height set-width \
                    width float32 height float32'

Next: Building new dataset, Previous: Adding noise operators, Up: Arithmetic operators   [Contents][Index]