Пример #1
0
    def test_csv_single_false(self):
        csv = db.csv("UnitTest_tmp", self.parnames, self.like, self.randompar, simulations=self.simulations,
                     chains=1, save_sim=False)

        csv.save(self.like, self.randompar, self.simulations)

        csv.finalize()
        csvdata = csv.getdata()
        self.assertEqual(str(type(csvdata)), "<class 'numpy.ndarray'>")
        self.assertEqual(len(csvdata[0]), 7)
        self.assertEqual(len(csvdata), 2)
        self.assertEqual(len(csv.header), 7)
Пример #2
0
    def test_csv_multiline(self):
        csv = db.csv("UnitTest_tmp", self.parnames, self.like, self.randompar, simulations=self.simulations_multi,
                          chains=1, save_sim=True)

        csv.save(self.like ,self.randompar,self.simulations_multi)
        # Save Simulations

        csv.finalize()
        csvdata = csv.getdata()
        self.assertEqual(str(type(csvdata)), "<class 'numpy.ndarray'>")
        self.assertEqual(len(csvdata[0]), 32)
        self.assertEqual(len(csvdata), 2)
        self.assertEqual(len(csv.header), 32)
Пример #3
0
    def test_csv_single(self):
        csv = db.csv("UnitTest_tmp",
                     self.parnames,
                     self.like,
                     self.randompar,
                     simulations=self.simulations,
                     chains=1,
                     save_sim=True)

        csv.save(self.like, self.randompar, self.simulations)

        csv.finalize()
        csvdata = csv.getdata()
        self.assertEqual(str(type(csvdata)), str(type(np.array([]))))
        self.assertEqual(len(csvdata[0]), 12)
        self.assertEqual(len(csvdata), 2)
        self.assertEqual(len(csv.header), 12)
Пример #4
0
    def test_csv_multiline_false(self):
        # Save not Simulations
        csv = db.csv("UnitTest_tmp",
                     self.parnames,
                     self.like,
                     self.randompar,
                     simulations=self.simulations_multi,
                     chains=1,
                     save_sim=False)

        csv.save(self.like, self.randompar, self.simulations_multi)

        csv.finalize()
        csvdata = csv.getdata()
        self.assertEqual(str(type(csvdata)), str(type(np.array([]))))
        self.assertEqual(len(csvdata[0]), 7)
        self.assertEqual(len(csvdata), 2)
        self.assertEqual(len(csv.header), 7)