Skip to content

Commit

Permalink
Merge pull request #26 from StFroese/fix_units
Browse files Browse the repository at this point in the history
Correct units for ULs
  • Loading branch information
StFroese authored Dec 12, 2023
2 parents ccdd189 + 5a451dc commit d051d94
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions titrate/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class UpperLimitPlotter:
def __init__(self, path, channel, uls=True, expected_uls=True, ax=None):
def __init__(self, path, channel, show_uls=True, show_expected_uls=True, ax=None):
self.path = path
self.ax = ax if ax is not None else plt.gca()

Expand All @@ -27,19 +27,19 @@ def __init__(self, path, channel, uls=True, expected_uls=True, ax=None):

self.channel = channel

if not uls and not expected_uls:
if not show_uls and not show_expected_uls:
raise ValueError("Either uls or expected_uls must be True")

masses = table["mass"]
if uls:
if show_uls:
try:
uls = table["ul"]
except KeyError:
raise KeyError("No upper limits in dataframe. Set uls=False")
else:
uls = None

if expected_uls:
if show_expected_uls:
try:
median = table["median_ul"]
one_sigma_minus = table["1sigma_minus_ul"]
Expand Down Expand Up @@ -76,8 +76,9 @@ def __init__(self, path, channel, uls=True, expected_uls=True, ax=None):
][0]
cl = unique(table[table["channel"] == self.channel], keys="cl")["cl"][0]
self.ax.set_xlabel(f"m / {masses.unit:latex}")
ul_unit = uls.unit if show_uls else median.unit
self.ax.set_ylabel(
rf"$CL_{cl_type}^{{{cl}}}$ upper limit on $< \sigma v>$ / {uls.unit:latex}"
rf"$CL_{cl_type}^{{{cl}}}$ upper limit on $< \sigma v>$ / {ul_unit:latex}"
)

self.ax.set_title(f"Annihilation Upper Limits for channel {self.channel}")
Expand Down

0 comments on commit d051d94

Please sign in to comment.