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'
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)
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'
def test_no_Pipeline(self): with pytest.raises(TypeError): get_hybrid_lnpost_fn(lnpost, np.array(1))
def test_non_callable(self, pipe): with pytest.raises(e13.InputError): get_hybrid_lnpost_fn(np.array(1), pipe)
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)