diff --git a/bilby/gw/conversion.py b/bilby/gw/conversion.py index 82a4f2438786d90dc62f978fa22ba9eb674748af..29b4dafd15c478690fadebf68a1d96d4dc0d2392 100644 --- a/bilby/gw/conversion.py +++ b/bilby/gw/conversion.py @@ -278,17 +278,17 @@ def convert_to_lal_binary_neutron_star_parameters(parameters): convert_to_lal_binary_black_hole_parameters(converted_parameters) if not any([key in converted_parameters for key in - ['lambda_1', 'lambda_2', 'lambda_tilde', 'delta_lambda']]): + ['lambda_1', 'lambda_2', 'lambda_tilde', 'delta_lambda_tilde']]): converted_parameters['lambda_1'] = 0 converted_parameters['lambda_2'] = 0 added_keys = added_keys + ['lambda_1', 'lambda_2'] return converted_parameters, added_keys - if 'delta_lambda' in converted_parameters.keys(): + if 'delta_lambda_tilde' in converted_parameters.keys(): converted_parameters['lambda_1'], converted_parameters['lambda_2'] =\ - lambda_tilde_delta_lambda_to_lambda_1_lambda_2( + lambda_tilde_delta_lambda_tilde_to_lambda_1_lambda_2( converted_parameters['lambda_tilde'], - parameters['delta_lambda'], converted_parameters['mass_1'], + parameters['delta_lambda_tilde'], converted_parameters['mass_1'], converted_parameters['mass_2']) elif 'lambda_tilde' in converted_parameters.keys(): converted_parameters['lambda_1'], converted_parameters['lambda_2'] =\ @@ -535,7 +535,7 @@ def lambda_1_lambda_2_to_lambda_tilde(lambda_1, lambda_2, mass_1, mass_2): return lambda_tilde -def lambda_1_lambda_2_to_delta_lambda(lambda_1, lambda_2, mass_1, mass_2): +def lambda_1_lambda_2_to_delta_lambda_tilde(lambda_1, lambda_2, mass_1, mass_2): """ Convert from individual tidal parameters to second domainant tidal term. @@ -554,22 +554,22 @@ def lambda_1_lambda_2_to_delta_lambda(lambda_1, lambda_2, mass_1, mass_2): Return ------ - delta_lambda: float + delta_lambda_tilde: float Second dominant tidal term. """ eta = component_masses_to_symmetric_mass_ratio(mass_1, mass_2) lambda_plus = lambda_1 + lambda_2 lambda_minus = lambda_1 - lambda_2 - delta_lambda = 1 / 2 * ( + delta_lambda_tilde = 1 / 2 * ( (1 - 4 * eta) ** 0.5 * (1 - 13272 / 1319 * eta + 8944 / 1319 * eta**2) * lambda_plus + (1 - 15910 / 1319 * eta + 32850 / 1319 * eta**2 + 3380 / 1319 * eta**3) * lambda_minus) - return delta_lambda + return delta_lambda_tilde -def lambda_tilde_delta_lambda_to_lambda_1_lambda_2( - lambda_tilde, delta_lambda, mass_1, mass_2): +def lambda_tilde_delta_lambda_tilde_to_lambda_1_lambda_2( + lambda_tilde, delta_lambda_tilde, mass_1, mass_2): """ Convert from dominant tidal terms to individual tidal parameters. @@ -579,7 +579,7 @@ def lambda_tilde_delta_lambda_to_lambda_1_lambda_2( ---------- lambda_tilde: float Dominant tidal term. - delta_lambda: float + delta_lambda_tilde: float Secondary tidal term. mass_1: float Mass of more massive neutron star. @@ -602,12 +602,12 @@ def lambda_tilde_delta_lambda_to_lambda_1_lambda_2( 3380 / 1319 * eta**3) lambda_1 =\ (13 * lambda_tilde / 8 * (coefficient_3 - coefficient_4) - - 2 * delta_lambda * (coefficient_1 - coefficient_2))\ + 2 * delta_lambda_tilde * (coefficient_1 - coefficient_2))\ / ((coefficient_1 + coefficient_2) * (coefficient_3 - coefficient_4) - (coefficient_1 - coefficient_2) * (coefficient_3 + coefficient_4)) lambda_2 =\ (13 * lambda_tilde / 8 * (coefficient_3 + coefficient_4) - - 2 * delta_lambda * (coefficient_1 + coefficient_2)) \ + 2 * delta_lambda_tilde * (coefficient_1 + coefficient_2)) \ / ((coefficient_1 - coefficient_2) * (coefficient_3 + coefficient_4) - (coefficient_1 + coefficient_2) * (coefficient_3 - coefficient_4)) return lambda_1, lambda_2 @@ -884,7 +884,7 @@ def generate_tidal_parameters(sample): """ Generate all tidal parameters - lambda_tilde, delta_lambda + lambda_tilde, delta_lambda_tilde Parameters ---------- @@ -902,8 +902,8 @@ def generate_tidal_parameters(sample): lambda_1_lambda_2_to_lambda_tilde( output_sample['lambda_1'], output_sample['lambda_2'], output_sample['mass_1'], output_sample['mass_2']) - output_sample['delta_lambda'] = \ - lambda_1_lambda_2_to_delta_lambda( + output_sample['delta_lambda_tilde'] = \ + lambda_1_lambda_2_to_delta_lambda_tilde( output_sample['lambda_1'], output_sample['lambda_2'], output_sample['mass_1'], output_sample['mass_2']) diff --git a/bilby/gw/prior.py b/bilby/gw/prior.py index b10dec42a3d6f96056282f7aae8f96ba180c8615..b42842a7b69bbd592ba4698961a05feebefff2da 100644 --- a/bilby/gw/prior.py +++ b/bilby/gw/prior.py @@ -403,7 +403,7 @@ class BNSPriorDict(PriorDict): self[key], (DeltaFunction, Constraint))} tidal_parameters = \ - {'lambda_1', 'lambda_2', 'lambda_tilde', 'delta_lambda'} + {'lambda_1', 'lambda_2', 'lambda_tilde', 'delta_lambda_tilde'} if key in tidal_parameters: if len(tidal_parameters.intersection(sampling_parameters)) > 2: @@ -446,7 +446,7 @@ Prior._default_latex_labels = { 'lambda_1': '$\\Lambda_1$', 'lambda_2': '$\\Lambda_2$', 'lambda_tilde': '$\\tilde{\\Lambda}$', - 'delta_lambda': '$\\delta\\Lambda$'} + 'delta_lambda_tilde': '$\\delta\\tilde{\\Lambda}$'} class CalibrationPriorDict(PriorDict): diff --git a/bilby/gw/prior_files/binary_neutron_stars.prior b/bilby/gw/prior_files/binary_neutron_stars.prior index cb5da60d29fa84a2877bc653145fdc1a7db372e1..8c6e0911761ec60c5a4ca90c259e2abf7c8b7a99 100644 --- a/bilby/gw/prior_files/binary_neutron_stars.prior +++ b/bilby/gw/prior_files/binary_neutron_stars.prior @@ -21,4 +21,4 @@ phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic') lambda_1 = Uniform(name='lambda_1', minimum=0, maximum=3000, boundary=None) lambda_2 = Uniform(name='lambda_2', minimum=0, maximum=3000, boundary=None) # lambda_tilde = Uniform(name='lambda_tilde', minimum=0, maximum=5000, boundary=None) -# delta_lambda = Uniform(name='delta_lambda', minimum=-5000, maximum=5000, boundary=None) +# delta_lambda_tilde = Uniform(name='delta_lambda_tilde', minimum=-5000, maximum=5000, boundary=None) diff --git a/bilby/gw/prior_files/precessing_binary_neutron_stars.prior b/bilby/gw/prior_files/precessing_binary_neutron_stars.prior index b8a6f49388c20bd11f9713377b57667c0afd3cf7..913dfd5246a3a1a35621368a8fe512cdb9f5fc09 100644 --- a/bilby/gw/prior_files/precessing_binary_neutron_stars.prior +++ b/bilby/gw/prior_files/precessing_binary_neutron_stars.prior @@ -27,4 +27,4 @@ phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic') lambda_1 = Uniform(name='lambda_1', minimum=0, maximum=3000, boundary=None) lambda_2 = Uniform(name='lambda_2', minimum=0, maximum=3000, boundary=None) # lambda_tilde = Uniform(name='lambda_tilde', minimum=0, maximum=5000, boundary=None) -# delta_lambda = Uniform(name='delta_lambda', minimum=-5000, maximum=5000, boundary=None) +# delta_lambda_tilde = Uniform(name='delta_lambda_tilde', minimum=-5000, maximum=5000, boundary=None) diff --git a/test/conversion_test.py b/test/conversion_test.py index fa6c86197bceea606b0b9184cd18c8b3f8990df5..213756c6ca5157ee6f5b0be42f9dcfc2cb9b16a0 100644 --- a/test/conversion_test.py +++ b/test/conversion_test.py @@ -30,7 +30,7 @@ class TestBasicConversions(unittest.TestCase): - 11 * self.symmetric_mass_ratio**2) * (self.lambda_1 - self.lambda_2) ) - self.delta_lambda = 1 / 2 * ( + self.delta_lambda_tilde = 1 / 2 * ( (1 - 4 * self.symmetric_mass_ratio)**0.5 * (1 - 13272 / 1319 * self.symmetric_mass_ratio + 8944 / 1319 * self.symmetric_mass_ratio**2) @@ -93,10 +93,10 @@ class TestBasicConversions(unittest.TestCase): self.assertTrue(all([abs(self.lambda_1 - lambda_1) < 1e-5, abs(self.lambda_2 - lambda_2) < 1e-5])) - def test_lambda_tilde_delta_lambda_to_lambda_1_lambda_2(self): + def test_lambda_tilde_delta_lambda_tilde_to_lambda_1_lambda_2(self): lambda_1, lambda_2 =\ - conversion.lambda_tilde_delta_lambda_to_lambda_1_lambda_2( - self.lambda_tilde, self.delta_lambda, self.mass_1, self.mass_2) + conversion.lambda_tilde_delta_lambda_tilde_to_lambda_1_lambda_2( + self.lambda_tilde, self.delta_lambda_tilde, self.mass_1, self.mass_2) self.assertTrue(all([abs(self.lambda_1 - lambda_1) < 1e-5, abs(self.lambda_2 - lambda_2) < 1e-5])) @@ -106,11 +106,11 @@ class TestBasicConversions(unittest.TestCase): self.lambda_1, self.lambda_2, self.mass_1, self.mass_2) self.assertTrue((self.lambda_tilde - lambda_tilde) < 1e-5) - def test_lambda_1_lambda_2_to_delta_lambda(self): - delta_lambda = \ - conversion.lambda_1_lambda_2_to_delta_lambda( + def test_lambda_1_lambda_2_to_delta_lambda_tilde(self): + delta_lambda_tilde = \ + conversion.lambda_1_lambda_2_to_delta_lambda_tilde( self.lambda_1, self.lambda_2, self.mass_1, self.mass_2) - self.assertTrue((self.delta_lambda - delta_lambda) < 1e-5) + self.assertTrue((self.delta_lambda_tilde - delta_lambda_tilde) < 1e-5) class TestConvertToLALParams(unittest.TestCase): @@ -134,8 +134,8 @@ class TestConvertToLALParams(unittest.TestCase): self.tidal_parameters = self.component_tidal_parameters.copy() self.tidal_parameters['lambda_tilde'] = \ conversion.lambda_1_lambda_2_to_lambda_tilde(**self.all_component_pars) - self.tidal_parameters['delta_lambda'] = \ - conversion.lambda_1_lambda_2_to_delta_lambda(**self.all_component_pars) + self.tidal_parameters['delta_lambda_tilde'] = \ + conversion.lambda_1_lambda_2_to_delta_lambda_tilde(**self.all_component_pars) def tearDown(self): del self.search_keys @@ -241,8 +241,8 @@ class TestConvertToLALParams(unittest.TestCase): key: self.parameters[key] for key in ['lambda_1', 'lambda_2']} self.assertDictEqual(component_dict, self.component_tidal_parameters) - def test_lambda_tilde_delta_lambda(self): - self._conversion_to_component_tidal(['lambda_tilde', 'delta_lambda']) + def test_lambda_tilde_delta_lambda_tilde(self): + self._conversion_to_component_tidal(['lambda_tilde', 'delta_lambda_tilde']) def test_lambda_tilde(self): self._conversion_to_component_tidal(['lambda_tilde']) diff --git a/test/gw_prior_test.py b/test/gw_prior_test.py index 657571cd9e029bc5654b1f03ab6dc6b7dd41734b..57748331680547a4cd4551ca90772285da3f24e4 100644 --- a/test/gw_prior_test.py +++ b/test/gw_prior_test.py @@ -180,7 +180,7 @@ class TestBNSPriorDict(unittest.TestCase): def test_redundant_priors_not_in_dict_before(self): for prior in ['chirp_mass', 'total_mass', 'mass_ratio', 'symmetric_mass_ratio', 'cos_theta_jn', 'comoving_distance', - 'redshift', 'lambda_tilde', 'delta_lambda']: + 'redshift', 'lambda_tilde', 'delta_lambda_tilde']: self.assertTrue(self.bns_prior_dict.test_redundancy(prior)) def test_redundant_priors_already_in_dict(self): @@ -211,7 +211,7 @@ class TestBNSPriorDict(unittest.TestCase): def test_correct_not_redundant_priors_tidal(self): del self.bns_prior_dict['lambda_1'] - for prior in['lambda_1', 'lambda_tilde', 'delta_lambda']: + for prior in['lambda_1', 'lambda_tilde', 'delta_lambda_tilde']: self.assertFalse(self.bns_prior_dict.test_redundancy(prior)) def test_add_unrelated_prior(self):