diff --git a/freeforestml/model.py b/freeforestml/model.py index 7d7e7ce4efc53310859b65007d8a81bcca7ab4ae..c0b62838af76e9a7533ef962d5cc363a84f6240a 100644 --- a/freeforestml/model.py +++ b/freeforestml/model.py @@ -183,7 +183,7 @@ class ClassicalCV(CrossValidator): return (slice_id / (self.k * 2.0) <= variable) \ & (variable < (slice_id + 1.0) / (self.k * 2)) - def select_training(self, df, fold_i): + def select_training(self, df, fold_i, for_predicting = False): """ Returns the index array to select all training events from the dataset for the given fold. @@ -249,7 +249,7 @@ class NoTestCV(CrossValidator): return (slice_id / self.k <= variable) \ & (variable < (slice_id + 1.0) / self.k) - def select_training(self, df, fold_i): + def select_training(self, df, fold_i, for_predicting = False): """ Returns the index array to select all training events from the dataset. The fold_i parameter has no effect. @@ -309,7 +309,7 @@ class BinaryCV(CrossValidator): return (slice_id / self.k <= variable) \ & (variable < (slice_id + 1.0) / self.k) - def select_training(self, df, fold_i): + def select_training(self, df, fold_i, for_predicting = False): """ Returns the index array to select all training events from the dataset for the given fold. diff --git a/freeforestml/plot.py b/freeforestml/plot.py index 3eda8b4b8ed6fbbfcbb5a053dbf329eef346f08a..c1bc65bb3b3cfb5f52707c2834e8474c9a127f3a 100644 --- a/freeforestml/plot.py +++ b/freeforestml/plot.py @@ -333,9 +333,9 @@ def hist(dataframe, variable, bins, stacks, selection=None, for yield_name in stack_item.yield_names] return sum(process_totals) - if y_log: - for stack in uhepp_obj.stacks: - stack.content.sort(key=lambda x: total_stackitem(uhepp_obj, x)) + #if y_log: + #for stack in uhepp_obj.stacks: + #stack.content.sort(key=lambda x: total_stackitem(uhepp_obj, x)) ################## # Vertical lines diff --git a/freeforestml/stack.py b/freeforestml/stack.py index 0aba6319ba80725e335d7bde08c74157bf090d90..ba6511175b15866885961327ac2c2698e986d56e 100644 --- a/freeforestml/stack.py +++ b/freeforestml/stack.py @@ -68,7 +68,7 @@ class Stack: self.data_uncertainties.append(data_uncertainty) self.aux.append(aux) - def get_hist(self, df, i, bins, variable, weight, include_outside=False): + def get_hist(self, df, i, bins, variable, weight, range = None, include_outside=False): """ Returns the yields per bin for the i-th process in the stack. The bins argument specifies the bin edges. @@ -93,7 +93,7 @@ class Stack: else: func = np.histogram - total, _ = func(variable, bins=bins, weights=weight) + total, _ = func(variable, bins=bins, weights=weight, range = range) return total def get_total(self, df, bins, variable, weight, include_outside=False): @@ -108,7 +108,7 @@ class Stack: return total - def get_uncertainty(self, df, i, bins, variable, weight, + def get_uncertainty(self, df, i, bins, variable, weight, range = None, include_outside=False): """ Returns the uncertainty of the total yield per bin. The bins argument @@ -121,11 +121,11 @@ class Stack: uncertainty_2 = 0 if self.is_data_uncertainty(i): - uncertainty_2 += self.get_hist(df, i, bins, variable, weight, + uncertainty_2 += self.get_hist(df, i, bins, variable, weight, range = range, include_outside=include_outside) else: uncertainty_2 += self.get_hist(df, i, bins, variable, - weight=weight_2, + weight=weight_2, range = range, include_outside=include_outside) return np.sqrt(uncertainty_2)