Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astropy.cosmology.z_at_value seems broken by the new scipy version #14249

Closed
spxiwh opened this issue Jan 4, 2023 · 2 comments
Closed

astropy.cosmology.z_at_value seems broken by the new scipy version #14249

spxiwh opened this issue Jan 4, 2023 · 2 comments

Comments

@spxiwh
Copy link

spxiwh commented Jan 4, 2023

Description

When we call astropy.cosmology.z_at_value, astropy fails with

File "/home/runner/work/pycbc/pycbc/.tox/py-search/lib/python3.9/site-packages/scipy/optimize/_minimize.py", line 887, in minimize_scalar
    raise ValueError(message)
ValueError: Use of `bounds` is incompatible with 'method=Brent'.

Expected behavior

Astropy not fail

Actual behavior

This seems to be an incompatibility with the new scipy (1.10) release. In particular this patch scipy/scipy#17448 states that using "method='brent'" and giving bounds is now considered a failure, and one should use method='bounded' instead. I think the default method in scipy needs to be updated to match this?

Steps to Reproduce

using latest astropy and scipy 1.10

import astropy, scipy
from astropy.cosmology import FlatLambdaCDM
from astropy import units
cosmology = FlatLambdaCDM(H0=67.90, Om0=0.3065)
astropy.cosmology.z_at_value(cosmology.luminosity_distance, 100*units.Mpc)

System Details

>>> import platform; print(platform.platform())
Linux-4.18.0-425.3.1.el8.x86_64-x86_64-with-glibc2.28
>>> import sys; print("Python", sys.version)
Python 3.9.7 | packaged by conda-forge | (default, Sep 14 2021, 01:17:55) 
[GCC 9.4.0]
>>> import numpy; print("Numpy", numpy.__version__)
Numpy 1.21.2
>>> import erfa; print("pyerfa", erfa.__version__)
pyerfa 2.0.0
>>> import astropy; print("astropy", astropy.__version__)
astropy 5.2
>>> import scipy; print("Scipy", scipy.__version__)
Scipy 1.10.0
>>> import matplotlib; print("Matplotlib", matplotlib.__version__)
Matplotlib 3.4.3
@spxiwh spxiwh added the Bug label Jan 4, 2023
@github-actions
Copy link

github-actions bot commented Jan 4, 2023

Welcome to Astropy 👋 and thank you for your first issue!

A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.

GitHub issues in the Astropy repository are used to track bug reports and feature requests; If your issue poses a question about how to use Astropy, please instead raise your question in the Astropy Discourse user forum and close this issue.

If you feel that this issue has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.

@saimn
Copy link
Contributor

saimn commented Jan 6, 2023

This issue has been fixed in #14232, will be in the v5.2.1 release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants