From 41b0494d70d1ff731fb876a73a21ce6aae051f69 Mon Sep 17 00:00:00 2001 From: MoritzThomasHuebner <email@moritz-huebner.de> Date: Tue, 4 Sep 2018 16:32:24 +1000 Subject: [PATCH] Added repr for Recalibrate base class --- test/calibration_tests.py | 5 +++++ tupak/gw/calibration.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/test/calibration_tests.py b/test/calibration_tests.py index 0e696fa11..1c89f79b0 100644 --- a/test/calibration_tests.py +++ b/test/calibration_tests.py @@ -11,6 +11,11 @@ class TestBaseClass(unittest.TestCase): def tearDown(self): del self.model + def test_repr(self): + expected = 'Recalibrate(prefix={})'.format('recalib_') + actual = repr(self.model) + self.assertEqual(expected, actual) + def test_calibration_factor(self): frequency_array = np.linspace(20, 1024, 1000) cal_factor = self.model.get_calibration_factor(frequency_array) diff --git a/tupak/gw/calibration.py b/tupak/gw/calibration.py index dc412df64..2c701593f 100644 --- a/tupak/gw/calibration.py +++ b/tupak/gw/calibration.py @@ -21,6 +21,9 @@ class Recalibrate(object): self.params = dict() self.prefix = prefix + def __repr__(self): + return self.__class__.__name__ + '(prefix={})'.format(self.prefix) + def get_calibration_factor(self, frequency_array, **params): """Apply calibration model -- GitLab