Skip to content

adding plotting module

Manuel Guth requested to merge mguth-plotting into master

this MR introduces a new module umami.plotting (open for other name suggestions) which moves the plotting into one module using class syntax making everything more modular and then easier to call via python API

in this first step the roc curves are being introduced

  • figure_base class having all the information about the figure and its over all style
  • roc class containing info about one roc curve and allows to calculate the ratio to another roc curve etc.

do people haven thoughts about this new way of doing things? @alfroch @pgadow @svanstro @birk

first step towards #100 (closed)

An example how the roc plotting is done now

from umami.plotting import roc, roc_plot
plot_roc = roc_plot(
    n_ratio_panels=2, ylabel="background Rejection", xlabel="b-jets efficiency"
)
plot_roc.add_roc(
    roc(
        sig_eff,
        rnnip_ujets_rej,
        n_test=100000,
        rej_class="ujets",
        signal_class="bjets",
        label="RNNIP",
        colour="#AA3377",
    ),
    reference=True,
)
plot_roc.add_roc(
    roc(
        sig_eff,
        dips_ujets_rej,
        n_test=100000,
        rej_class="ujets",
        signal_class="bjets",
        label="DIPS",
        colour="#228833",
    ),
)
plot_roc.add_roc(
    roc(
        sig_eff,
        rnnip_cjets_rej,
        n_test=100000,
        rej_class="cjets",
        signal_class="bjets",
        label="RNNIP",
        colour="#AA3377",
    ),
    reference=True,
)
plot_roc.add_roc(
    roc(
        sig_eff,
        dips_cjets_rej,
        n_test=100000,
        rej_class="cjets",
        signal_class="bjets",
        label="DIPS",
        colour="#228833",
    ),
)
plot_roc.set_ratio_class(1, "ujets")
plot_roc.set_ratio_class(2, "cjets")
plot_roc.draw(
    rlabel=[
        "light-flavour jets ratio",
        "c-jets ratio",
    ],
    leg_class_labels=[
        "light-flavour jets rejection",
        "c-jets rejection",
    ],
)
plot_roc.savefig("roc.pdf")
Edited by Manuel Guth

Merge request reports