Description
Roughly circumscribes the planet by estimating points on the bright limb and then fitting a circle. The limb estimation uses a dumb but fast technique which looks for row/column maxima above a threshold (e.g. 50% of image maximum) on the correct (right or left) side of row/column minima which are less than zero (i.e. in the saturated crescent). A 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.
Usage
roughalign.py directory [min-file-name] [max-file-name] [> output-file], or roughalign.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, and then fits a circle to those points, printing the resulting coordinates and error, and plotting the 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 negative row/column minima in the image (in the saturated crescent), this program is best used on raw images. To perform additional alignments on processed images, use the code in 'roughalign2.py'.
Examples
This program works reasonably well on most raw images:
51: ~/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

It can even accomodate some images where the bright limb is partially offscreen:
52: ~/Projects/Python/AstroPy > roughalign.py 072407/raw/im0198.a.fits 0 0 072407/raw/im0198.a.fits 2007-07-24 05:19:13.462010 352.462728 245.869627 198.260192 11.169991 119

However, it will not work on all images:
55: ~/Projects/Python/AstroPy > roughalign.py 072407/raw/im0171.a.fits 0 0 072407/raw/im0171.a.fits 2007-07-24 05:15:21.074047 410.129279 63.700401 58.669169 20.425256 37

Therefore, if used as part of an automated pipeline, a filter based on circle radius or error should be used to screen for bad images/fits.
To perform alignment on a series of images:
56: ~/Projects/Python/AstroPy > roughalign.py 072407/raw im0001.a.fits im0010.a.fits 072407/raw/im0001.a.fits 2007-07-24 05:01:02.510872 231.701695 279.936336 193.519605 3.343764 454 072407/raw/im0002.a.fits 2007-07-24 05:01:04.992377 226.464630 281.002381 197.529812 3.695505 473 072407/raw/im0003.a.fits 2007-07-24 05:01:07.535347 231.731135 280.116562 193.939526 2.743686 265 072407/raw/im0004.a.fits 2007-07-24 05:01:10.008148 236.419074 278.743709 191.013917 3.565645 444 072407/raw/im0005.a.fits 2007-07-24 05:01:12.506815 227.820047 280.803884 197.960212 2.372809 379 072407/raw/im0006.a.fits 2007-07-24 05:01:15.082742 236.199541 277.360153 189.601737 3.438494 420 072407/raw/im0007.a.fits 2007-07-24 05:01:17.591934 229.991071 279.768015 194.918054 2.523931 433 072407/raw/im0008.a.fits 2007-07-24 05:01:20.071525 234.210988 277.667288 190.401008 5.122429 384 072407/raw/im0009.a.fits 2007-07-24 05:01:22.581522 230.026027 278.857953 194.874722 3.075839 353 072407/raw/im0010.a.fits 2007-07-24 05:01:25.057501 228.496343 279.569937 197.319531 1.990965 435
İSky Coyote 2007