def test_function_string_has_expected_form_with_defaults_given(self): test_profiles = GaussianMassProfile(10, 16) param_prefix = "f1." param_vals = {"f1.Width": 11.0, "f1.Intensity": 4.5} expected = "name=GaussianComptonProfile,Mass=16.000000,Width=11.000000,Intensity=4.500000;" self.assertEqual(expected, test_profiles.create_fit_function_str(param_vals, param_prefix))
def test_ties_str_for_constrained_width_contains_only_mass(self): test_profile = GaussianMassProfile([2, 5, 7], 16) self.assertEqual("Mass=16.000000", test_profile.create_ties_str()) # and with prefix self.assertEqual("f0.Mass=16.000000", test_profile.create_ties_str("f0."))
def test_constraint_str_for_constrained_width(self): test_profile = GaussianMassProfile([2, 5, 7], 16) self.assertEqual("2.000000 < Width < 7.000000,Intensity > 0.0", test_profile.create_constraint_str()) # and with prefix self.assertEqual("2.000000 < f0.Width < 7.000000,f0.Intensity > 0.0", test_profile.create_constraint_str("f0."))
def _create_test_fitting_opts(self): gramc = GramCharlierMassProfile([2, 5, 7], 1.0079, [1, 0, 0], 1, 1) gauss = GaussianMassProfile(10, 16) constraints = list([1, -4]) return FittingOptions([gramc, gauss], intensity_constraints=constraints)
def test_ties_str_for_constrained_width_contains_only_mass(self): test_profile = GaussianMassProfile([2,5,7], 16) self.assertEqual("Mass=16.000000", test_profile.create_ties_str()) # and with prefix self.assertEqual("f0.Mass=16.000000", test_profile.create_ties_str("f0."))
def test_ties_str_for_fixed_width(self): test_profile = GaussianMassProfile(10, 16) self.assertEqual("Mass=16.000000,Width=10.000000", test_profile.create_ties_str())
def test_constraint_str_for_constrained_width(self): test_profile = GaussianMassProfile([2,5,7], 16) self.assertEqual("2.000000 < Width < 7.000000,Intensity > 0.0", test_profile.create_constraint_str()) # and with prefix self.assertEqual("2.000000 < f0.Width < 7.000000,f0.Intensity > 0.0", test_profile.create_constraint_str("f0."))
def test_constraint_str_is_only_intensity_for_fixed_width(self): test_profile = GaussianMassProfile(10, 16) self.assertEqual("Intensity > 0.0", test_profile.create_constraint_str())
def test_function_string_has_expected_form_with_no_defaults(self): test_profiles = GaussianMassProfile(10, 16) expected = "name=GaussianComptonProfile,Mass=16.000000,Width=10.000000;" self.assertEqual(expected, test_profiles.create_fit_function_str())
def test_ties_str_for_constrained_width_is_empty(self): test_profile = GaussianMassProfile([2,5,7], 16) self.assertEqual("", test_profile.create_ties_str()) # and with prefix self.assertEqual("", test_profile.create_ties_str("f0."))