Skip to content
Snippets Groups Projects
Commit cc9eda10 authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
Browse files

fixing lumifactor support for overlay_ROC

parent 2bffb302
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ def overlay_ROC(filename, *projects, **kwargs):
plot_thresholds = kwargs.pop("plot_thresholds", False)
threshold_log = kwargs.pop("threshold_log", True)
lumifactor = kwargs.pop("lumifactor", None)
tight_layout = kwargs.pop("tight_layout", False)
if kwargs:
raise KeyError("Unknown kwargs: {}".format(kwargs))
......@@ -57,9 +58,9 @@ def overlay_ROC(filename, *projects, **kwargs):
if lumifactor is not None:
sumw_b = p.w_test[p.y_test==0].sum()*lumifactor
sumw_s = p.w_test[p.y_test==1].sum()*lumifactor
ax_abs_b.plot(tpr, (1.-fpr)*sumw_b, "r--", alpha=0.5)
ax_abs_b.plot(tpr, (1.-fpr)*sumw_b, alpha=0)
ax_abs_b.invert_yaxis()
ax_abs_s.plot(tpr*sumw_s, fpr, "g--", alpha=0.5)
ax_abs_s.plot(tpr*sumw_s, fpr, alpha=0)
if xlim is not None:
ax.set_xlim(*xlim)
......@@ -79,7 +80,7 @@ def overlay_ROC(filename, *projects, **kwargs):
ax.set_title('Receiver operating characteristic')
ax.set_ylabel("Background rejection")
ax.set_xlabel("Signal efficiency")
if plot_thresholds:
if plot_thresholds or tight_layout:
# to fit right y-axis description
fig.tight_layout()
return save_show(plt, fig, filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment