radio-astro-tools / radio-beam

A simple toolkit for reading and manipulating beams from astrophysical radio spectral data cubes.
https://radio-beam.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

Test failure in test_bintable #61

Closed olebole closed 7 years ago

olebole commented 7 years ago

I get the following test failure due to limited FP resolution:


    def test_bintable():

        beams = np.recarray(4, dtype=[('BMAJ', '>f4'), ('BMIN', '>f4'),
                                      ('BPA', '>f4'), ('CHAN', '>i4'),
                                      ('POL', '>i4')])
        beams['BMIN'] = [0.1,0.1001,0.09999,0.099999] # arcseconds
        beams['BMAJ'] = [0.2,0.2001,0.1999,0.19999]
        beams['BPA'] = [45.1,45.101,45.102,45.099] # degrees
        beams['CHAN'] = [0,0,0,0]
        beams['POL'] = [0,0,0,0]
        beams = fits.BinTableHDU(beams)

        beam = Beam.from_fits_bintable(beams)

        npt.assert_almost_equal(beam.minor.to(u.arcsec).value,
                                       0.10002226)
        npt.assert_almost_equal(beam.major.to(u.arcsec).value,
                                       0.19999751)
        npt.assert_almost_equal(beam.pa.to(u.deg).value,
>                                      45.10050065568665)
E       AssertionError: 
E       Arrays are not almost equal to 7 decimals
E        ACTUAL: 45.10050018005382
E        DESIRED: 45.10050065568665

radio_beam/tests/test_beam.py:87: AssertionError
keflavich commented 7 years ago

Thanks. I think we can safely compare those to only 4 digits.

e-koch commented 7 years ago

Fixed in #51