Skip to content

Commit

Permalink
Merge pull request #102 from adrn/numpy-random-gen
Browse files Browse the repository at this point in the history
Use new numpy random number generator
  • Loading branch information
adrn authored May 5, 2020
2 parents 75a521e + bf0d5f7 commit fa948a7
Show file tree
Hide file tree
Showing 17 changed files with 630 additions and 109 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
1.2 (unreleased)
================

- ``TheJoker`` now expects a ``numpy.random.Generator`` instance instead of a
``RandomState`` for controlling random number generation.

1.1 (2020-04-19)
================

Expand Down
11 changes: 6 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@
intersphinx_mapping['scwhimmbad'] = (
'https://schwimmbad.readthedocs.io/en/latest/', None)

# see if we're running on travis
if 'CI' in os.environ:
ON_CI = True
else:
ON_CI = False
# see if we're running on CI:
ON_CI = os.environ.get("CI", False)
PR = os.environ.get("CIRCLE_PULL_REQUEST", False)

# Use astropy plot style
plot_rcparams = dict()
Expand Down Expand Up @@ -214,6 +212,9 @@

nbsphinx_timeout = 600

if PR:
nbsphinx_execute = 'never'

if ON_CI:
nbsphinx_kernel_name = 'python3'

Expand Down
19 changes: 16 additions & 3 deletions docs/examples/1-Getting-started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"metadata": {},
"outputs": [],
"source": [
"# set up a random state to ensure reproducibility\n",
"rnd = np.random.RandomState(seed=42)"
"# set up a random generator to ensure reproducibility\n",
"rnd = np.random.default_rng(seed=42)"
]
},
{
Expand Down Expand Up @@ -468,7 +468,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
19 changes: 16 additions & 3 deletions docs/examples/2-Customize-prior.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"metadata": {},
"outputs": [],
"source": [
"# set up a random state to ensure reproducibility\n",
"rnd = np.random.RandomState(seed=42)"
"# set up a random number generator to ensure reproducibility\n",
"rnd = np.random.default_rng(seed=42)"
]
},
{
Expand Down Expand Up @@ -236,7 +236,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
19 changes: 16 additions & 3 deletions docs/examples/3-Polynomial-velocity-trend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"metadata": {},
"outputs": [],
"source": [
"# set up a random state to ensure reproducibility\n",
"rnd = np.random.RandomState(seed=42)"
"# set up a random number generator to ensure reproducibility\n",
"rnd = np.random.default_rng(seed=42)"
]
},
{
Expand Down Expand Up @@ -287,7 +287,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
19 changes: 16 additions & 3 deletions docs/examples/4-Continue-sampling-mcmc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"metadata": {},
"outputs": [],
"source": [
"# set up a random state to ensure reproducibility\n",
"rnd = np.random.RandomState(seed=42)"
"# set up a random number generator to ensure reproducibility\n",
"rnd = np.random.default_rng(seed=42)"
]
},
{
Expand Down Expand Up @@ -275,7 +275,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
19 changes: 16 additions & 3 deletions docs/examples/5-Calibration-offsets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"metadata": {},
"outputs": [],
"source": [
"# set up a random state to ensure reproducibility\n",
"rnd = np.random.RandomState(seed=42)"
"# set up a random number generator to ensure reproducibility\n",
"rnd = np.random.default_rng(seed=42)"
]
},
{
Expand Down Expand Up @@ -261,7 +261,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
17 changes: 15 additions & 2 deletions docs/examples/Strader-circular-only.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"metadata": {},
"outputs": [],
"source": [
"# For reproducibility:\n",
"# set up a random number generator to ensure reproducibility\n",
"seed = 42\n",
"rnd = np.random.RandomState(42)"
"rnd = np.random.default_rng(seed=seed)"
]
},
{
Expand Down Expand Up @@ -380,6 +380,19 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit fa948a7

Please sign in to comment.