Would like to patch docstring for numpy.random.normal
![](https://secure.gravatar.com/avatar/e93e18f71a5821a54c233690506bdbf7.jpg?s=120&d=mm&r=g)
Dear numpy users, I would like to clarify the docstring for numpy.random.normal. I submitted a patch but it was rejected because it breaks the tests. Unfortunately, the development workflow page does not explain how to run the tests (in fact it doesn't mention them at all). I am therefore writing to discuss my proposed change and find out how to run the tests so that I can make it compatible with the existing code. The current form of the docstring for numpy.random.normal is as follows: """ normal(loc=0.0, scale=1.0, size=None) <snip> Parameters ---------- loc : float Mean ("centre") of the distribution. scale : float Standard deviation (spread or "width") of the distribution. size : tuple of ints Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. <snip> Notes ----- The probability density for the Gaussian distribution is .. math:: p(x) = \frac{1}{\sqrt{ 2 \pi \sigma^2 }} e^{ - \frac{ (x - \mu)^2 } {2 \sigma^2} }, where :math:`\mu` is the mean and :math:`\sigma` the standard deviation. The square of the standard deviation, :math:`\sigma^2`, is called the variance. """ It seems unnecessarily convoluted to name the input arguments "loc" and "scale", then immediately define them as the "mean" and "standard deviation" in the Parameters section, and then again rename them as "mu" and "sigma" in the written formula. I propose to simply change the argument names to "mean" and "sigma" to improve consistency. I tried fixing this via a pull request [1] but it was closed because my change broke the tests. Unfortunately, the development workflow section of the web page doesn't explain how to run the tests (in fact it doesn't even mention them). How can I make the proposed change without breaking the tests, or equivalently how do I find out how to run the tests myself so I can find an acceptable way of making the change on my own? [1] https://github.com/numpy/numpy/pull/5607#issuecomment-76114282 -- Daniel Sank
![](https://secure.gravatar.com/avatar/97c543aca1ac7bbcfb5279d0300c8330.jpg?s=120&d=mm&r=g)
On Mar 10, 2015 11:15 AM, "Paul Hobson" <pmhobson@gmail.com> wrote:
On Mon, Mar 9, 2015 at 4:33 PM, Charles R Harris <
charlesr.harris@gmail.com> wrote:
Not sure what you mean by "the existing 2.X branch" (does such a thing exist somewhere?), but yeah, don't submit PRs like that. Best case they'd bit rot before we ever get around to 2.0, worst case 2.0 may never happen. (What, you liked python 2 -> 3 so much you want to go through that again?)
![](https://secure.gravatar.com/avatar/b4f6d4f8b501cb05fd054944a166a121.jpg?s=120&d=mm&r=g)
On Di, 2015-03-10 at 11:22 -0700, Nathaniel Smith wrote:
We could try to maintain a list of things like this for others like blaze to not fall into the same pits. But then I this is likely not quite of that caliber ;).
![](https://secure.gravatar.com/avatar/7840b7a3579d2a7065d5c0aa804b5b92.jpg?s=120&d=mm&r=g)
On Tue, Mar 10, 2015 at 11:22 AM, Nathaniel Smith <njs@pobox.com> wrote:
It's been a while, but last time I build numpy from the master on github, numpy.__version__ came back as 2.dev or something like that. So I always assumed there was a 2.X branch. It's been a while since I've built numpy, but clearly I'm mistaken. -p
![](https://secure.gravatar.com/avatar/97c543aca1ac7bbcfb5279d0300c8330.jpg?s=120&d=mm&r=g)
On Mar 10, 2015 11:15 AM, "Paul Hobson" <pmhobson@gmail.com> wrote:
On Mon, Mar 9, 2015 at 4:33 PM, Charles R Harris <
charlesr.harris@gmail.com> wrote:
Not sure what you mean by "the existing 2.X branch" (does such a thing exist somewhere?), but yeah, don't submit PRs like that. Best case they'd bit rot before we ever get around to 2.0, worst case 2.0 may never happen. (What, you liked python 2 -> 3 so much you want to go through that again?)
![](https://secure.gravatar.com/avatar/b4f6d4f8b501cb05fd054944a166a121.jpg?s=120&d=mm&r=g)
On Di, 2015-03-10 at 11:22 -0700, Nathaniel Smith wrote:
We could try to maintain a list of things like this for others like blaze to not fall into the same pits. But then I this is likely not quite of that caliber ;).
![](https://secure.gravatar.com/avatar/7840b7a3579d2a7065d5c0aa804b5b92.jpg?s=120&d=mm&r=g)
On Tue, Mar 10, 2015 at 11:22 AM, Nathaniel Smith <njs@pobox.com> wrote:
It's been a while, but last time I build numpy from the master on github, numpy.__version__ came back as 2.dev or something like that. So I always assumed there was a 2.X branch. It's been a while since I've built numpy, but clearly I'm mistaken. -p
participants (6)
-
Charles R Harris
-
Daniel Sank
-
Nathaniel Smith
-
Paul Hobson
-
Sebastian Berg
-
Sturla Molden