Skip to content

Commit

Permalink
changed from rounding to using assert_allclose()
Browse files Browse the repository at this point in the history
  • Loading branch information
PBarmby committed Jun 23, 2014
1 parent c84e7a7 commit 6ed6d76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion imagecube/imagecube.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# header information.

from __future__ import print_function, division
from ..extern import six
#from ..extern import six

import sys
import getopt
Expand Down
12 changes: 5 additions & 7 deletions imagecube/tests/test_imagecube.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# test script for imagecube
# modified from montage_wrappers/tests/test_wrappers.py
from __future__ import print_function, division
from ..extern import six

import os
import shutil
Expand Down Expand Up @@ -56,14 +55,13 @@ def teardown_class(self):
# test the helper functions
def test_helpers(self):
pixscal_arcsec = imagecube.get_pixel_scale(self.header)
pixscal_deg = round(pixscal_arcsec/3600.0,7) # rounding is not ideal
assert pixscal_deg == cdelt_val
pa = round(imagecube.get_pangle(self.header),1)
assert pa == crota2_val
assert_allclose(pixscal_arcsec/3600.0,cdelt_val)
pa = imagecube.get_pangle(self.header)
assert_allclose(pa,crota2_val)
conv_fact1 = imagecube.get_conversion_factor(self.header,'MIPS') # assumed in MJy/sr
assert conv_fact1 == u.MJy.to(u.Jy)/u.sr.to(u.arcsec**2) * (pixscal_arcsec**2)
assert_allclose(conv_fact1,u.MJy.to(u.Jy)/u.sr.to(u.arcsec**2) * (pixscal_arcsec**2))
conv_fact2 = imagecube.get_conversion_factor(self.header,'BLINC') # unknown instrument, should give zero
assert conv_fact2 == 0.0
assert_allclose(conv_fact2,0.0)
racen, deccen, crota = imagecube.get_ref_wcs('I1_n5128_mosaic.fits')
assert racen == 201.243776
assert deccen == -43.066428
Expand Down

0 comments on commit 6ed6d76

Please sign in to comment.