Пример #1
0
 def test_mmax_above_global_maximum_raises_error(self):
     model = mass.SinglePeakSmoothedMassDistribution(mmin=5, mmax=150)
     parameters = self.gauss_prior.sample()
     parameters.update(self.power_prior.sample())
     parameters.update(self.smooth_prior.sample())
     parameters["mmax"] = 200
     with self.assertRaises(ValueError):
         model(self.dataset, **parameters)
Пример #2
0
 def test_single_peak_normalised(self):
     norms = list()
     for ii in range(self.n_test):
         parameters = self.power_prior.sample()
         parameters.update(self.gauss_prior.sample())
         parameters.update(self.smooth_prior.sample())
         p_m = mass.SinglePeakSmoothedMassDistribution()(self.dataset, **parameters)
         norms.append(trapz(trapz(p_m, self.m1s), self.qs))
     self.assertAlmostEqual(_max_abs_difference(norms, 1.0), 0.0, 2)
Пример #3
0
 def test_single_peak_delta_m_zero_matches_two_component_primary_mass_ratio(self):
     max_diffs = list()
     for ii in range(self.n_test):
         parameters = self.power_prior.sample()
         parameters.update(self.gauss_prior.sample())
         p_m1 = mass.two_component_primary_mass_ratio(self.dataset, **parameters)
         parameters["delta_m"] = 0
         p_m2 = mass.SinglePeakSmoothedMassDistribution()(self.dataset, **parameters)
         max_diffs.append(_max_abs_difference(p_m1, p_m2))
     self.assertAlmostEqual(max(max_diffs), 0.0)
Пример #4
0
 def test_set_minimum_and_maximum(self):
     model = mass.SinglePeakSmoothedMassDistribution(mmin=5, mmax=150)
     parameters = self.gauss_prior.sample()
     parameters.update(self.power_prior.sample())
     parameters.update(self.smooth_prior.sample())
     parameters["mpp"] = 130
     parameters["sigpp"] = 1
     parameters["lam"] = 0.5
     parameters["mmin"] = 5
     self.assertEqual(
         model(dict(mass_1=8 * np.ones(5), mass_ratio=0.5 * np.ones(5)),
               **parameters)[0],
         0,
     )
     self.assertGreater(
         model(dict(mass_1=130 * np.ones(5), mass_ratio=0.9 * np.ones(5)),
               **parameters)[0],
         0,
     )