-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
multiple functions from scipy.special do not work with quantities #6390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note: this is a superset of issue #4092. |
@kyleaoman - moving discussion to this open issue, and trying to be a bit more constructive: how about starting with a list of
but also needs some tests (sadly, I fear that very good requirement is the reason I didn't get around to this...) |
I had a go at starting to add support for scipy.special functions, I now have a branch in a state where I can pick away at it for the next couple of weeks in spare moments. This is my first foray into collaborative github work (though I use it for my own projects). I sense I should mark this as 'in progress' somehow? |
@kyleaoman , you can always open a "WIP" pull request and add |
If you want me/others to have a look, the easiest would be to make it a pull request -- see http://docs.astropy.org/en/latest/development/workflow/development_workflow.html#pull-request; then we can add a label that it is in progress (do have a look at the documentation, and let us know if it is unclear). But if it is not in that state yet, you can also paste a link here. ... ah, I see @pllim was ahead of me ... was about to add something about testing. |
Sounds good, I think I can start a wip pull request shortly. I don't currently have [ci skip] on my commits, but each commit does pass the tests on my system. I suspect it will break on other systems since scipy.special seems to have shuffled around which functions are implemented as ufuncs over time (at least, the docs of the current version 1.0.0 only sort of reflect what's in the source...). Is it better to go back and add the tag to my commit messages in this scenario? |
Well, given that the CI traffic is not too bad right now, it does not really matter. If you want to do it anyway, only the last commit needs the "[ci skip]" text. |
#6852 included a number, but far from all, |
|
Many of the high priority functions from |
@namurphy - if you have a list of them it would be useful to update the original description above. Thanks! |
What I did to quickly check this was run through all of the non-private functions in from astropy import units as u
from scipy import special
dimensionless_quantity = 1 * u.dimensionless_unscaled
for key in sorted(special.__dict__):
try:
if key[0] != '_':
special.__dict__[key](dimensionless_quantity)
except Exception:
print(key) |
Using astropy 3.2rc1 and numpy 1.16.3, attached is the output that I get. I am not convinced that we need to support all of them. Can you pick out those that are important to you? UPDATE: Ah, I see that you have a prioritized list above. |
Yeah, supporting all of them does seem like a bit much, though it is hard to know ahead of time which functions will be needed and which won't. I keep wondering if there is a way to resolve this more generally without having to take into account all of the different special cases, though that sounds difficult too. The main functions I remember needing are |
My feeling would be to just leave this open and see if someone has the energy to do it... |
I'm interested, is it still open? |
@luisval yes it's still open, and afaik no one has worked on it since the last PR was merged, so go for it. |
Indeed, and with the infrastructure put in place by @kyleaoman it should be quite easy - be sure for every added function to also add corresponding tests (and think carefully about the required units, of course!) |
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 am concerned my change won't close the issue but adds functionality to some error and gamma functions. I also realized there are some functions that are not being tested. On the other hand when I try to add zeta and zetac to @mhvk list I get an error, particularly that some intermediate function is not a universal function. |
@DiegoAsterio - indeed, your change won't close the issue, but it will make more functions work, so it is a good step! In the end, I think this will work two ways - people finding functions they'd like to work and adding them, and someone going through the whole list carefully thinking which ones should work (and how). |
More ufuncs work with quantities + test #6390
I just tried to use SciPy's error function, and Astropy politely requested that I raise this issue here:
In scipy.special, ufuncs that I would prioritize include:
zeta
andzetac
- Riemann zeta functionsThanks!
The text was updated successfully, but these errors were encountered: