From 73f47729643ff91b580fa720a38f71c259bdc0b3 Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Wed, 28 Aug 2019 18:36:31 -0500 Subject: [PATCH] Adds the LAL version information to the meta data --- bilby/gw/likelihood.py | 13 ++++++++++++- test/gw_likelihood_test.py | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bilby/gw/likelihood.py b/bilby/gw/likelihood.py index 05c8fbcbc..f950c27ea 100644 --- a/bilby/gw/likelihood.py +++ b/bilby/gw/likelihood.py @@ -682,6 +682,16 @@ class GravitationalWaveTransient(likelihood.Likelihood): for mode in signal: signal[mode] *= self._ref_dist / new_distance + @property + def lal_version(self): + try: + from lal import git_version + lal_version = str(git_version.verbose_msg).replace("\n", ";") + logger.info("Using LAL version {}".format(lal_version)) + return lal_version + except (ImportError, AttributeError): + return "N/A" + @property def meta_data(self): return dict( @@ -694,7 +704,8 @@ class GravitationalWaveTransient(likelihood.Likelihood): self.waveform_generator.frequency_domain_source_model), sampling_frequency=self.waveform_generator.sampling_frequency, duration=self.waveform_generator.duration, - start_time=self.waveform_generator.start_time) + start_time=self.waveform_generator.start_time, + lal_version=self.lal_version) class BasicGravitationalWaveTransient(likelihood.Likelihood): diff --git a/test/gw_likelihood_test.py b/test/gw_likelihood_test.py index fc3ee9f69..658044a1f 100644 --- a/test/gw_likelihood_test.py +++ b/test/gw_likelihood_test.py @@ -158,7 +158,8 @@ class TestGWTransient(unittest.TestCase): self.waveform_generator.frequency_domain_source_model), sampling_frequency=self.waveform_generator.sampling_frequency, duration=self.waveform_generator.duration, - start_time=self.waveform_generator.start_time) + start_time=self.waveform_generator.start_time, + lal_version=self.likelihood.lal_version) self.assertDictEqual(expected, self.likelihood.meta_data) -- GitLab