-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
MAINT/DOC: special.nrdtrimn/nrdtrisd
docstring fixes
#20069
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
Conversation
Nice. By the way, please don't forget the possibility that I might have screwed up the argument order while writing the wrappers :) I paid attention trying not to touch anything on the scipy side but who knows. But then again it would break more stuff. |
No worries about the rewrite, the docstring was apparently broken for many years. The example returns the same output using scipy 1.10.1. Good that the rewrite forces us to look into these functions more ;) |
FFT errors are not unrelated I think. But gcc one seems legit error. That should be a cdflib mistake if the remaining is passing. I'll check. Could you also remove the entries in line 13, 14 if the tests are added? |
The test still fails: https://github.com/scipy/scipy/actions/runs/7860753553/job/21448286231?pr=20069 It only shows up when the full test suite is run as the cdflib tests are marked as slow. I do not understand the origin of the test failure. For some reason,the machinery picks up the wrong parameters to test against each other. |
I wish I can understand the testing mechanism there but it is a bit too much of dependency injection for me. I feel like this is about the |
Could not agree more. It looks easy to use in principle even without special function expertise but if something fails, I find it hard to debug. @person142: would you have time to have a look at this? |
special.nrdtrimn/nrdtrisd
docstring fixes and testsspecial.nrdtrimn/nrdtrisd
docstring fixes
[docs only]
I removed the new tests and leave them for a separate PR. This now only solves the documentation issue. |
Sorry for that rookie mistake. Looks good now. I wish the linter/refguide check would catch that (would numpydoc validation help?). |
I don't think so based on https://numpydoc.readthedocs.io/en/latest/validation.html#built-in-validation-checks |
mn : scalar or ndarray | ||
The mean of the normal distribution. | ||
p : array_like | ||
CDF values, in range (0, 1]. | ||
x : array_like | ||
Quantiles, i.e. the upper limit of integration. | ||
mn : scalar or ndarray | ||
The mean of the normal distribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The signature above says nrdtrisd(p, x, mn, out=None)
, but here the order is mn,
p,
x`. I think these should be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Also, I noticed that nrdtrisd
returns garbage for infeasible inputs, say when you have a CDF value > 0.5 but x is less than the mean. e.g nrdtrisd(0, 0.6, -1) = -3.9471538755427473
. This is because nrdtrisd
is really finding a scale parameter, not a standard deviation, and a negative scale gives a reflection of the original distribution. This should be addressed at some point too in a future PR. Either by changing the behavior, or documenting the existing behavior.
Thanks @dschmitz89! |
Reference issue
Related to #19953 and #7168
What does this implement/fix?