コード例 #1
0
ファイル: test_salpeter.py プロジェクト: vdhelm/amuse
    def test3(self):
        numpy.random.seed(345672)
        instance = SalpeterIMF(0.1 | units.MSun, 100 | units.MSun, alpha=-2.35)
        n = 10000
        total_mass, set_of_masses = instance.next_set(n)

        self.assertAlmostEqual(instance.mass_mean(), 0.35136877959 | units.MSun)
        self.assertAlmostEqual(total_mass / n, 0.35136877959 | units.MSun, 1)
        self.assertAlmostEqual(total_mass / n, 0.33999456911 | units.MSun)
        self.assertAlmostEqual(instance.mass(0.5), set_of_masses.median(), 2)
コード例 #2
0
 def test3(self):
     numpy.random.seed(345672)
     instance = SalpeterIMF(0.1 | units.MSun, 100 | units.MSun, alpha = -2.35)
     n = 10000
     total_mass, set_of_masses = instance.next_set(n)
     
     self.assertAlmostEqual(instance.mass_mean(), 0.35136877959 | units.MSun)
     self.assertAlmostEqual(total_mass / n,       0.35136877959 | units.MSun, 1)
     self.assertAlmostEqual(total_mass / n,       0.33999456911 | units.MSun)
     self.assertAlmostEqual(instance.mass(0.5),   set_of_masses.median(), 2)
コード例 #3
0
 def test4(self):
     instance = SalpeterIMF(0.1 | units.MSun, 125 | units.MSun, alpha=-2.35)
     self.assertAlmostEqual(instance.mass_mean(),
                            0.353943475903 | units.MSun)
コード例 #4
0
 def test1(self):
     instance = SalpeterIMF(0.1 | units.MSun, 100 | units.MSun, alpha=-2.35)
     self.assertAlmostEqual(instance.mass_mean().value_in(units.MSun),
                            0.351, 3)
コード例 #5
0
ファイル: test_salpeter.py プロジェクト: vdhelm/amuse
 def test4(self):
     instance = SalpeterIMF(0.1 | units.MSun, 125 | units.MSun, alpha=-2.35)
     self.assertAlmostEqual(instance.mass_mean(), 0.353943475903 | units.MSun)
コード例 #6
0
ファイル: test_salpeter.py プロジェクト: vdhelm/amuse
 def test1(self):
     instance = SalpeterIMF(0.1 | units.MSun, 100 | units.MSun, alpha=-2.35)
     self.assertAlmostEqual(instance.mass_mean().value_in(units.MSun), 0.351, 3)