Skip to content

Commit

Permalink
use default_rng in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrn committed May 5, 2020
1 parent e622d33 commit 7710bd9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion thejoker/src/tests/py_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def rejection_sample(samples, prior, data, rnd=None):
mu = np.zeros(n_linear)

if rnd is None:
rnd = np.random.RandomState()
rnd = np.random.default_rng()

ll = marginal_ln_likelihood(samples, prior, data)
uu = rnd.uniform(size=len(ll))
Expand Down
6 changes: 3 additions & 3 deletions thejoker/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_guess_time_format():

def get_valid_input(rnd=None, size=32):
if rnd is None:
rnd = np.random.RandomState(42)
rnd = np.random.default_rng(42)

t_arr = rnd.uniform(55555., 56012., size=size)
t_obj = Time(t_arr, format='mjd')
Expand Down Expand Up @@ -71,7 +71,7 @@ def get_valid_input(rnd=None, size=32):


def test_rvdata_init():
rnd = np.random.RandomState(42)
rnd = np.random.default_rng(42)

# Test valid initialization combos
# These should succeed:
Expand Down Expand Up @@ -262,7 +262,7 @@ def test_multi_data():
import exoplanet.units as xu
import pymc3 as pm

rnd = np.random.RandomState(42)
rnd = np.random.default_rng(42)

# Set up mulitple valid data objects:
_, raw1 = get_valid_input(rnd=rnd)
Expand Down
2 changes: 1 addition & 1 deletion thejoker/tests/test_likelihood_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def test_design_matrix():
# implicitly tests get_constant_term_design_matrix
rnd = np.random.RandomState(42)
rnd = np.random.default_rng(42)

# Set up mulitple valid data objects:
ndata1 = 8
Expand Down

0 comments on commit 7710bd9

Please sign in to comment.