Skip to content

Commit

Permalink
Replace scipy's romberg with quad.
Browse files Browse the repository at this point in the history
Romberg will be removed from scipy in v1.15.0
  • Loading branch information
mkelley committed Sep 9, 2024
1 parent 813fe61 commit 4e49d9d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sbpy/activity/gas/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
try:
import scipy
from scipy import special
from scipy.integrate import quad, dblquad, romberg
from scipy.integrate import quad, dblquad
from scipy.interpolate import CubicSpline, PPoly
except ImportError:
scipy = None
Expand Down Expand Up @@ -1635,8 +1635,8 @@ def _column_density_at_rho(self, rho: np.float64) -> np.float64:
def column_density_integrand(z):
return self._volume_density(np.sqrt(z**2 + rhosq))

c_dens = 2 * romberg(column_density_integrand, 0,
z_max, rtol=0.0001, divmax=50)
c_dens = 2 * quad(column_density_integrand, 0,
z_max, rtol=0.0001)

# result is in 1/m^2
return c_dens
Expand Down Expand Up @@ -1745,13 +1745,12 @@ def _calc_num_fragments_grid(self) -> np.float64:
def vol_integrand(r, r_func):
return r_func(r) * r**2

r_int = romberg(
r_int = quad(

Check warning on line 1748 in sbpy/activity/gas/core.py

View check run for this annotation

Codecov / codecov/patch

sbpy/activity/gas/core.py#L1748

Added line #L1748 was not covered by tests
vol_integrand,
0,
max_r,
args=(self.vmr.volume_density_interpolation,),
rtol=0.0001,
divmax=20,
)
return 4 * np.pi * r_int

Expand Down

0 comments on commit 4e49d9d

Please sign in to comment.