Skip to content

Commit 900d959

Browse files
Merge pull request sympy#20302 from oscarbenjamin/pr_lambdify_scipy
Fixed lambdify usage in stats (1.7 branch)
2 parents 54cade9 + 04d54b0 commit 900d959

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

bin/test_travis.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ test_list = [
187187
'sympy/logic',
188188
'sympy/assumptions',
189189
190+
#stats
191+
'sympy/stats',
192+
190193
]
191194
192195
blacklist = [
@@ -229,6 +232,9 @@ doctest_list = [
229232
'sympy/logic',
230233
'sympy/assumptions',
231234
235+
#stats
236+
'sympy/stats',
237+
232238
]
233239
234240
if not (sympy.test(*test_list, blacklist=blacklist) and sympy.doctest(*doctest_list)):

sympy/stats/crv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _sample_scipy(cls, dist, size):
156156
# scipy does not require map as it can handle using custom distributions
157157
from scipy.stats import rv_continuous
158158
z = Dummy('z')
159-
handmade_pdf = lambdify(z, dist.pdf(z), 'scipy')
159+
handmade_pdf = lambdify(z, dist.pdf(z), ['numpy', 'scipy'])
160160
class scipy_pdf(rv_continuous):
161161
def _pdf(self, x):
162162
return handmade_pdf(x)

sympy/stats/drv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _sample_scipy(cls, dist, size):
5353
if dist.__class__.__name__ == 'DiscreteDistributionHandmade':
5454
from scipy.stats import rv_discrete
5555
z = Dummy('z')
56-
handmade_pmf = lambdify(z, dist.pdf(z), 'scipy')
56+
handmade_pmf = lambdify(z, dist.pdf(z), ['numpy', 'scipy'])
5757
class scipy_pmf(rv_discrete):
5858
def _pmf(self, x):
5959
return handmade_pmf(x)

sympy/stats/tests/test_continuous_rv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ def test_prefab_sampling():
13281328
size = 5
13291329
with ignore_warnings(UserWarning): ### TODO: Restore tests once warnings are removed
13301330
for var in variables:
1331-
for i in range(niter):
1331+
for _ in range(niter):
13321332
assert next(sample(var)) in var.pspace.domain.set
13331333
samps = next(sample(var, size=size))
13341334
for samp in samps:

sympy/stats/tests/test_stochastic_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_sample_stochastic_process():
237237
Y = DiscreteMarkovChain("Y", [0, 1, 2], T)
238238
for samps in range(10):
239239
assert next(sample_stochastic_process(Y)) in Y.state_space
240-
Z = DiscreteMarkovChain("Z", ['1', 1, None], T)
240+
Z = DiscreteMarkovChain("Z", ['1', 1, 0], T)
241241
for samps in range(10):
242242
assert next(sample_stochastic_process(Z)) in Z.state_space
243243

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy