-
Notifications
You must be signed in to change notification settings - Fork 139
TST: change all likelihood and waveform tests to use more recent waveforms (#791) #897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
8634b6f
ec6fed1
ae08630
bb82c36
1794705
9451577
32ee9d0
f57ad68
94cc6dd
3b82723
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,8 +283,8 @@ def setUp(self): | |
| # Possible locations for the ROQ: in the docker image, local, or on CIT | ||
| trial_roq_paths = [ | ||
| "/roq_basis", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomPv2/4s"), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the case above
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And applied to the comments as well |
||
| "/home/cbc/ROQ_data/IMRPhenomPv2/4s", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomXPHM/4s"), | ||
| "/home/cbc/ROQ_data/IMRPhenomXPHM/4s", | ||
| ] | ||
| roq_dir = None | ||
| for path in trial_roq_paths: | ||
|
|
@@ -331,7 +331,7 @@ def setUp(self): | |
| self.priors = bilby.gw.prior.BBHPriorDict() | ||
| self.priors.pop("mass_1") | ||
| self.priors.pop("mass_2") | ||
| # Testing is done with the 4s IMRPhenomPV2 ROQ basis | ||
| # Testing is done with the 4s IMRPhenomXPHM ROQ basis | ||
| self.priors["chirp_mass"] = bilby.core.prior.Uniform(12.299703, 45) | ||
| self.priors["mass_ratio"] = bilby.core.prior.Uniform(0.125, 1) | ||
| self.priors["geocent_time"] = bilby.core.prior.Uniform(1.19, 1.21) | ||
|
|
@@ -343,7 +343,7 @@ def setUp(self): | |
| waveform_arguments=dict( | ||
| reference_frequency=20.0, | ||
| minimum_frequency=20.0, | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| ), | ||
| ) | ||
|
|
||
|
|
@@ -361,7 +361,7 @@ def setUp(self): | |
| frequency_nodes_linear=fnodes_linear, | ||
| frequency_nodes_quadratic=fnodes_quadratic, | ||
| reference_frequency=20.0, | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| ), | ||
| ) | ||
|
|
||
|
|
@@ -546,8 +546,8 @@ def test_rescaling(self): | |
| # Possible locations for the ROQ: in the docker image, local, or on CIT | ||
| trial_roq_paths = [ | ||
| "/roq_basis", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomPv2/4s"), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And again. |
||
| "/home/cbc/ROQ_data/IMRPhenomPv2/4s", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomXPHM/4s"), | ||
| "/home/cbc/ROQ_data/IMRPhenomXPHM/4s", | ||
| ] | ||
| roq_dir = None | ||
| for path in trial_roq_paths: | ||
|
|
@@ -583,7 +583,7 @@ def test_rescaling(self): | |
| self.priors = bilby.gw.prior.BBHPriorDict() | ||
| self.priors.pop("mass_1") | ||
| self.priors.pop("mass_2") | ||
| # Testing is done with the 4s IMRPhenomPV2 ROQ basis | ||
| # Testing is done with the 4s IMRPhenomXPHM ROQ basis | ||
| self.priors["chirp_mass"] = bilby.core.prior.Uniform( | ||
| 12.299703 / scale_factor, 45 / scale_factor | ||
| ) | ||
|
|
@@ -598,7 +598,7 @@ def test_rescaling(self): | |
| frequency_nodes_linear=fnodes_linear, | ||
| frequency_nodes_quadratic=fnodes_quadratic, | ||
| reference_frequency=20.0, | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| ), | ||
| ) | ||
|
|
||
|
|
@@ -631,7 +631,7 @@ def setUp(self): | |
| self.sampling_frequency = 2048 | ||
| self.duration = 16 | ||
| self.reference_frequency = 20.0 | ||
| self.waveform_approximant = "IMRPhenomD" | ||
| self.waveform_approximant = "IMRPhenomXAS" | ||
| # The SNRs of injections are 130-160 for roq_scale_factor=1 and 70-80 for roq_scale_factor=2 | ||
| self.injection_parameters = dict( | ||
| mass_ratio=0.8, | ||
|
|
@@ -942,7 +942,7 @@ def test_from_hdf5(self, basis_linear, basis_quadratic): | |
| duration = 16 | ||
| geocent_time = 1.2 | ||
| reference_frequency = 20.0 | ||
| waveform_approximant = "IMRPhenomD" | ||
| waveform_approximant = "IMRPhenomXAS" | ||
| mc_range = [8, 14] | ||
|
|
||
| priors = bilby.gw.prior.BBHPriorDict() | ||
|
|
@@ -980,8 +980,8 @@ def test_from_npy(self, from_array): | |
| # Possible locations for the ROQ: in the docker image, local, or on CIT | ||
| trial_roq_paths = [ | ||
| "/roq_basis", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomPv2/4s"), | ||
| "/home/cbc/ROQ_data/IMRPhenomPv2/4s", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomXPHM/4s"), | ||
| "/home/cbc/ROQ_data/IMRPhenomXPHM/4s", | ||
| ] | ||
| roq_dir = None | ||
| for path in trial_roq_paths: | ||
|
|
@@ -1006,7 +1006,7 @@ def test_from_npy(self, from_array): | |
| duration = 4 | ||
| geocent_time = 1.2 | ||
| reference_frequency = 20.0 | ||
| waveform_approximant = "IMRPhenomPv2" | ||
| waveform_approximant = "IMRPhenomXPHM" | ||
| mc_range = [12.299703, 45] | ||
|
|
||
| priors = bilby.gw.prior.BBHPriorDict() | ||
|
|
@@ -1132,8 +1132,8 @@ def create_likelihood_single_basis(self): | |
| # Possible locations for the ROQ: in the docker image, local, or on CIT | ||
| trial_roq_paths = [ | ||
| "/roq_basis", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomPv2/4s"), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here |
||
| "/home/cbc/ROQ_data/IMRPhenomPv2/4s", | ||
| os.path.join(os.path.expanduser("~"), "ROQ_data/IMRPhenomXPHM/4s"), | ||
| "/home/cbc/ROQ_data/IMRPhenomXPHM/4s", | ||
| ] | ||
| roq_dir = None | ||
| for path in trial_roq_paths: | ||
|
|
@@ -1153,7 +1153,7 @@ def create_likelihood_single_basis(self): | |
| duration = 4 | ||
| geocent_time = 1.2 | ||
| reference_frequency = 20.0 | ||
| waveform_approximant = "IMRPhenomPv2" | ||
| waveform_approximant = "IMRPhenomXPHM" | ||
| mc_range = [12.299703, 45] | ||
|
|
||
| priors = bilby.gw.prior.BBHPriorDict() | ||
|
|
@@ -1194,7 +1194,7 @@ def create_likelihood_multiple_bases(self, multiband): | |
| duration = 16 | ||
| geocent_time = 1.2 | ||
| reference_frequency = 20.0 | ||
| waveform_approximant = "IMRPhenomD" | ||
| waveform_approximant = "IMRPhenomXAS" | ||
| mc_range = [8, 14] | ||
|
|
||
| priors = bilby.gw.prior.BBHPriorDict() | ||
|
|
@@ -1310,10 +1310,10 @@ def tearDown(self): | |
| ) | ||
|
|
||
| @parameterized.expand([ | ||
| ("IMRPhenomD", True, 2, False, 1.5e-2), | ||
| ("IMRPhenomD", True, 2, True, 1.5e-2), | ||
| ("IMRPhenomD", False, 2, False, 5e-3), | ||
| ("IMRPhenomD", False, 2, True, 6e-3), | ||
| ("IMRPhenomXAS", True, 2, False, 1.5e-2), | ||
| ("IMRPhenomXAS", True, 2, True, 1.5e-2), | ||
| ("IMRPhenomXAS", False, 2, False, 5e-3), | ||
| ("IMRPhenomXAS", False, 2, True, 6e-3), | ||
| ("IMRPhenomHM", False, 4, False, 8e-4), | ||
| ("IMRPhenomHM", False, 4, True, 1e-3) | ||
| ]) | ||
|
|
@@ -1362,7 +1362,7 @@ def test_large_accuracy_factor(self): | |
| """ | ||
| Check if larger accuracy factor increases the accuracy. | ||
| """ | ||
| waveform_approximant = "IMRPhenomD" | ||
| waveform_approximant = "IMRPhenomXAS" | ||
| wfg = bilby.gw.WaveformGenerator( | ||
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole, | ||
|
|
@@ -1408,7 +1408,7 @@ def test_reference_chirp_mass_from_prior(self): | |
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.binary_black_hole_frequency_sequence, | ||
| waveform_arguments=dict( | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomD" | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomXAS" | ||
| ) | ||
| ) | ||
| likelihood1 = bilby.gw.likelihood.MBGravitationalWaveTransient( | ||
|
|
@@ -1430,7 +1430,7 @@ def test_no_reference_chirp_mass(self): | |
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.binary_black_hole_frequency_sequence, | ||
| waveform_arguments=dict( | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomD" | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomXAS" | ||
| ) | ||
| ) | ||
| with self.assertRaises(TypeError): | ||
|
|
@@ -1446,7 +1446,7 @@ def test_cannot_determine_reference_chirp_mass(self): | |
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.binary_black_hole_frequency_sequence, | ||
| waveform_arguments=dict( | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomD" | ||
| reference_frequency=self.fmin, waveform_approximant="IMRPhenomXAS" | ||
| ) | ||
| ) | ||
| for key in ["chirp_mass", "mass_1", "mass_2"]: | ||
|
|
@@ -1463,7 +1463,7 @@ def test_inout_weights(self, linear_interpolation): | |
| Check if multiband weights can be saved as a file, and a likelihood object constructed from the weights file | ||
| produces the same likelihood value. | ||
| """ | ||
| waveform_approximant = "IMRPhenomD" | ||
| waveform_approximant = "IMRPhenomXAS" | ||
| wfg = bilby.gw.WaveformGenerator( | ||
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole, | ||
|
|
@@ -1519,7 +1519,7 @@ def test_from_dict_weights(self, linear_interpolation): | |
| """ | ||
| Check if a likelihood object constructed from dictionary-like weights produce the same likelihood value | ||
| """ | ||
| waveform_approximant = "IMRPhenomD" | ||
| waveform_approximant = "IMRPhenomXAS" | ||
| wfg = bilby.gw.WaveformGenerator( | ||
| duration=self.duration, sampling_frequency=self.sampling_frequency, | ||
| frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole, | ||
|
|
@@ -1565,8 +1565,8 @@ def test_from_dict_weights(self, linear_interpolation): | |
| self.assertAlmostEqual(llr, llr_from_weights) | ||
|
|
||
| @parameterized.expand([ | ||
| ("IMRPhenomD", True, 2, False, 1e-2), | ||
| ("IMRPhenomD", True, 2, True, 1e-2), | ||
| ("IMRPhenomXAS", True, 2, False, 1e-2), | ||
| ("IMRPhenomXAS", True, 2, True, 1e-2), | ||
| ("IMRPhenomHM", False, 4, False, 5e-3), | ||
| ]) | ||
| def test_matches_original_likelihood_low_maximum_frequency( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ def setUp(self): | |
| phase=0.0, | ||
| ) | ||
| self.waveform_kwargs = dict( | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| catch_waveform_errors=True, | ||
|
|
@@ -212,7 +212,7 @@ def setUp(self): | |
| lambda_2=100.0, | ||
| ) | ||
| self.waveform_kwargs = dict( | ||
| waveform_approximant="IMRPhenomPv2_NRTidal", | ||
| waveform_approximant="IMRPhenomPv2_NRTidalv2", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| ) | ||
|
|
@@ -325,7 +325,7 @@ def setUp(self): | |
| frequency_nodes_linear=fnodes_linear, | ||
| frequency_nodes_quadratic=fnodes_quadratic, | ||
| reference_frequency=50.0, | ||
| waveform_approximant="IMRPhenomPv2", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line should be using |
||
| waveform_approximant="IMRPhenomXPHM", | ||
| ) | ||
| self.frequency_array = bilby.core.utils.create_frequency_series(2048, 4) | ||
|
|
||
|
|
@@ -479,7 +479,7 @@ def setUp(self): | |
| self.full_frequencies_to_sequence = self.frequency_array >= self.minimum_frequency | ||
| self.frequencies = self.frequency_array[self.full_frequencies_to_sequence] | ||
| self.waveform_kwargs = dict( | ||
| waveform_approximant="IMRPhenomPv2_NRTidal", | ||
| waveform_approximant="IMRPhenomPv2_NRTidalv2", | ||
| reference_frequency=50.0, | ||
| ) | ||
|
|
||
|
|
@@ -538,14 +538,14 @@ def setUp(self): | |
| phase=0.0, | ||
| ) | ||
| self.waveform_kwargs_fiducial = dict( | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| catch_waveform_errors=True, | ||
| fiducial=True, | ||
| ) | ||
| self.waveform_kwargs_binned = dict( | ||
| waveform_approximant="IMRPhenomPv2", | ||
| waveform_approximant="IMRPhenomXPHM", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| catch_waveform_errors=True, | ||
|
|
@@ -653,13 +653,13 @@ def setUp(self): | |
| lambda_2=100.0, | ||
| ) | ||
| self.waveform_kwargs_fiducial = dict( | ||
| waveform_approximant="IMRPhenomPv2_NRTidal", | ||
| waveform_approximant="IMRPhenomPv2_NRTidalv2", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| fiducial=True, | ||
| ) | ||
| self.waveform_kwargs_binned = dict( | ||
| waveform_approximant="IMRPhenomPv2_NRTidal", | ||
| waveform_approximant="IMRPhenomPv2_NRTidalv2", | ||
| reference_frequency=50.0, | ||
| minimum_frequency=20.0, | ||
| fiducial=False, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I don't think we have ROQ data for XPHM yet, so this will need to be reverted (and may be why the CI is failing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mj-will I assume #897 was a "move towards" modern waveforms and it is okay to use the older waveforms for the ROQs to avoid having to figure out how to package them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's fine.
I'll note there is definitely ROQ data for XPHM on CIT but I don't think it's public (and is also huge).