Example #1
0
    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]))
Example #2
0
 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 test_pe_dict_is_created(self):
     """
     configuration is parallelized. This tests that the
     pe_dict containing cps files and sub parameter estimation
     is correctly created. 
     :return: 
     """
     CPE = tasks.ChaserParameterEstimations(self.MPE, truncate_mode='ranks',
                                            theta=list(range(2)), run_mode=False,
                                            tolerance=1e-1, iteration_limit=5)
     # print viz.Parse(CPE).data
     self.assertTrue(len(list(CPE.pe_dct.items())) == self.copy_number)
Example #4
0
    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)