Commit 7c434b75 authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Control left margin in channel comparison plots.

parent 8bf27013
......@@ -30,6 +30,7 @@ def plot_exclusion_and_bestfit_1d(
scan_parameter,
x_min=None,
x_max=None,
left_margin=None,
model_parameters=None,
h_lines=None,
campaign=None,
......@@ -62,10 +63,11 @@ def plot_exclusion_and_bestfit_1d(
)
*x_min* and *x_max* define the range of the x-axis and default to the maximum range of poi
values passed in data. *model_parameters* can be a dictionary of key-value pairs of model
parameters. *h_lines* can be a list of integers denoting positions where additional horizontal
lines are drawn for visual guidance. *campaign* should refer to the name of a campaign label
defined in *dhi.config.campaign_labels*.
values passed in data. *left_margin* controls the left margin of the pad in pixels.
*model_parameters* can be a dictionary of key-value pairs of model parameters. *h_lines* can be
a list of integers denoting positions where additional horizontal lines are drawn for visual
guidance. *campaign* should refer to the name of a campaign label defined in
*dhi.config.campaign_labels*.
Example: https://cms-hh.web.cern.ch/tools/inference/tasks/exclusion.html#comparison-of-exclusion-performance
"""
......@@ -90,7 +92,7 @@ def plot_exclusion_and_bestfit_1d(
canvas_width = 800 # pixels
top_margin = 35 # pixels
bottom_margin = 70 # pixels
left_margin = 150 # pixels
left_margin = left_margin or 150 # pixels
entry_height = 90 # pixels
head_space = 130 # pixels
......
......@@ -140,6 +140,7 @@ def plot_gofs(
n_bins=30,
x_min=-3.,
x_max=3.,
left_margin=None,
model_parameters=None,
campaign=None,
):
......@@ -150,9 +151,10 @@ def plot_gofs(
the *algorithm* used for the test is shown in the legend.
The toy histograms are drawn with *n_bins* bins. *x_min*, *x_max*, *y_min* and *y_max* define
the axis ranges and default to the range of the given values. *model_parameters* can be a
dictionary of key-value pairs of model parameters. *campaign* should refer to the name of a
campaign label defined in *dhi.config.campaign_labels*.
the axis ranges and default to the range of the given values. *left_margin* controls the left
margin of the pad in pixels. *model_parameters* can be a dictionary of key-value pairs of model
parameters. *campaign* should refer to the name of a campaign label defined in
*dhi.config.campaign_labels*.
Example: https://cms-hh.web.cern.ch/tools/inference/tasks/gof.html#testing-multiple-datacards
"""
......@@ -172,7 +174,7 @@ def plot_gofs(
canvas_width = 800 # pixels
top_margin = 35 # pixels
bottom_margin = 70 # pixels
left_margin = 150 # pixels
left_margin = left_margin or 150 # pixels
entry_height = 90 # pixels
head_space = 100 # pixels
......
......@@ -406,6 +406,7 @@ def plot_limit_points(
x_max=None,
xsec_unit=None,
hh_process=None,
left_margin=None,
model_parameters=None,
h_lines=None,
campaign=None,
......@@ -446,11 +447,12 @@ def plot_limit_points(
this unit or, when *None*, as a ratio over the theory prediction. *hh_process* can be the name
of a HH subprocess configured in *dhi.config.br_hh_names* and is inserted to the process name in
the title of the x-axis and indicates that the plotted cross section data was (e.g.) scaled by a
branching ratio. *model_parameters* can be a dictionary of key-value pairs of model parameters.
*h_lines* can be a list of integers denoting positions where additional horizontal lines are
drawn for visual guidance. *campaign* should refer to the name of a campaign label defined in
dhi.config.campaign_labels. *digits* controls the number of digits of the limit values shown for
each entry. When *None*, a number based on the lowest limit values is determined automatically.
branching ratio. *left_margin* controls the left margin of the pad in pixels. *model_parameters*
can be a dictionary of key-value pairs of model parameters. *h_lines* can be a list of integers
denoting positions where additional horizontal lines are drawn for visual guidance. *campaign*
should refer to the name of a campaign label defined in dhi.config.campaign_labels. *digits*
controls the number of digits of the limit values shown for each entry. When *None*, a number
based on the lowest limit values is determined automatically.
Example: https://cms-hh.web.cern.ch/tools/inference/tasks/limits.html#multiple-limits-at-a-certain-point-of-parameters
"""
......@@ -500,7 +502,7 @@ def plot_limit_points(
canvas_width = 800 # pixels
top_margin = 35 # pixels
bottom_margin = 70 # pixels
left_margin = 150 # pixels
left_margin = left_margin or 150 # pixels
entry_height = 90 # pixels
head_space = 130 # pixels
......
......@@ -22,6 +22,12 @@ class PlotExclusionAndBestFit(POIScanTask, MultiDatacardTask, POIPlotTask):
significant=False,
description="comma-separated vertical positions of horizontal lines; default: empty",
)
left_margin = luigi.IntParameter(
default=law.NO_INT,
significant=False,
description="the left margin of the pad in pixels; uses the default of the plot when "
"empty; no default"
)
y_min = None
y_max = None
......@@ -107,6 +113,7 @@ class PlotExclusionAndBestFit(POIScanTask, MultiDatacardTask, POIPlotTask):
scan_parameter=self.scan_parameter_names[0],
x_min=self.get_axis_limit("x_min"),
x_max=self.get_axis_limit("x_max"),
left_margin=None if self.left_margin == law.NO_INT else self.left_margin,
model_parameters=self.get_shown_parameters(),
h_lines=self.h_lines,
campaign=self.campaign if self.campaign != law.NO_STR else None,
......
......@@ -203,6 +203,12 @@ class PlotMultipleGoodnessOfFits(PlotGoodnessOfFit, MultiDatacardTask):
"define the amount of toys to generate per task; when one value is given, it is used for "
"all datacard sequences; default: (1,)",
)
left_margin = luigi.IntParameter(
default=law.NO_INT,
significant=False,
description="the left margin of the pad in pixels; uses the default of the plot when "
"empty; no default"
)
y_min = None
y_max = None
......@@ -277,6 +283,7 @@ class PlotMultipleGoodnessOfFits(PlotGoodnessOfFit, MultiDatacardTask):
n_bins=self.n_bins,
x_min=self.get_axis_limit("x_min"),
x_max=self.get_axis_limit("x_max"),
left_margin=None if self.left_margin == law.NO_INT else self.left_margin,
model_parameters=self.get_shown_parameters(),
campaign=self.campaign if self.campaign != law.NO_STR else None,
)
......@@ -543,6 +543,12 @@ class PlotUpperLimitsAtPoint(POIPlotTask, MultiDatacardTask):
significant=False,
description="comma-separated vertical positions of horizontal lines; default: empty",
)
left_margin = luigi.IntParameter(
default=law.NO_INT,
significant=False,
description="the left margin of the pad in pixels; uses the default of the plot when "
"empty; no default"
)
y_min = None
y_max = None
......@@ -675,6 +681,7 @@ class PlotUpperLimitsAtPoint(POIPlotTask, MultiDatacardTask):
x_log=self.x_log,
xsec_unit=xsec_unit,
hh_process=None if self.br in (None, law.NO_STR) else self.br,
left_margin=None if self.left_margin == law.NO_INT else self.left_margin,
model_parameters=self.get_shown_parameters(),
h_lines=self.h_lines,
campaign=self.campaign if self.campaign != law.NO_STR else None,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment