diff --git a/__pycache__/raremodel.cpython-37.pyc b/__pycache__/raremodel.cpython-37.pyc index 5e5d2bf..a7263b4 100644 --- a/__pycache__/raremodel.cpython-37.pyc +++ b/__pycache__/raremodel.cpython-37.pyc Binary files differ diff --git "a/data/slim_points/slim_points_toy_0_range\050211-4781\051.pkl" "b/data/slim_points/slim_points_toy_0_range\050211-4781\051.pkl" new file mode 100644 index 0000000..dda04e4 --- /dev/null +++ "b/data/slim_points/slim_points_toy_0_range\050211-4781\051.pkl" Binary files differ diff --git "a/data/slim_points/slim_points_toy_0_range\0503150-3650\051.pkl" "b/data/slim_points/slim_points_toy_0_range\0503150-3650\051.pkl" index 4a1949a..e347ff3 100644 --- "a/data/slim_points/slim_points_toy_0_range\0503150-3650\051.pkl" +++ "b/data/slim_points/slim_points_toy_0_range\0503150-3650\051.pkl" Binary files differ diff --git a/plots/points/ff.png b/plots/points/ff.png index 4dc00f8..64a7f57 100644 --- a/plots/points/ff.png +++ b/plots/points/ff.png Binary files differ diff --git a/plots/points/histo.png b/plots/points/histo.png index 85beed2..1b8415f 100644 --- a/plots/points/histo.png +++ b/plots/points/histo.png Binary files differ diff --git a/plots/points/histo_raw.png b/plots/points/histo_raw.png index bbb0dd6..cb8ad04 100644 --- a/plots/points/histo_raw.png +++ b/plots/points/histo_raw.png Binary files differ diff --git a/plots/points/pdf_and_parts.png b/plots/points/pdf_and_parts.png index c2acc0e..da61548 100644 --- a/plots/points/pdf_and_parts.png +++ b/plots/points/pdf_and_parts.png Binary files differ diff --git a/plots/points/vec_axiv.png b/plots/points/vec_axiv.png index c8daa9a..f95ed31 100644 --- a/plots/points/vec_axiv.png +++ b/plots/points/vec_axiv.png Binary files differ diff --git a/raremodel.py b/raremodel.py index e4495a7..94cb0d8 100644 --- a/raremodel.py +++ b/raremodel.py @@ -281,6 +281,8 @@ maxi = self.total_pdf(np.array(maxi)) + maxi /= 1000 + for toy in range(nr_of_toys): set_size_intermed = 0 @@ -945,30 +947,11 @@ # self.nr_of_part_listnr_of_part) self.total_pdf_names += [name] - def log_likelihood(self, npar, apar, part_set, fitting_param_index, resolution = 7.0): #Replaced soon with TMinuit + def log_likelihood(self, q2): - # self.param_val = apar + # self.normalize_pdf(verbose = 0) - for i in range(len(fitting_param_index)): - self.param_val[fitting_param_index[i]] = apar[i] - - - - self.normalize_pdf(verbose = 0) - - # part_set = {"bin_height": bin_height, "bin_mean": bin_mean, "_x": _x, "nbins": nbins, "x_max": x_max, "x_min": x_min} - _x = part_set["_x"] - bin_height = part_set["bin_height"] - - ll = 0.0 - - for i in range(len(bin_height)): - area, _ = integrate.quad(self.total_pdf, _x[i]**2, _x[i+1]**2, limit = 300) - y_true = area/(_x[i+1]-_x[i]) - - ll += np.log(bin_height[i]*y_true) - - ll = -ll + ll = -1*np.sum(np.log(self.total_pdf(q2))) return ll diff --git a/test.py b/test.py index 793ea1c..3212990 100644 --- a/test.py +++ b/test.py @@ -20,16 +20,16 @@ modl.mode = mode -set_size = 1e7 +set_size = 1e5 nonres_set_size = 44000 # nonres_set_size = 1000 -nr_of_toys = 10 +nr_of_toys = 1 -x_min = 3150.0 -x_max= 3650.0 -# -# x_max = modl.x_max -# x_min = modl.x_min +# x_min = 3150.0 +# x_max= 3650.0 + +x_max = modl.x_max +x_min = modl.x_min modl.add_nonres() @@ -69,13 +69,11 @@ with open(r"./data/true_data/true_data_toy_{0}_range({1}-{2}).pkl".format(0, int(x_min), int(x_max)), "rb") as input_file: part_set = pkl.load(input_file) - else: + elif mode == "slim_points": - with open(r"./data/set_{0}_range({1}-{2}).pkl".format(int(set_size), int(x_min), int(x_max)), "rb") as input_file: + with open(r"./data/slim_points/slim_points_toy_0_range({0}-{1}).pkl".format(int(x_min), int(x_max)), "rb") as input_file: part_set = pkl.load(input_file) - counter = set_dic["counter_tot"] - else: start = time.time() part_set = modl.generate_points(set_size, x_min = x_min, x_max = x_max, mode = mode, verbose = 1, nr_of_toys = nr_of_toys, nonres_set_size = nonres_set_size) @@ -86,4 +84,6 @@ if fit: modl.fit_pdf_to_data(part_set) +print() + print("Run finished")