def test_parameters(self): """ make sure that new parameter sets are being inserted into the model before running the estimation :return: """ CPE = tasks.ChaserParameterEstimations(self.MPE, truncate_mode='ranks', theta=range(2), run_mode=True, tolerance=1e-1, iteration_limit=5) ## get parameters that were estimated in MPE pe_data = viz.Parse(self.MPE).data ## get keys to ordered dict keys = CPE.pe_dct.keys() ## key 0 should have best parameter set from MPE zero = CPE.pe_dct[keys[0]] pe_data0 = pe_data.iloc[0] model_params = zero.model.parameters pe_data.drop('RSS', inplace=True, axis=1) for i in pe_data.keys(): self.assertAlmostEqual(float(model_params[i]), float(pe_data0[i]))
def test_run_true(self): CPE = tasks.ChaserParameterEstimations(self.MPE, truncate_mode='ranks', theta=range(2), run_mode=True, tolerance=1e-1, iteration_limit=5) results = viz.Parse(CPE).data self.assertEqual(results.shape[0], 2)
def do_profile_likelihood(self): data = viz.Parse(self.MPE).data pl = tasks.ProfileLikelihood(model=self.mod, df=data, index=0, run=True, tolerance=1e1, iteration_limit=5) viz.PlotProfileLikelihood(pl, savefig=True, y=['RSS', 'kADeg']) return pl
def test_from_folder_generated_with_chaser_estimations(self): MPE = tasks.MultiParameterEstimation(self.mod, self.TC.report_name, method='genetic_algorithm', population_size=5, number_of_generations=5, run_mode=True, copy_number=self.copy_number, pe_number=self.pe_number) MPE.write_config_file() MPE.setup() MPE.run() CPE = tasks.ChaserParameterEstimations(MPE, truncate_mode='ranks', theta=list(range(2)), tolerance=1e-2, iteration_limit=5, run_mode=True) data = viz.Parse(CPE.results_directory, copasi_file=CPE.model.copasi_file).data print(data) self.assertEqual(data.shape[0], 2)
def test_MPE_worked(self): data = viz.Parse(self.MPE).data self.assertEqual(data.shape[0], self.copy_number * self.pe_number)
def test_read_data(self): data = viz.Parse(self.MPE).data print(viz.TruncateData(data=data, mode='ranks', theta=[0, 1]).data)
def test(self): print viz.Parse(self.MPE)