astropy / specutils

An Astropy coordinated package for astronomical spectroscopy. Maintainers: @nmearl @rosteen @keflavich @eteq
http://specutils.readthedocs.io/en/latest/
161 stars 124 forks source link

Copy semantics change in numpy 2.0 caused incompatibility with astropy v6.1rc #1129

Closed pllim closed 2 months ago

pllim commented 2 months ago

Please see:

    def test_quantity_model():
        c = modeling.models.Chebyshev1D(3)
        uc = QuantityModel(c, u.AA, u.km)

>       assert uc(10*u.nm).to(u.m) == 0*u.m

specutils/tests/test_utils.py:26: 
...
E       ValueError: Unable to avoid copy while creating an array as requested.
E       If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
E       For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

Example logs:

cc @astrofrog @neutrinoceros

pllim commented 2 months ago

I might be able to patch this... See https://github.com/astropy/specutils/pull/1130

pllim commented 2 months ago

I can reproduce this error in this repo now that astropy nightly wheel upload is fixed. A previously green job now fails: https://github.com/astropy/specutils/actions/runs/8531304724/job/23500820517