Esempio n. 1
0
def make_plots(run, build=False, publish=False):
    figures = {}

    pfx = 'zp_tttt_'
    figures[pfx + 'xs_v_gt'] = zp_xs_v_gt(run, 'tttt')
    for var, gt in product(['pt', 'eta'],
                           [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]):
        gt_s = '{:.1f}'.format(gt).replace('.', 'p')
        figures[pfx + 'top_{}_v_m_{}'.format(var, gt_s)] = zp_kinem_v_m(run, gt, var, 'tttt')

    mpb.render(figures, build=build)
    mpb.generate_report(figures, '2HDM Studies',
                        output='hists.html',
                        source=__file__)

    if publish:
        mpb.publish()
Esempio n. 2
0
import numpy as np
import matplotlib.pyplot as plt
import matplotboard as mpb


@mpb.decl_fig
def cool_fig(func, scale, color="b"):
    xs = np.linspace(-scale, scale, 100)
    f = {
        "sin": lambda xs: np.sin(xs),
        "tan": lambda xs: np.tan(xs),
        "exp": lambda xs: np.exp(xs),
    }[func]
    ys = f(xs)
    plt.plot(xs, ys, color=color)


if __name__ == "__main__":
    mpb.configure(multiprocess=True)
    figures = {}

    for color, function, scale in product(
        "rbgk", ["sin", "tan", "exp"], np.linspace(1, 20, 20)
    ):
        figures[f"{function}_{color}_{int(scale)}"] = cool_fig(
            function, scale, color=color
        )

    mpb.render(figures)
    mpb.generate_report(figures, "Report")
Esempio n. 3
0
import numpy as np
import matplotlib.pyplot as plt
import matplotboard as mpb


@mpb.decl_fig
def cool_fig():
    xs = np.linspace(-10, 10, 100)
    ys = xs**2
    plt.plot(xs, ys)


if __name__ == '__main__':
    figures = {
        'cool_fig': cool_fig(),
    }
    mpb.render(figures)
    mpb.generate_report(figures, 'Report')
Esempio n. 4
0
    yerr = np.nan_to_num(yerr, nan=0, posinf=0, neginf=0)
    plt.errorbar(xs, ratio, xerr=xerr, yerr=yerr)
    plt.ylim(0.5, 2.0)
    plt.ylabel('(S+B)/B')
    plt.xlabel('Pulse Height (V)')

    return txt


if __name__ == '__main__':
    plt.style.use(hep.style.CMS)
    plots = {
        'comparison-ph1-2020_03_10':
        pulse_height_comparison([
            ('2020_03_10', 'nosrc_1', 'Background'),
            ('2020_03_10', 'withsrc_1', 'With Source'),
        ], 'Comparison'),
        'comparison-ph2-2020_03_10':
        pulse_height_comparison([
            ('2020_03_10', 'nosrc_2', 'Background'),
            ('2020_03_10', 'withsrc_2', 'With Source'),
        ], 'Comparison'),
        'comparison-ph1-2020_03_13':
        pulse_height_comparison([
            ('2020_03_13', 'nosrc', 'Background'),
            ('2020_03_13', 'withsrc', 'With Source'),
        ], 'Comparison'),
    }
    mpb.render(plots)
    mpb.generate_report(plots, 'Scintillator Traces')
Esempio n. 5
0
I happened to have a couple *really* fantastic figures on my computer that I
want to include as well. How do I include them? It's easy! Just add them to
the list of figures with the `loc_fig` function and they will be marked to be
copied to the output directory. Here are a couple examples:

<div class="row">
<div class="col-md-6 row_fig">
fig::image8
</div>
<div class="col-md-6 row_fig">
fig::image10
</div>
</div>

"""

if __name__ == "__main__":
    mpb.configure(multiprocess=True)
    figures = {}

    for color, function, scale in product("rbgk", ["sin", "tan", "exp"],
                                          np.linspace(1, 5, 5)):
        figures[f"{function}_{color}_{int(scale)}"] = cool_fig(function,
                                                               scale,
                                                               color=color)
    figures["image8"] = mpb.loc_fig("figures/image8.png")
    figures["image10"] = mpb.loc_fig("figures/image10.png")

    mpb.render(figures)
    mpb.generate_report(figures, "Report", body=report)