diff --git a/CHANGES.rst b/CHANGES.rst index 38289d9..e7768a8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -51,6 +51,8 @@ Other Changes and Additions - Astropy 1.0 is now required. +- Shape conversion for multi-dimenstional HDU does not raise exceptions. + - Parser supports hex color in attributes 1.2 (Aug 11, 2016) diff --git a/pyregion/tests/data/sample_fits04.header b/pyregion/tests/data/sample_fits04.header new file mode 100644 index 0000000..3530aa1 --- /dev/null +++ b/pyregion/tests/data/sample_fits04.header @@ -0,0 +1,22 @@ +SIMPLE = T / +BITPIX = -32 / +NAXIS = 3 / +NAXIS1 = 256 / +NAXIS2 = 256 / +NAXIS3 = 63 / +EQUINOX = 2.000000000E+03 /Epoch of RA DEC +CTYPE1 = 'RA---SIN' / +CRVAL1 = 1.81046666667E+02 / +CDELT1 = -1.388888923E-03 / +CRPIX1 = 1.280000000E+02 / +CROTA1 = 0.000000000E+00 / +CTYPE2 = 'DEC--SIN' / +CRVAL2 = 1.84433333333E+01 / +CDELT2 = 1.388888923E-03 / +CRPIX2 = 1.290000000E+02 / +CROTA2 = 0.000000000E+00 / +CTYPE3 = 'FREQ ' / +CRVAL3 = 1.41604138193E+09 / +CDELT3 = 4.882812500E+04 / +CRPIX3 = 3.200000000E+01 / +CROTA3 = 0.000000000E+00 / diff --git a/pyregion/tests/test_cube.py b/pyregion/tests/test_cube.py new file mode 100644 index 0000000..f7b13ba --- /dev/null +++ b/pyregion/tests/test_cube.py @@ -0,0 +1,21 @@ +import os +from os.path import join +from astropy.io.fits import Header +from .. import parse +from numpy.testing import assert_allclose + +rootdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') + + +def demo_header(): + return Header.fromtextfile(join(rootdir, "sample_fits04.header")) + + +def test_cube(): + + header = demo_header() + + region_string = 'circle(12:04:15.065,+18:26:51.00,173.029")' + r = parse(region_string).as_imagecoord(header) + + assert_allclose(r[0].coord_list, [117, 132, 34.6], atol=0.01)