Exemplo n.º 1
0
    def test4(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle(1.)
        self.assertEqual(error, 0)
        self.assertEqual(index, 1)
        for t in range(46):
            error = instance.evolve_model((t + 1) * 100)
            self.assertEqual(error, 0)

        mass, error = instance.get_mass(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 1.0, 6)
        value, error = instance.get_radius(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(value, 0.9856, 4)
        value, error = instance.get_temperature(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(value, 5751, 4)
        value, error = instance.get_time_step(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(value, 1089.3, 4)

        stellar_type, error = instance.get_stellar_type(index)
        self.assertEqual(error, 0)
        self.assertEqual(stellar_type, 1)

        instance.stop()
Exemplo n.º 2
0
    def test4(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle(1.)
        self.assertEquals(error, 0)
        self.assertEquals(index, 1)
        for t in range(46):
            error = instance.evolve_model((t+1) * 100)
            self.assertEquals(error, 0)

        mass, error = instance.get_mass(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 1.0, 6)
        value, error = instance.get_radius(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(value, 0.9856, 4)
        value, error = instance.get_temperature(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(value, 5751, 4)
        value, error = instance.get_time_step(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(value, 1089.3, 4)

        stellar_type, error = instance.get_stellar_type(index)
        self.assertEquals(error, 0)
        self.assertEquals(stellar_type, 1)

        instance.stop()
Exemplo n.º 3
0
    def test5(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle([1., 2., 3.])
        self.assertEqual(error, 0)
        self.assertEqual(index, [1, 2, 3])

        mass, error = instance.get_mass(2)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 2, 6)

        mass, error = instance.get_mass(3)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)

        error = instance.evolve_model(4600)
        self.assertEqual(error, 0)

        mass, error = instance.get_mass(index)
        print(mass)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass[0], 1.0, 6)
        self.assertAlmostRelativeEqual(mass[1], 0.62973, 4)
        self.assertAlmostRelativeEqual(mass[2], 0.75012, 4)

        instance.stop()
Exemplo n.º 4
0
    def test7(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle([1., 2., 3.])
        self.assertEquals(error, 0)
        self.assertEquals(index, [1,2,3])

        mass, error = instance.get_mass(2)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 2 , 6)

        mass, error = instance.get_mass(3)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)

        mass, error = instance.get_mass(4)
        self.assertEquals(error, -1)

        error = instance.delete_star(2)
        self.assertEquals(error, 0)

        mass, error = instance.get_mass(2)
        self.assertEquals(error, -1)

        mass, error = instance.get_mass(3)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)

        index, error = instance.new_particle(4.)
        self.assertEquals(error, 0)
        self.assertEquals(index, 4)

        instance.stop()
Exemplo n.º 5
0
    def test5(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle([1., 2., 3.])
        self.assertEquals(error, 0)
        self.assertEquals(index, [1,2,3])

        mass, error = instance.get_mass(2)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 2 , 6)

        mass, error = instance.get_mass(3)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)


        error = instance.evolve_model(4600)
        self.assertEquals(error, 0)

        mass, error = instance.get_mass(index)
        print mass
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass[0], 1.0, 6)
        self.assertAlmostRelativeEqual(mass[1], 0.62973, 4)
        self.assertAlmostRelativeEqual(mass[2], 0.75012, 4)


        instance.stop()
Exemplo n.º 6
0
    def test8(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle([3.0,1.0,2.0])
        self.assertEquals(error, 0)
        self.assertEquals(index, [1,2,3])

        error = instance.delete_star(1)
        self.assertEquals(error, 0)

        error = instance.evolve_model(4600);

        mass, error = instance.get_mass(2)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 1, 6)

        error = instance.delete_star(3)
        self.assertEquals(error, 0)


        index,error = instance.new_particle([5.0])
        self.assertEquals(error, 0)

        mass, error = instance.get_mass(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 5.0, 6)
        error = instance.evolve_model(5000);


        mass, error = instance.get_mass(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 0.99057, 4)

        error = instance.delete_star(2)
        self.assertEquals(error, 0)
        error = instance.delete_star(index)
        self.assertEquals(error, 0)

        for i in range(4):
            mass, error = instance.get_mass(index+1)
            self.assertEquals(error, -1)

        index,error = instance.new_particle([5.0])
        self.assertEquals(error, 0)

        error = instance.evolve_model(10000);

        mass, error = instance.get_mass(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 0.99057, 4)

        instance.stop()
Exemplo n.º 7
0
    def test8(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle([3.0, 1.0, 2.0])
        self.assertEqual(error, 0)
        self.assertEqual(index, [1, 2, 3])

        error = instance.delete_star(1)
        self.assertEqual(error, 0)

        error = instance.evolve_model(4600)

        mass, error = instance.get_mass(2)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 1, 6)

        error = instance.delete_star(3)
        self.assertEqual(error, 0)

        index, error = instance.new_particle([5.0])
        self.assertEqual(error, 0)

        mass, error = instance.get_mass(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 5.0, 6)
        error = instance.evolve_model(5000)

        mass, error = instance.get_mass(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 0.99057, 4)

        error = instance.delete_star(2)
        self.assertEqual(error, 0)
        error = instance.delete_star(index)
        self.assertEqual(error, 0)

        for i in range(4):
            mass, error = instance.get_mass(index + 1)
            self.assertEqual(error, -1)

        index, error = instance.new_particle([5.0])
        self.assertEqual(error, 0)

        error = instance.evolve_model(10000)

        mass, error = instance.get_mass(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 0.99057, 4)

        instance.stop()
Exemplo n.º 8
0
    def test6(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle([1., 2., 3.])
        self.assertEquals(error, 0)
        self.assertEquals(index, [1,2,3])

        for t in range(46):
            error = instance.evolve_model((t+1) * 100)
            self.assertEquals(error, 0)

        mass, error = instance.get_mass(index)
        print mass
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, [1.0, 0.62973, 0.75072], 4)

        instance.stop()
Exemplo n.º 9
0
    def test6(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle([1., 2., 3.])
        self.assertEqual(error, 0)
        self.assertEqual(index, [1, 2, 3])

        for t in range(46):
            error = instance.evolve_model((t + 1) * 100)
            self.assertEqual(error, 0)

        mass, error = instance.get_mass(index)
        print(mass)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, [1.0, 0.62973, 0.75072], 4)

        instance.stop()
Exemplo n.º 10
0
    def test2(self):
        instance = SeBaInterface() #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEquals(error, 0)

        index,error = instance.new_particle(1.)
        self.assertEquals(error, 0)
        self.assertEquals(index, 1)
        mass, error = instance.get_mass(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(mass, 1.0, 6)
        value, error = instance.get_radius(index)
        self.assertEquals(error, 0)
        self.assertAlmostRelativeEqual(value, 0.88824945029751212, 6)

        stellar_type, error = instance.get_stellar_type(index)
        self.assertEquals(error, 0)
        self.assertEquals(stellar_type, 1)

        instance.stop()
Exemplo n.º 11
0
    def test2(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle(1.)
        self.assertEqual(error, 0)
        self.assertEqual(index, 1)
        mass, error = instance.get_mass(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 1.0, 6)
        value, error = instance.get_radius(index)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(value, 0.88824945029751212, 6)

        stellar_type, error = instance.get_stellar_type(index)
        self.assertEqual(error, 0)
        self.assertEqual(stellar_type, 1)

        instance.stop()
Exemplo n.º 12
0
    def test7(self):
        instance = SeBaInterface(
        )  #self.new_instance_of_an_optional_code(SeBaInterface)
        error = instance.initialize_code()
        self.assertEqual(error, 0)

        index, error = instance.new_particle([1., 2., 3.])
        self.assertEqual(error, 0)
        self.assertEqual(index, [1, 2, 3])

        mass, error = instance.get_mass(2)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 2, 6)

        mass, error = instance.get_mass(3)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)

        mass, error = instance.get_mass(4)
        self.assertEqual(error, -1)

        error = instance.delete_star(2)
        self.assertEqual(error, 0)

        mass, error = instance.get_mass(2)
        self.assertEqual(error, -1)

        mass, error = instance.get_mass(3)
        self.assertEqual(error, 0)
        self.assertAlmostRelativeEqual(mass, 3, 6)

        index, error = instance.new_particle(4.)
        self.assertEqual(error, 0)
        self.assertEqual(index, 4)

        instance.stop()