Beispiel #1
0
def test_hybrid_sampling(pipe):
    n_walkers, p0, hybrid_lnpost = get_walkers(pipe, lnpost_fn=lnpost)
    n_walkers *= 2
    p0 = np.concatenate([p0, p0])
    with pipe.worker_mode:
        if pipe._is_controller:
            sampler = EnsembleSampler(n_walkers, pipe._modellink._n_par,
                                      hybrid_lnpost, args=[pipe])
            sampler.run_mcmc(p0, 10)
Beispiel #2
0
 def test_default(self, pipe):
     if (pipe._size == 1):
         with pytest.raises(RequestError):
             get_walkers(pipe)
     pipe.analyze()
     get_walkers(pipe)
     pipe.construct()
     get_walkers(pipe, emul_i=1, unit_space=True)
Beispiel #3
0
 def test_custom_lnpost(self, pipe):
     get_walkers(pipe, lnpost_fn=lnpost)
Beispiel #4
0
 def test_no_plausible_init_walkers(self, pipe):
     with pytest.raises(e13.InputError):
         get_walkers(pipe,
                     init_walkers=e13.lhd(1, pipe._modellink._n_par,
                                          pipe._modellink._par_rng,
                                          'center', pipe._criterion, 100))
Beispiel #5
0
 def test_req_n_walkers(self, pipe):
     if pipe._is_controller:
         req_n_walkers = pipe._comm.bcast(pipe._n_impl_sam[-1]+1, 0)
     else:
         req_n_walkers = pipe._comm.bcast(None, 0)
     get_walkers(pipe, req_n_walkers=req_n_walkers)
Beispiel #6
0
 def test_init_walkers_size(self, pipe):
     get_walkers(pipe, init_walkers=10)
Beispiel #7
0
 def test_init_walkers_set(self, pipe):
     get_walkers(pipe,
                 init_walkers=e13.lhd(10, pipe._modellink._n_par, None,
                                      'center', pipe._criterion, 100),
                 unit_space=True)
Beispiel #8
0
 def test_non_callable(self, pipe):
     with pytest.raises(e13.InputError):
         get_walkers(pipe, lnpost_fn=np.array(1))
Beispiel #9
0
 def test_invalid_emulator(self, pipe):
     pipe._emulator._emul_type = 'test'
     with pytest.raises(e13.InputError):
         get_walkers(pipe)
     pipe._emulator._emul_type = 'default'
Beispiel #10
0
 def test_no_Pipeline(self):
     with pytest.raises(TypeError):
         get_walkers(np.array(1))