specutils
specutils copied to clipboard
Test_moment_cube fails on i386 with astropy 5.0
When test-building specutils 1.5.0 on an 32-bit platform (i386), the following failure appears:
def test_moment_cube():
np.random.seed(42)
frequencies = np.linspace(100, 1, 10000) * u.GHz
g = models.Gaussian1D(amplitude=100*u.Jy, mean=50*u.GHz, stddev=1000*u.GHz)
noise = np.random.normal(0., 0.01, frequencies.shape) * u.Jy
flux = g(frequencies) + noise
# use identical arrays in each spaxel. The purpose here is not to
# check accuracy (already tested elsewhere), but dimensionality.
flux_multid = np.broadcast_to(flux, [10,10,flux.shape[0]]) * u.Jy
spectrum = Spectrum1D(spectral_axis=frequencies, flux=flux_multid)
[…]
# spatial higher order (what's the meaning of this?)
moment_2 = moment(spectrum, order=2, axis=1)
assert moment_2.shape == (10,10000)
assert moment_2.unit.is_equivalent(u.GHz**2)
# check assorted values.
assert quantity_allclose(moment_2[0][0], 2.019e-28*u.GHz**2, rtol=0.01)
assert quantity_allclose(moment_2[1][0], 2.019e-28*u.GHz**2, rtol=0.01)
> assert quantity_allclose(moment_2[0][3], 8.078e-28*u.GHz**2, rtol=0.01)
E assert False
E + where False = quantity_allclose(<Quantity 2.01948392e-28 GHz2>, (8.078e-28 * (Unit("GHz") ** 2)), rtol=0.01)
E + where Unit("GHz") = u.GHz
specutils/tests/test_analysis.py:1042: AssertionError
Full build log here. This already happened with version 1.4.2 when we switched to Astropy 5.0. Python version is both 3.9 and 3.10.
Is this still a problem? I don't see this error anymore.
In the Debian package, I disabled the last assert statement so that this doesn't hurt me :-) Shall I re-enable and test if it is gone?
Worth a check but not urgent. 🤞
astropy 5.0.1 is out
Unfortunately, it didn't help: https://salsa.debian.org/debian-astro-team/specutils/-/jobs/2507807 This is with astropy 5.0.1.
astropy is already on v5.2.x and v5.0 will stop being LTS at the end of the year, so I don't think we'll ever fix this, unfortunately.