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_jtok and test_jtok_equiv fail with Astropy 6.0 #118

Closed olebole closed 11 months ago

olebole commented 12 months ago

With Astropy 6.0, I get the following CI test failures:

__________________________________ test_jtok ___________________________________

    def test_jtok():

        major = 0.1 * u.rad
        beam = Beam(major, major, 30 * u.deg)

        freq = 1.42 * u.GHz

>       conv_factor = u.brightness_temperature(beam.sr, freq)

/usr/lib/python3/dist-packages/radio_beam/tests/test_beam.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/astropy/units/equivalencies.py:648: in brightness_temperature
    nu = frequency.to(si.GHz, spectral())
/usr/lib/python3/dist-packages/astropy/units/quantity.py:938: in to
    value = self._to_value(unit, equivalencies)
/usr/lib/python3/dist-packages/astropy/units/quantity.py:891: in _to_value
    return self.unit.to(
/usr/lib/python3/dist-packages/astropy/units/core.py:1195: in to
    return self._get_converter(Unit(other), equivalencies)(value)
/usr/lib/python3/dist-packages/astropy/units/core.py:1124: in _get_converter
    raise exc
/usr/lib/python3/dist-packages/astropy/units/core.py:1107: in _get_converter
    return self._apply_equivalencies(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Unit("sr"), unit = Unit("sr"), other = Unit("GHz")
equivalencies = [(Unit("m"), Unit("Hz"), <function spectral.<locals>.<lambda> at 0x7f18517174c0>, <function spectral.<locals>.<lambda>...<function spectral.<locals>.<lambda> at 0x7f1851717920>, <function spectral.<locals>.<lambda> at 0x7f1851717880>), ...]

    def _apply_equivalencies(self, unit, other, equivalencies):
    […]

        unit_str = get_err_str(unit)
        other_str = get_err_str(other)

>       raise UnitConversionError(f"{unit_str} and {other_str} are not convertible")
E       astropy.units.core.UnitConversionError: 'sr' (solid angle) and 'GHz' (frequency) are not convertible

/usr/lib/python3/dist-packages/astropy/units/core.py:1085: UnitConversionError

test_jtok_equiv has the same trace. Full test log

e-koch commented 11 months ago

Fixed in #119. Thanks @olebole !