-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
Migrated from TracdefectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats
Milestone
Description
Original ticket http://projects.scipy.org/scipy/ticket/934 on 2009-04-28 by @josef-pkt, assigned to @josef-pkt.
again problem with setting parameters, bounds in _argcheck, which is not automatically called.
error only occurs on first use of the distribution, so difficult to test.
example (will also affect other distributions):
>>> print stats.truncnorm.moment(2,-lbdec,lbdec)
Traceback (most recent call last):
File "C:\Josef\eclipsegworkspace\scipybranch2\dist\Programs\Python25\Lib\site-packages\scipy\stats\distributions.py", line 915, in moment
mu, mu2, g1, g2 = self._stats(*args,**mdict)
File "C:\Josef\eclipsegworkspace\scipybranch2\dist\Programs\Python25\Lib\site-packages\scipy\stats\distributions.py", line 3307, in _stats
nA, nB = self.na, self.nb
AttributeError: 'truncnorm_gen' object has no attribute 'na'
if other method is used first, then it works:
>>> stats.truncnorm.cdf(2,-lbdec,lbdec)
1.0
>>> stats.truncnorm.moment(2,-lbdec,lbdec)
0.4377245949036388
self.na and self.nb are assigned in _argcheck
class truncnorm_gen(rv_continuous):
def _argcheck(self, a, b):
self.a = a
self.b = b
self.nb = norm._cdf(b)
self.na = norm._cdf(a)
return (a != b)
Metadata
Metadata
Assignees
Labels
Migrated from TracdefectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats