From c49583232df9c42b7273e8e740f07b34952633de Mon Sep 17 00:00:00 2001 From: Marc Paterno Date: Wed, 7 Jan 2026 12:49:01 -0600 Subject: [PATCH 1/3] Update To NumPy 2.0 And SciPy 1.12 Replace deprecated np.trapz with np.trapezoid in FASTPT.py and FASTPT_simple.py to maintain compatibility with NumPy 2.0. Update minimum version requirements for numpy (2.0) and scipy (1.12) in requirements.txt. Remove commented import from matter_power_spt.py. --- fastpt/core/FASTPT.py | 2 +- fastpt/core/FASTPT_simple.py | 4 ++-- fastpt/utils/matter_power_spt.py | 1 - requirements.txt | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fastpt/core/FASTPT.py b/fastpt/core/FASTPT.py index 952ad07..6b16870 100644 --- a/fastpt/core/FASTPT.py +++ b/fastpt/core/FASTPT.py @@ -752,7 +752,7 @@ def _get_sig4(self, P, P_window=None, C_window=None): # Returns relevant correlations (including contraction factors), # but WITHOUT bias values and other pre-factors. # Uses standard "full initialization" of J terms - sig4 = np.trapz(self.k_extrap ** 3 * Ps ** 2, x=np.log(self.k_extrap)) / (2. * pi ** 2) + sig4 = np.trapezoid(self.k_extrap ** 3 * Ps ** 2, x=np.log(self.k_extrap)) / (2. * pi ** 2) self.cache.set(sig4, "sig4", hash_key, P_hash) return sig4 diff --git a/fastpt/core/FASTPT_simple.py b/fastpt/core/FASTPT_simple.py index 37d89f5..8f5a7db 100644 --- a/fastpt/core/FASTPT_simple.py +++ b/fastpt/core/FASTPT_simple.py @@ -271,8 +271,8 @@ def P_bias(self,P,P_window=None,C_window=None): # Uses standard "full initialization" of J terms Power, mat=self.J_k(P,P_window=P_window,C_window=C_window) - sig4=np.trapz(self.k_old**2*Power**2,x=self.k_old)/(2.*pi**2) - #sig2=np.trapz(self.k_old**2*Power,x=self.k_old)/(2.*pi**2) + sig4=np.trapezoid(self.k_old**2*Power**2,x=self.k_old)/(2.*pi**2) + #sig2=np.trapezoid(self.k_old**2*Power,x=self.k_old)/(2.*pi**2) Pd1d2=2.*(17./21*mat[0,:]+mat[4,:]+4./21*mat[1,:]) Pd2d2=2.*(mat[0,:]) diff --git a/fastpt/utils/matter_power_spt.py b/fastpt/utils/matter_power_spt.py index 6e603d1..c685f98 100644 --- a/fastpt/utils/matter_power_spt.py +++ b/fastpt/utils/matter_power_spt.py @@ -12,7 +12,6 @@ import numpy as np from numpy import log, exp, pi -#from scipy.integrate import trapz from scipy.signal import fftconvolve from .J_k import J_k import sys diff --git a/requirements.txt b/requirements.txt index aab0b26..d13fd35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -numpy>=1.17 -scipy>=1.2 +numpy>=2.0 +scipy>=1.12 matplotlib>=3.0 \ No newline at end of file From 8b9f8650ab86efa046177e2ceb53e7b67cd31910 Mon Sep 17 00:00:00 2001 From: Marc Paterno Date: Mon, 23 Feb 2026 18:45:32 -0600 Subject: [PATCH 2/3] Update minimum dependency versions Raise minimum Python requirement from 3.7 to 3.9 to align with modern package support and demands of numpy. Update dependency minima to follow SPEC 0: numpy to 2.0, scipy to 1.13, and matplotlib to 3.9. Remove obsolete numpy version constraint from CI workflow and delete outdated compatibility note from README about numpy 1.24 issues in earlier package versions. --- .github/workflows/ci.yml | 1 - README.md | 2 -- pyproject.toml | 8 ++++---- requirements.txt | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4b2f79..c4123d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -e . - pip install numpy==1.26.4 pip install pytest - name: Run unit/benchmark tests diff --git a/README.md b/README.md index a0aba21..e344e6e 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,6 @@ utilizes Fourier methods combined with analytic expressions to reduce the computation time to scale as N log N, where N is the number of grid points in the input linear power spectrum. -NOTE: v3.1.0 and earlier require numpy version < 1.24. This is fixed in v3.1.1 and later, which is available on pip and conda. - Easy installation with pip: * `pip install fast-pt` diff --git a/pyproject.toml b/pyproject.toml index 1480ad3..513c487 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "fast-pt" dynamic = ["version"] -requires-python = ">=3.7" +requires-python = ">=3.9" description = "FAST-PT is a code to calculate quantities in cosmological perturbation theory at 1-loop (including, e.g., corrections to the matter power spectrum)." readme = "README.md" license = { file = "LICENSE" } @@ -32,9 +32,9 @@ keywords = [ 'Perturbation-Theory' ] dependencies = [ - "numpy>=1.17", - "scipy>=1.2", - "matplotlib>=3.0" + "numpy>=2.0", + "scipy>=1.13", + "matplotlib>=3.9" ] [project.optional-dependencies] diff --git a/requirements.txt b/requirements.txt index d13fd35..3f5fc20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ numpy>=2.0 -scipy>=1.12 -matplotlib>=3.0 \ No newline at end of file +scipy>=1.13 +matplotlib>=3.9 \ No newline at end of file From 5487f115d17cf966088b366bb0befa2c87c3afc7 Mon Sep 17 00:00:00 2001 From: Marc Paterno Date: Mon, 23 Feb 2026 18:55:52 -0600 Subject: [PATCH 3/3] Expand CI testing matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Ubuntu to the OS matrix alongside macOS to test on multiple platforms. Add Python 3.14 to the version matrix. Update GitHub Actions to latest versions (checkout v3→v4, setup-python v4→v5). --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4123d9..3f313e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,18 +13,19 @@ on: jobs: test: - runs-on: macos-latest + runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.13", "3.11", "3.9"] + os: [macos-latest, ubuntu-latest] + python-version: ["3.14", "3.13", "3.11", "3.9"] steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }}