You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the latest version of the cosmosis-standard-library, installed today in a fresh Conda environment as detailed in the CosmoSIS documentation. In building the package, Conda installed SciPy version 1.14.0 and FAST-PT version 3.1.1. I am using a Mac with an M2 chip, running MacOS Sonoma 14.4.1.
When running the examples/des_y3.ini test file, two errors were generated due to the use of deprecated scipy.integrate function names.
First, scipy.integrate.trapz in fastpt/matter_power_spt.py:
File "/Users/j.mccleary/Software/miniconda3/envs/cosmosis/lib/python3.12/site-packages/fastpt/matter_power_spt.py", line 15, in <module>
from scipy.integrate import trapz
ImportError: cannot import name 'trapz' from 'scipy.integrate' (/Users/j.mccleary/Software/miniconda3/envs/cosmosis/lib/python3.12/site-packages/scipy/integrate/__init__.py)
trapz appears to be deprecated in SciPy 1.14.0 and needs to be accessed with trapezoid instead. The fix is a small edit to matter_power_spt.py
File "/Users/j.mccleary/Software/miniconda3/envs/cosmosis/lib/python3.12/site-packages/cosmosis/runtime/pipeline.py", line 633, in run
status = module.execute(data_package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/j.mccleary/Software/miniconda3/envs/cosmosis/lib/python3.12/site-packages/cosmosis/runtime/module.py", line 246, in execute
return self.execute_function(data_block, self.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/j.mccleary/Software/cosmosis-standard-library/shear/point_mass/add_gammat_point_mass.py", line 113, in execute
int_sourcez = sp.integrate.simps(ng_array_source_rep * (num / chi_smat), z_source)
^^^^^^^^^^^^^^^^^^
AttributeError: module 'scipy.integrate' has no attribute 'simps'. Did you mean: 'simpson'?
scipy.integrate.simpson only takes one positional argument (y), so the fix requires both changing simps to simpson and also specifying x:
betaj1j2_pm = sp.integrate.simpson(nz_lens * Is * (1./chi_lens**2), x=z_lens)
I am not sure whether this problem is specific to MacOS or whether other operating systems are affected as well. It might also be a MacOS Conda problem. I'm happy to make a branch and edit add_gammat_point_mass.py myself, but I am afraid of breaking other code/affecting other users' installations.
Since FAST-PT is also affected, I'm tagging @jablazek so he knows about the CosmoSIS aspect.
The text was updated successfully, but these errors were encountered:
mcclearyj
changed the title
FAST-PT failure from scipy.integration function names deprecated in v1.14
Failures from scipy.integration function names deprecated in v1.14
Jun 28, 2024
Hello,
I am using the latest version of the
cosmosis-standard-library
, installed today in a fresh Conda environment as detailed in the CosmoSIS documentation. In building the package, Conda installed SciPy version 1.14.0 and FAST-PT version 3.1.1. I am using a Mac with an M2 chip, running MacOS Sonoma 14.4.1.When running the
examples/des_y3.ini
test file, two errors were generated due to the use of deprecatedscipy.integrate
function names.First,
scipy.integrate.trapz
infastpt/matter_power_spt.py
:trapz
appears to be deprecated in SciPy 1.14.0 and needs to be accessed withtrapezoid
instead. The fix is a small edit tomatter_power_spt.py
Next, the use of
simps
instead ofsimpson
in add_gammat_point_mass.pyscipy.integrate.simpson
only takes one positional argument (y
), so the fix requires both changingsimps
tosimpson
and also specifyingx
:and
I am not sure whether this problem is specific to MacOS or whether other operating systems are affected as well. It might also be a MacOS Conda problem. I'm happy to make a branch and edit
add_gammat_point_mass.py
myself, but I am afraid of breaking other code/affecting other users' installations.Since FAST-PT is also affected, I'm tagging @jablazek so he knows about the CosmoSIS aspect.
The text was updated successfully, but these errors were encountered: