Ejemplo n.º 1
0
 def test9(self):
     print "Test for saving and loading the stellar structure model"
     filenames = ["test1.dump", "test2.dump"]
     filenames = [os.path.join(get_path_to_results(), name) for name in filenames]
     instance = EVtwin(redirection="none")
     instance.parameters.verbosity = True
     instance.particles.add_particles(Particles(mass=[0.5, 0.8] | units.MSun))
     instance.evolve_model()
     instance.particles.write_star_to_file(filenames)
     copies = Particles(2)
     copies.filename = filenames
     instance.particles.add_particles(copies)
     instance.evolve_model()
     print instance.particles
     self.assertAlmostRelativeEquals(instance.particles.temperature, [3644, 4783, 3644, 4783] | units.K, 3)
     instance.stop()
Ejemplo n.º 2
0
 def test9(self):
     print "Test for saving and loading the stellar structure model"
     filenames = ["test1.dump", "test2.dump"]
     filenames = [os.path.join(get_path_to_results(), name) for name in filenames]
     instance = EVtwin()#redirection="none")
     instance.parameters.verbosity = True
     instance.particles.add_particles(Particles(mass = [0.5, 0.8] | units.MSun))
     instance.evolve_model()
     instance.particles.write_star_to_file(filenames)
     copies = Particles(2)
     copies.filename = filenames
     instance.particles.add_particles(copies)
     instance.evolve_model()
     print instance.particles
     import warnings
     warnings.warn("this test's precision has been temporarily (2017) decreased")
     # the reason for this is that the deviation is compiler dependend (and does only happen 
     # on some machine/compiler/OS combinations)
     # it may have something to do with initialization of variables in evtwin
     #~ self.assertAlmostRelativeEquals(instance.particles.temperature, [3644, 4783, 3644, 4783] | units.K, 3)
     self.assertAlmostRelativeEquals(instance.particles.temperature, [3644, 4783, 3644, 4783] | units.K, 2)
     instance.stop()