astropy/photutils — pull request #11 by kbarbary (2012-10-11 16:38:34+00:00)
Title: Unify different encloses methods to common API

**This PR is nearly ready for merging, but it needs to be tested first (I ran into problems when running setup.py; see below).**

With options for subpixel and exact calculations, the code had gotten a little unwieldy, necessitating multiple try/except clauses in `aperture_photometry()` in order to probe the functionality of an aperture object. This PR re-organizes the `encloses` methods of the apertures classes so that each aperture object can decide what method it provides and raise an exception itself if it does not provide the requested method. In my opinion, this is a more natural and cleaner way for the code to function, and results in more maintainable and extendable code.

**New implementation**: each aperture class has only a single `encloses` method with an optional parameter `method` that specifies the calculation method. Options are typically `'center', 'subpixel', 'exact'` (see docstring for `aperture_photometry()` for details). If an aperture class doesn't recognize a requested method, it raises a `ValueError`.

**Slight API change** to the `photometry` fuctions:

* OLD: a `subpixels` parameter which could be an int or `'exact'`
* NEW: a `method` parameter and a `subpixels` parameter. `method` is passed directly to the aperture objects; see above. `subpixels` can now only be an int (only used when `method='subpixel'`).

When trying to test this with setup.py test I ran into this:

ERROR: AttributeError: 'module' object has no attribute 'AstropyInstall' [__main__]
Traceback (most recent call last):
File "./setup.py", line 75, in
'install': setup_helpers.AstropyInstall
AttributeError: 'module' object has no attribute 'AstropyInstall'

Was there an astropy change that hasn't been propagated into photutils setup.py?