ENH examples are now reproducible#7386
ENH examples are now reproducible#7386tacaswell merged 2 commits intomatplotlib:masterfrom NelleV:numpy_seed
Conversation
|
LGTM but super curious if you did this manually or with a script. |
|
I git grepped to find which examples needed it and did it manually. With vim it was quite straightforward and reasonable fast (~20minutes). |
- added a random seed in every single example that needed one.
|
The code added after functions is one line too high; should be two blank lines after the function and one after the new code, but it's the other way around. |
|
@QuLogic I am not sure what you mean by this. pep8 is happy. |
| import numpy as np | ||
|
|
||
| # Fixing random state for reproducibility | ||
| np.random.seed(19680801) |
|
Maybe pep8 became less strict about it, or maybe it only requires two blank lines before the function? I prefer to also use two blank lines after (at least for top-level functions). |
|
It only requires two blank lines before a function. It has never required blank lines after. |
|
The seed is, in many places, one blank line away from the function and two blank lines away from the code. This makes it "seem" more related to the function when it's not. So the single blank line after the function is not bad; it's just the implication when coupled with the two blank lines below the seeding. |
|
I think @ivanov noted some other files in |
|
I'll do another PR for those, as they shouldn't be in that folder (it predates the gallery generation scripts). |
|
👍 I like the choice of the seed. |
supersedes #7382