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

MAINT: scipy deprecation fixes for halos module (attempt 2) #632

Open
wants to merge 3 commits into
base: module/halos
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skypy/halos/mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def _sigma_squared(M, k, Pk, growth_function, cosmology):
top_hat = 3. * (np.sin(k * R) - k * R * np.cos(k * R)) / ((k * R)**3.)
integrand = Pk * np.power(top_hat * k, 2)

return Dz2 * integrate.simps(integrand, k) / (2. * np.pi**2.)
return Dz2 * integrate.simpson(integrand, k) / (2. * np.pi**2.)


def _dlns_dlnM(sigma, M):
Expand Down
8 changes: 4 additions & 4 deletions skypy/halos/tests/test_quenching.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def test_environment_quenched():
quenched = environment_quenched(n, p)
number_quenched = Counter(quenched)[True]

p_value = stats.binom_test(number_quenched, n=n, p=p,
alternative='two-sided')
p_value = stats.binomtest(number_quenched, n=n, p=p,
alternative='two-sided').pvalue
assert p_value > 0.01


Expand All @@ -28,6 +28,6 @@ def test_mass_quenched():
quenched = mass_quenched(halo_mass, offset, width)
number_quenched = Counter(quenched)[True]

p_value = stats.binom_test(number_quenched, n=n, p=0.5,
alternative='two-sided')
p_value = stats.binomtest(number_quenched, n=n, p=0.5,
alternative='two-sided').pvalue
assert p_value > 0.01
12 changes: 6 additions & 6 deletions skypy/power_spectrum/tests/test_growth.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def test_growth():
Dzprime = growth_function_derivative(redshift, cosmology_flat)

# Test growth factor
assert redshift.shape == fz.shape,\
assert redshift.shape == fz.shape, \
"Length of redshift array and growth rate array do not match"
assert isclose(fz[0], 1.0),\
assert isclose(fz[0], 1.0), \
"Growth factor at redshift 0 is not close to 1.0"

# Test growth function
assert redshift.shape == Dz.shape,\
assert redshift.shape == Dz.shape, \
"Length of redshift array and growth function array do not match"
assert allclose(Dz, 1. / (1. + redshift)),\
assert allclose(Dz, 1. / (1. + redshift)), \
"Growth function is not close to the scale factor"

# make sure that growth_function with scalar returns scalar
Expand All @@ -74,9 +74,9 @@ def test_growth():
assert Dz2 == Dz[2], 'growth function with scalar produced inconsistent result'

# Test growth function derivative
assert redshift.shape == Dzprime.shape,\
assert redshift.shape == Dzprime.shape, \
"Length of redshift array and growth function array do not match"
assert isclose(Dzprime[0], -1.0),\
assert isclose(Dzprime[0], -1.0), \
"Derivative of growth function at redshift 0 is not close to -1.0"

# Test against precomputed values using Planck15 cosmology
Expand Down
Loading