diff --git a/test/prior_tests.py b/test/prior_tests.py index 566dc3f2897a2a0adb4b3c89538eca8aedab2cb1..2575854cc00c19fc7aed126ff402e2ff1561bd83 100644 --- a/test/prior_tests.py +++ b/test/prior_tests.py @@ -83,34 +83,6 @@ class TestPriorIsFixed(unittest.TestCase): self.assertFalse(self.prior.is_fixed) -class TestFixMethod(unittest.TestCase): - - def setUp(self): - self.test_name = 'test_name' - self.prior = tupak.prior.Prior(self.test_name) - - def tearDown(self): - del self.prior - - def test_is_fixed_attribute_after_fixing(self): - arbitrary_float = 11.3 - fixed_prior = tupak.prior.fix(self.prior, arbitrary_float) - self.assertTrue(fixed_prior.is_fixed) - - def test_value_attribute_after_fixing(self): - arbitrary_float = 11.3 - fixed_prior = tupak.prior.fix(self.prior, arbitrary_float) - self.assertEqual(fixed_prior.peak, arbitrary_float) - - def test_prior_attribute_after_fixing(self): - arbitrary_float = 11.3 - fixed_prior = tupak.prior.fix(self.prior, arbitrary_float) - self.assertIsInstance(fixed_prior, tupak.prior.DeltaFunction) - - def test_raising_value_error_if_value_is_none(self): - self.assertRaises(ValueError, tupak.prior.fix, self.prior, np.nan) - - class TestPriorClasses(unittest.TestCase): def setUp(self): diff --git a/tupak/prior.py b/tupak/prior.py index bdcc435c4a47be3622bfbcfdfb3a599f72fc7666..d47b237c4643a9e7729c58934e987a431ba71e3b 100644 --- a/tupak/prior.py +++ b/tupak/prior.py @@ -359,13 +359,6 @@ class UniformComovingVolume(FromFile): latex_label=latex_label) -def fix(prior, value=None): - if value is None or np.isnan(value): - raise ValueError("You can't fix the value to be np.nan. You need to assign it a legal value") - prior = DeltaFunction(name=prior.name, latex_label=prior.latex_label, peak=value) - return prior - - def create_default_prior(name): """ Make a default prior for a parameter with a known name. @@ -409,27 +402,6 @@ def create_default_prior(name): return prior -def parse_floats_to_fixed_priors(old_parameters): - parameters = old_parameters.copy() - for key in parameters: - if type(parameters[key]) is not float and type(parameters[key]) is not int \ - and type(parameters[key]) is not Prior: - logging.info("Expected parameter " + str(key) + " to be a float or int but was " - + str(type(parameters[key])) + " instead. Will not be converted.") - continue - elif type(parameters[key]) is Prior: - continue - parameters[key] = DeltaFunction(name=key, latex_label=None, peak=old_parameters[key]) - return parameters - - -def parse_keys_to_parameters(keys): - parameters = {} - for key in keys: - parameters[key] = create_default_prior(key) - return parameters - - def fill_priors(prior, waveform_generator): """ Fill dictionary of priors based on required parameters of waveform generator