Example #1
0
 def test_multi_call_ModelLink(self, pipe):
     with pytest.warns(RequestWarning):
         pipe._modellink.call_type = 'multi'
     if pipe._is_controller:
         with pytest.warns(UserWarning):
             get_hybrid_lnpost_fn(lnpost, pipe)
     else:
         get_hybrid_lnpost_fn(lnpost, pipe)
     pipe._modellink.call_type = 'hybrid'
Example #2
0
 def test_non_default(self, pipe):
     hybrid_lnpost = get_hybrid_lnpost_fn(lnpost,
                                          pipe,
                                          par_dict=True,
                                          unit_space=True,
                                          impl_prior=False)
     assert hybrid_lnpost({'A': 0.5, 'B': 0.5}, pipe) == -np.infty
     hybrid_lnpost(
         sdict(zip(pipe._modellink._par_name, pipe._modellink._par_est)),
         pipe)
Example #3
0
 def test_invalid_emulator(self, pipe):
     pipe._emulator._emul_type = 'test'
     with pytest.raises(e13.InputError):
         get_hybrid_lnpost_fn(lnpost, pipe)
     pipe._emulator._emul_type = 'default'
Example #4
0
 def test_no_Pipeline(self):
     with pytest.raises(TypeError):
         get_hybrid_lnpost_fn(lnpost, np.array(1))
Example #5
0
 def test_non_callable(self, pipe):
     with pytest.raises(e13.InputError):
         get_hybrid_lnpost_fn(np.array(1), pipe)
Example #6
0
 def test_default(self, pipe):
     hybrid_lnpost = get_hybrid_lnpost_fn(lnpost, pipe, unit_space=True)
     assert hybrid_lnpost([-1, 2], pipe) == -np.infty
     assert hybrid_lnpost([0.5, 0.5], pipe) == -np.infty
     hybrid_lnpost(pipe._modellink._to_unit_space(pipe._modellink._par_est),
                   pipe)