lmoments3 and scipy (again)

2020-10-13 Thread David Painter
I'm aware there have been problems with previous versions of
lmoments3 working with scipy -- comb having been replaced in scipy. I
thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
traceback referring to attribute comb not being present in
module scipy.misc.
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import numpy
>>> import scipy
>>> import lmoments3
>>> from lmoments3 import distr
>>> data = [135.2 ,130.1 ,117 ,109.3 ,92.1 ,91.4 ,83.1 ,80.5 ,74.7
,69.8,65.2,58.6,56.5,55.4,54.6,54.5,49.5,48.9,48.3,46.6]
>>> paras = distr.gpa.lmom_fit(data)
Traceback (most recent call last):
  File "", line 1, in 
paras = distr.gpa.lmom_fit(data)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py",
line 59, in lmom_fit
lmom_ratios = lm.lmom_ratios(data, nmom=n_min)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
line 82, in lmom_ratios
return _samlmusmall(data, nmom)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
line 159, in _samlmusmall
l1 = np.sum(x) / sm.comb(n, 1, exact=True)
AttributeError: module 'scipy.misc' has no attribute 'comb'

What am I doing wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lmoments3 and scipy (again)

2020-10-13 Thread Kyle Stanley
Based on a search of the scipy docs, it looks like the function might have
moved namespaces from scipy.misc.comb to scipy.special.comb (
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.comb.html?highlight=comb#scipy-special-comb)
when referenced in lmoments3. Alternatively, if you clone the package from
the repo directly, it seems to have been addressed in a recent commit:
https://github.com/OpenHydrology/lmoments3/commit/3349b90463f649aea02be5dc3726d22e5e500dc3
.

On Wed, Oct 14, 2020 at 12:00 AM David Painter 
wrote:

> I'm aware there have been problems with previous versions of
> lmoments3 working with scipy -- comb having been replaced in scipy. I
> thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
> would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
> verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
> traceback referring to attribute comb not being present in
> module scipy.misc.
> Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license()" for more information.
> >>> import numpy
> >>> import scipy
> >>> import lmoments3
> >>> from lmoments3 import distr
> >>> data = [135.2 ,130.1 ,117 ,109.3 ,92.1 ,91.4 ,83.1 ,80.5 ,74.7
> ,69.8,65.2,58.6,56.5,55.4,54.6,54.5,49.5,48.9,48.3,46.6]
> >>> paras = distr.gpa.lmom_fit(data)
> Traceback (most recent call last):
>   File "", line 1, in 
> paras = distr.gpa.lmom_fit(data)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py",
> line 59, in lmom_fit
> lmom_ratios = lm.lmom_ratios(data, nmom=n_min)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 82, in lmom_ratios
> return _samlmusmall(data, nmom)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 159, in _samlmusmall
> l1 = np.sum(x) / sm.comb(n, 1, exact=True)
> AttributeError: module 'scipy.misc' has no attribute 'comb'
>
> What am I doing wrong?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lmoments3 and scipy (again)

2020-10-14 Thread David Painter
Thank you, Kyle and Dennis.
The developer version from 17 months ago, which I hadn't spotted, has
solved my immediate problem. It would be good to have it mainstreamed to
prevent others having the same problem.
David






















On Thu, 15 Oct 2020 at 09:07, Dennis Lee Bieber 
wrote:

> On Wed, 14 Oct 2020 12:05:33 +1300, David Painter
>  declaimed the following:
>
> >I'm aware there have been problems with previous versions of
> >lmoments3 working with scipy -- comb having been replaced in scipy. I
> >thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
> >would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
> >verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
>
> 
>
> >What am I doing wrong?
>
> Well, the snarky answer would be "using SciPy 1.5.2"
>
>
> https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.comb.html
>
> "comb" is now under scipy.special, not scipy.misc. But the real fault
> likely needs to be put on lmoments3, since scipy.misc.comb has been
> deprecated all the way back in scipy 1.0.0!
>
>
> https://docs.scipy.org/doc/scipy-1.2.0/reference/generated/scipy.misc.comb.html
>
> https://pypi.org/project/lmoments3/#history indicates that lmoments3
> hasn't
> been updated in over FIVE years.
>
> A change was merged into the /development/ branch a year and a
> half ago
> https://github.com/OpenHydrology/lmoments3/tree/develop explicitly for
> this
> situation, but has not gone "mainstream"
>
>
>
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.com
> http://wlfraed.microdiversity.freeddns.org/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list