Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a test case for radio cubes #113

Merged
merged 3 commits into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)