ngageoint / sarpy

A basic Python library to demonstrate reading, writing, display, and simple processing of complex SAR data using the NGA SICD standard.
MIT License
241 stars 81 forks source link

Deprecation Workaround for scipy.misc.comb #9

Closed elwell67 closed 4 years ago

elwell67 commented 4 years ago

scipy.misc.comb is used in csk.py, radarsat.py, and sentinel.py under io/complex/utils, and maybe others. This scipy function has been deprecated since version 1.0.0 (documentation here).

The following solution (from here) is an alternative that requires no external dependencies:

from math import factorial def comb(n, k): return factorial(n) / factorial(k) / factorial(n - k)

utwade commented 4 years ago

Agreed. We will fix.

jcasey-beamio commented 4 years ago

a PR has been submitted to address this issue. The implemented fix checks the scipy version number and imports from scipy.special if the scipy version is 1 or higher, and from scipy.misc otherwise. It should work with new versions of scipy and provide backward compatability for older versions.