Description
Roughly circumscribes the planet by estimating points on the bright limb and then fitting a circle. The limb estimation uses a slightly less dumb technique which looks for maxima on individual radii near the perimeter of the already estimated circle at equally spaced angles. If no circle has been estimated, one is first calculated using the row/column-based limb-finding techinque in 'roughalign.py'. A new circle is then fit to these points using the technique described in 'fitcircle.py'. The resulting coordinates (cx, cy, radius), fit error (RMSD in radius), and number of points used are printed. This techinque can be used repeatedly to get better and better estimates of the circle fitting the bright limb. However, since the limb exists only at integer pixel values, and is of dubious accuracy, this technique does not necessarily converge, nor does it reflect the best circle fitting the dark limb.
Usage
roughalign2.py directory [min-file-name] [max-file-name] [> output-file], or roughalign2.py fits-file [min] [max]
This program can operate on a single file or on a sequence of files. On a single file, it estimates a set of points on the bright limb, fits a circle to those points, then estimates another circle using the first as a guide. It then prints the resulting coordinates and error, and plots the final points and circle over the input image. On a sequence of files, it outputs a list of coordinates that can be redirected to a text file. Since the limb estimation relies on maxima on a per-radial basis, it can be performed on processed images, and can be used repeatedly to get better circle estimates (see 'process.py').
Examples
Compare the results of running 'roughalign.py' (left) and 'roughalign2.py' (right) on the same image:

70: ~/Projects/Python/AstroPy > roughalign.py 072407/raw/im0215.a.fits 0 0 072407/raw/im0215.a.fits 2007-07-24 05:21:39.741545 311.759364 251.072830 198.740857 3.548460 259 71: ~/Projects/Python/AstroPy > roughalign2.py 072407/raw/im0215.a.fits 0 0 072407/raw/im0215.a.fits 2007-07-24 05:21:39.741545 304.429204 252.539070 203.585323 1.774497 71
The output of 'roughalign.py' is used to initialize 'roughalign2.py', which then re-estimates the limb and calculates a new circle. The circle-fitting routine is the same in both programs. In general, 'roughalign2.py' produces better center coordinates (especially x), better radii, and lower errors from fewer input points.
In many cases, several applications (e.g. 5, see 'process.py') of the code in 'roughalign2.py' can significantly improve on the estimated circle from 'roughalign.py':




In other cases, it cannot improve the estimate:

İSky Coyote 2007