Beispiel #1
0
def one_point_five_generation_mass_ratio(dataset, spectal_index, mmin):
    split = 0.5
    prob = (powerlaw(
        dataset["mass_ratio"],
        spectal_index,
        high=split,
        low=mmin / dataset["mass_1"],
    ) * (dataset["mass_ratio"] <= split) + powerlaw(
        1 - dataset["mass_ratio"],
        spectal_index,
        high=split,
        low=mmin / dataset["mass_1"],
    ) * (dataset["mass_ratio"] >= split)) / 2
    return prob
Beispiel #2
0
 def test_powerlaw_zero_above_high(self):
     equal_zero = True
     for ii in range(self.n_test):
         xx = self.highs[ii] + 1
         vals = utils.powerlaw(
             xx=xx, alpha=self.alphas[ii], low=self.lows[ii], high=self.highs[ii]
         )
         equal_zero = equal_zero & (vals == 0.0)
     self.assertTrue(equal_zero)
Beispiel #3
0
 def test_powerlaw_alpha_equal_zero(self):
     self.assertEqual(
         utils.powerlaw(xx=1.0, alpha=-1, low=0.5, high=2), 1 / np.log(4)
     )
Beispiel #4
0
 def test_powerlaw_low_below_zero_raises_value_error(self):
     with self.assertRaises(ValueError):
         utils.powerlaw(xx=0, alpha=3, high=10, low=-4)