def test_parameter_display_set_2(self): MP = ModelParameters() MP.add_model_parameter(name = 'm', theta0 = 2., minimum = -10, maximum = np.inf, sample = True) MP.add_model_parameter(name = 'b', theta0 = -5., minimum = -10, maximum = 100, sample = False) MP.add_model_parameter(name = 'b2', theta0 = -5.3e6, minimum = -1e7, maximum = 1e6, sample = True) MP._openparameterstructure(nbatch = 1) MP.display_parameter_settings(verbosity = None, no_adapt = None)
def test_results_to_params(self): MP = ModelParameters() MP.add_model_parameter('aa', 0) MP._openparameterstructure(nbatch=1) # define minimal results dictionary results = {'parind': MP._parind, 'names': MP._names, 'local': MP._local, 'theta': [1.2]} # initialize default options SO = SimulationOptions() SO.define_simulation_options(verbosity=0) MP.display_parameter_settings(verbosity = SO.verbosity, no_adapt = MP._no_adapt) MP._results_to_params(results, 1) MP._openparameterstructure(nbatch=1) MP.display_parameter_settings(verbosity = SO.verbosity, no_adapt = MP._no_adapt) self.assertEqual(MP.parameters[0]['theta0'], results['theta'][0])