astropy/pyregion — pull request #54 by sargas (2014-11-16 15:36:25+00:00)
Title: Remove kapteyn_celestial and use astropy when possible

This is a branch not ready for merging due to a dependence on a patched, git version of astropy, but any comments would be appreciated.

Good
- Net loss of 2441 lines, or 56% of origin's LoC going by `cloc pyregion/*.py`
- Test coverage from 51% to 62%
- `test_region` in `pyregion/tests/test_region.py` is a little more usable: reference and test files are parameterized, making it easy to tell what combination failed the test
- Removed `estimate_cdelt` in favor of `astropy.wcs.utils.celestial_pixel_scale`
- Some docs for affected methods and new tests
- I think the previous default for how angles are measured was in disagreement with http://cxc.harvard.edu/ciao/ahelp/dmregions.html#Angles . I've made the `rot_wrt_axis=2` option from PR #34 the way to go. This only changes things for WCS with non-orthogonal axes.
- Tried to not introduce any new PEP8 violations, and removed a couple.

Bad
- Depends on git version of astropy (`celestial_pixel_scale`, `SkyCoord.to_pixel`, etc). I think I'll end up with some _backported_astropy.py submodule for these
- Breaks API, in ways that were not documented (I.e., everything in pyregion.wcs_helper) and by dropping rot_wrt_axis parameter. The latter doesn't come up when Googling at all in any non-pyregion code, though.
- To be useful, needs consistency with DS9 / AST. Currently it's able to do that with Kapteyn. For this PR to be useful, `astropy` needs astropy/astropy#3107

Ugly
- I'm not convinced the approach in `estimate_angle` is correct or clear, but I don't have any fits files with non-orthogonal axes to test with. This is exactly @mcara's approach
- `pyregion.physical_coordinate` looks ripe for gutting and replacing with some standard WCS functions, but I don't see anything in `astropy.wcs.WCS` that deals with physical coordinates. Perhaps these are called something different in the WCS code?
- There's a lot of files in `pyregion/tests/examples` that were unused by the tests. I load them as a basic will-this-crash test, but I need to look into these further to see if there is anything special that can be done with them in the tests