예제 #1
0
파일: test_smalln.py 프로젝트: Ingwar/amuse
 def test6(self):
     print "Test6: Testing SmallN parameters"
     convert_nbody = nbody_system.nbody_to_si(1.0 | units.yr, 1.0 | units.AU)
     instance = SmallN(convert_nbody)
     instance.initialize_code()
     
    
     value = instance.get_eta()
     self.assertEquals(0.14, value)
     self.assertAlmostEquals(0.14, instance.parameters.timestep_parameter)
     for x in [0.001, 0.01, 0.1]:
         instance.parameters.timestep_parameter = x
         self.assertAlmostEquals(x, instance.parameters.timestep_parameter)
     
     
     value = instance.get_time()
     self.assertEquals(0| units.yr, value)
     
     value = instance.get_gamma()
     self.assertEquals(1e-6, value)
     self.assertAlmostEquals(1e-6, instance.parameters.unperturbed_threshold)
     for x in [0.001, 0.01, 0.1]:
         instance.parameters.unperturbed_threshold = x
         self.assertAlmostEquals(x, instance.parameters.unperturbed_threshold)
     instance.stop()
예제 #2
0
    def test6(self):
        print("Test6: Testing SmallN parameters")
        convert_nbody = nbody_system.nbody_to_si(1.0 | units.yr,
                                                 1.0 | units.AU)
        instance = SmallN(convert_nbody)
        instance.initialize_code()

        value = instance.get_eta()
        self.assertEqual(0.14, value)
        self.assertAlmostEqual(0.14, instance.parameters.timestep_parameter)
        for x in [0.001, 0.01, 0.1]:
            instance.parameters.timestep_parameter = x
            self.assertAlmostEqual(x, instance.parameters.timestep_parameter)

        value = instance.get_time()
        self.assertEqual(0 | units.yr, value)

        value = instance.get_gamma()
        self.assertEqual(1e-6, value)
        self.assertAlmostEqual(1e-6, instance.parameters.unperturbed_threshold)
        for x in [0.001, 0.01, 0.1]:
            instance.parameters.unperturbed_threshold = x
            self.assertAlmostEqual(x,
                                   instance.parameters.unperturbed_threshold)
        instance.stop()