hyperion-rt / hyperion

Hyperion Radiative Transfer Code
http://www.hyperion-rt.org
BSD 2-Clause "Simplified" License
52 stars 26 forks source link

Travis: run tests on MacOS X #185

Closed astrofrog closed 8 years ago

astrofrog commented 8 years ago

Let's see if this works!

astrofrog commented 8 years ago

There are a couple of failures:

=================================== FAILURES ===================================
_________________________ TestSphericalDust.test_hash __________________________
self = <hyperion.dust.tests.test_dust.TestSphericalDust object at 0x1111f3b10>
tmpdir = local('/private/var/folders/gw/_2jq29095y7b__wtby9dg_5h0000gn/T/tmprygBdj/test_hash0')
    def test_hash(self, tmpdir):

        # Here we don't set the mean opacities or the emissivities to make sure
        # they are computed automatically

>       assert self.dust.hash() == '8e1f63eedcafcc05183b99ee8fe1333a'
E       assert '34dcacd899a9...0759b34a1353b' == '8e1f63eedcafc...b99ee8fe1333a'
E         - 34dcacd899a948d707f0759b34a1353b
E         + 8e1f63eedcafcc05183b99ee8fe1333a
hyperion/dust/tests/test_dust.py:115: AssertionError
______________________ TestInsideSED.test_unit_conversion ______________________
self = <hyperion.model.tests.test_sed.TestInsideSED object at 0x1135d6390>
    def test_unit_conversion(self):

        # Assume that the initial scaling in ergs/cm^2/s is correct, so then
        # we just need to check the relative scaling.

        ref = self.m.get_sed(group=0, units='ergs/cm^2/s', inclination=0)

        # Make sure the flux is non-zero
>       assert np.sum(ref.val) > 0
E       assert 0.0 > 0
E        +  where 0.0 = <function sum at 0x108012b90>(array([[ 0.,  0.,  0.],\n       [ 0.,  0.,  0.],\n       [ 0.,  0.,  0.],\n       [ 0.,  0.,  0.]]))
E        +    where <function sum at 0x108012b90> = np.sum
E        +    and   array([[ 0.,  0.,  0.],\n       [ 0.,  0.,  0.],\n       [ 0.,  0.,  0.],\n       [ 0.,  0.,  0.]]) = <hyperion.model.sed.SED object at 0x1135d6410>.val
hyperion/model/tests/test_sed.py:513: AssertionError
======= 2 failed, 1570 passed, 56 skipped, 12 xfailed in 600.13 seconds ========
astrofrog commented 8 years ago

The failure in test_hash is due to very slight differences between Mac/Linux in Numpy: https://github.com/numpy/numpy/issues/8092

astrofrog commented 8 years ago

There is a real bug that the failures have uncovered: if an image is not being computed for the inside observer, the following code is non-deterministic:

! Make sure the photon falls inside the image (wrap angles around)
x_image = peeled_image(ig)%x_max + modulo(x_image - peeled_image(ig)%x_max, 360._dp)
y_image = peeled_image(ig)%y_min + modulo(y_image - peeled_image(ig)%y_min, 360._dp)
astrofrog commented 8 years ago

I think for the inside observer, we'll need to change the image set-up so that it is defined in terms of a pointing center and a width/heigh of image, so that the SED and image have the same pointing center.

astrofrog commented 8 years ago

Alternatively, could disable SEDs for inside observers, since we don't take into account the spherical distance correctly