def test_ties_str_for_constrained_width_and_k_is_free_is_empty(self):
        test_profile = GramCharlierMassProfile([2, 5, 7],
                                               16, [1, 0, 1],
                                               k_free=1,
                                               sears_flag=1)

        expected = "Mass=16.000000"
        self.assertEqual(expected, test_profile.create_ties_str())
Beispiel #2
0
    def test_constraint_str_for_constrained_width(self):
        test_profile = GramCharlierMassProfile([2,5,7], 16, [1,0,1], k_free=1, sears_flag=1)

        expected = "2.000000 < Width < 7.000000,C_0 > 0.0,C_4 > 0.0"
        self.assertEqual(expected, test_profile.create_constraint_str())
        prefix = "f0."
        expected = "2.000000 < f0.Width < 7.000000,f0.C_0 > 0.0,f0.C_4 > 0.0"
        self.assertEqual(expected, test_profile.create_constraint_str(prefix))
    def test_constraint_str_for_fixed_width(self):
        test_profile = GramCharlierMassProfile(10,
                                               16, [1, 0, 1],
                                               k_free=1,
                                               sears_flag=1)

        expected = "C_0 > 0.0,C_4 > 0.0"
        self.assertEqual(expected, test_profile.create_constraint_str())
Beispiel #4
0
    def test_function_string_has_expected_form_with_given_values(self):
        test_profile = GramCharlierMassProfile(10, 16,[1,0,1],1,1)
        param_prefix = "f1."
        param_vals = {"f1.Width": 11.0, "f1.FSECoeff": 0.1, "f1.C_0": 0.25,
                      "f1.C_2": 0.5, "f1.C_4": 0.75}

        expected = "name=GramCharlierComptonProfile,Mass=16.000000,HermiteCoeffs=1 0 1,"\
                   "Width=11.000000,FSECoeff=0.100000,C_0=0.250000,C_4=0.750000;"
        self.assertEqual(expected, test_profile.create_fit_function_str(param_vals, param_prefix))
    def test_ties_str_for_fixed_width(self):
        test_profile = GramCharlierMassProfile(5,
                                               16, [1, 0, 1],
                                               k_free=1,
                                               sears_flag=1)

        expected = "Mass=16.000000,Width=5.000000"
        self.assertEqual(expected, test_profile.create_ties_str())

        # k is tied, sears=0
        test_profile = GramCharlierMassProfile(5,
                                               16, [1, 0, 1],
                                               k_free=0,
                                               sears_flag=0)

        expected = "f0.Mass=16.000000,f0.Width=5.000000,f0.FSECoeff=0"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))

        # k is tied, sears=1
        test_profile = GramCharlierMassProfile(5,
                                               16, [1, 0, 1],
                                               k_free=0,
                                               sears_flag=1)

        expected = "f0.Mass=16.000000,f0.Width=5.000000,f0.FSECoeff=f0.Width*sqrt(2)/12"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))
Beispiel #6
0
    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)
Beispiel #7
0
    def test_ties_str_for_fixed_width(self):
        test_profile = GramCharlierMassProfile(5, 16, [1,0,1], k_free=1, sears_flag=1)

        expected = "Mass=16.000000,Width=5.000000"
        self.assertEqual(expected, test_profile.create_ties_str())

        # k is tied, sears=0
        test_profile = GramCharlierMassProfile(5, 16, [1,0,1], k_free=0, sears_flag=0)

        expected = "f0.Mass=16.000000,f0.Width=5.000000,f0.FSECoeff=0"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))

        # k is tied, sears=1
        test_profile = GramCharlierMassProfile(5, 16, [1,0,1], k_free=0, sears_flag=1)

        expected = "f0.Mass=16.000000,f0.Width=5.000000,f0.FSECoeff=f0.Width*sqrt(2)/12"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))
Beispiel #8
0
    def test_ties_str_for_constrained_width(self):
        # k is free
        test_profile = GramCharlierMassProfile([2,5,7], 16, [1,0,1], k_free=1, sears_flag=1)

        expected = ""
        self.assertEqual(expected, test_profile.create_ties_str())

        # k is tied, sears=0
        test_profile = GramCharlierMassProfile([2,5,7], 16, [1,0,1], k_free=0, sears_flag=0)

        expected = "f0.FSECoeff=0"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))

        # k is tied, sears=1
        test_profile = GramCharlierMassProfile([2,5,7], 16, [1,0,1], k_free=0, sears_flag=1)

        expected = "f0.FSECoeff=f0.Width*sqrt(2)/12"
        self.assertEqual(expected, test_profile.create_ties_str("f0."))
Beispiel #9
0
    def test_ties_str_for_constrained_width_and_k_is_free_is_empty(self):
        test_profile = GramCharlierMassProfile([2,5,7], 16, [1,0,1], k_free=1, sears_flag=1)

        expected = "Mass=16.000000"
        self.assertEqual(expected, test_profile.create_ties_str())
Beispiel #10
0
    def test_constraint_str_for_fixed_width(self):
        test_profile = GramCharlierMassProfile(10, 16, [1, 0, 1], k_free=1, sears_flag=1)

        expected = "C_0 > 0.0,C_4 > 0.0"
        self.assertEqual(expected, test_profile.create_constraint_str())
Beispiel #11
0
    def test_function_string_has_expected_form_with_no_defaults(self):
        test_profile = GramCharlierMassProfile(10, 16,[1,0,1],1,1)

        expected = "name=GramCharlierComptonProfile,Mass=16.000000,HermiteCoeffs=1 0 1,Width=10.000000;"
        self.assertEqual(expected, test_profile.create_fit_function_str())