Skip to content

Commit

Permalink
Merge pull request #113 from leejjoon/fix-cube2
Browse files Browse the repository at this point in the history
add a test case for radio cubes
  • Loading branch information
cdeil committed Oct 13, 2017
2 parents 8c367db + 48a14d5 commit 7bde9dd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions pyregion/tests/data/sample_fits04.header
Original file line number Diff line number Diff line change
@@ -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 /
21 changes: 21 additions & 0 deletions pyregion/tests/test_cube.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7bde9dd

Please sign in to comment.