astropy: multiple functions from scipy.special do not work with quantities
I just tried to use SciPy’s error function, and Astropy politely requested that I raise this issue here:
>>> from astropy import units
>>> from scipy.special import erf, erfc
>>> r1 = 5*u.m
>>> r2 = 6*u.m
>>> erf(r1/r2)
TypeError: Unknown ufunc erf. Please raise issue on https://github.com/astropy/astropy
>>> erfc(r1/r2)
TypeError: Unknown ufunc erfc. Please raise issue on https://github.com/astropy/astropy
>>> erf(r1.value/r2.value) # workaround
0.76140717068356445
In scipy.special, ufuncs that I would prioritize include:
- Error function, etc
- Bessel functions
- Gamma and related functions
- Legendre functions
-
zeta
andzetac
- Riemann zeta functions
Thanks!
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 23 (22 by maintainers)
Commits related to this issue
- Merge pull request #10934 from DiegoAsterio/master More ufuncs work with quantities + test #6390 — committed to astropy/astropy by mhvk 3 years ago
Prospective contributors: take a look at the prioritized list on the first comment and then read https://github.com/astropy/astropy/blob/master/astropy/units/quantity_helper/scipy_special.py
I’m interested, is it still open?
What I did to quickly check this was run through all of the non-private functions in
scipy.special
and see if they worked with1 * u.dimensionless_unscaled
as the sole argument. The list of functions that did not work was very long, but this list would have also included any functions that require two or more arguments and any functions for which1
is an invalid input.