@@ -494,6 +494,36 @@ def test_json():
494494 q_loaded .update (stim = q_loaded .next_stim , outcome = dict (response = 'Correct' ))
495495
496496
497+ def test_json_rng ():
498+ threshold = np .arange (- 40 , 0 + 1 )
499+ slope , guess , lapse = 3.5 , 0.5 , 0.02
500+ contrasts = threshold .copy ()
501+
502+ stim_domain = dict (intensity = contrasts )
503+ param_domain = dict (threshold = threshold , slope = slope ,
504+ lower_asymptote = guess , lapse_rate = lapse )
505+ outcome_domain = dict (response = ['Correct' , 'Incorrect' ])
506+ f = 'weibull'
507+ scale = 'dB'
508+ stim_selection_method = 'min_n_entropy'
509+ param_estimation_method = 'mode'
510+ random_seed = 5
511+ stim_selection_options = dict (n = 3 , random_seed = random_seed )
512+
513+ q = QuestPlus (stim_domain = stim_domain , param_domain = param_domain ,
514+ outcome_domain = outcome_domain , func = f , stim_scale = scale ,
515+ stim_selection_method = stim_selection_method ,
516+ param_estimation_method = param_estimation_method ,
517+ stim_selection_options = stim_selection_options )
518+
519+ q2 = QuestPlus .from_json (q .to_json ())
520+
521+ rand = q ._rng .random_sample (10 )
522+ rand2 = q2 ._rng .random_sample (10 )
523+
524+ assert np .allclose (rand , rand2 )
525+
526+
497527def test_marginal_posterior ():
498528 contrasts = np .arange (- 40 , 0 + 1 )
499529 slope = np .arange (2 , 5 + 1 )
@@ -688,6 +718,7 @@ def test_weibull_prior():
688718 test_weibull ()
689719 test_eq ()
690720 test_json ()
721+ test_json_rng ()
691722 test_marginal_posterior ()
692723 test_prior_for_unknown_parameter ()
693724 test_prior_for_parameter_subset ()
0 commit comments