Closed janerigby closed 6 years ago
@janerigby - I've edited the comment above, so the snippet is copy-pasteable
What versions do you use? This works without errors for me with the latest astropy (2.0.2) and pyregion (2.0)
Alternatively, if for some reason you cannot update pyregion, then you need to downgrade astropy to <1.3, as those rather old deprecations were removed in that version.
@janerigby Your example above works fine for me too (using pytest 2.0
and astropy 2.0.2
).
Thanks for the help, all. It turns out the error was caused by a mismatch between an old pyregion (1.2) and a new astropy (2.0). I have forced an upgrade of pyregion, and now it works.
A year ago, I wrote a tutorial showing how to use pyregion for simple aperture photometry. It worked then, but now the same code breaks.
Here's the tutorial: https://github.com/janerigby/NB/blob/master/Example%20pyds9%20and%20pyregion.ipynb
The error seems to be from get_mask(): "ValueError: header must be an instance of pyfits.Header or astropy.io.fits.Header".
Below is a an awkward workaround using get_filter() and then mask(), but I'd really like to solve the underlying issue -- why pyregion doesn't like the fits header.