def makePlot(df, process): ampl.use_atlas_style(usetex=False) fig, ax = plt.subplots(figsize=(9, 8)) ax.plot(df['ct'], df['cross'], 'o', color='black', label='MadGraph') # fit polynomial f = np.polynomial.Polynomial.fit(df['ct'], df['cross'], 4) p0, p1, p2, p3, p4 = f.coef ax.plot(df['ct'], f(df['ct']), color='red', label='Polynomial (deg=4) fit') # label plot plt.xlabel('$c_{t}$') plt.ylabel(f'$\\sigma$ ({process}) [fb]') plt.text( 0.05, 0.75, f'p p > {process}, v1 > tt, $\\sqrt{{s}}$ = 13 TeV, $\\theta$ = $\\pi / 4$', transform=ax.transAxes) plt.text( 0.05, 0.65, f'$\\sigma(x)$ = {p0:.3f} + ({p1:.3f}) $x$ + ({p2:.3f}) $x^{{2}}$ + ({p3:.3f}) $x^{{3}}$ + ({p4:.3f}) $x^{{4}}$', transform=ax.transAxes) plt.legend() # style plot ax.set_xlim(0, 5) ax.set_ylim(0, 0.03) # save figure fig.savefig(f'plot_xsec_ct_{process}.png')
def plotLimit(xval, yval, yval1): ampl.use_atlas_style() plt.clf() fig = plt.figure() ax = fig.add_subplot(1, 1, 1) plt.plot(xval, yval, '--bo', label='Support vector machine') plt.plot(xval, yval1, '-k.', label=r'$m_{ee}^{both}$ fit') plt.xlabel('Dark photon mass [MeV]') plt.ylabel(r'Br$(\mu\to e (A\to ee) \nu\nu) \times 10^{-10}$') plt.title('Dark photon upper limit comparisons') ax.text(0.6, 0.75, 'Mu3e work in progress', transform=ax.transAxes) ax.text(0.6, 0.7, '95\% CL upper limits', transform=ax.transAxes) plt.legend() plt.gca().xaxis.grid(True) plt.gca().yaxis.grid(True) #plt.show() #sys.exit() plt.savefig("limit_atlas.pdf") plt.yscale('log') plt.ylim((0.1, 10.)) ax.grid(which='major', color='#CCCCCC', linestyle='--') ax.grid(which='minor', color='#CCCCCC', linestyle=':') plt.savefig("limit_atlas_log.pdf")
def __init__(self, yaml_config_path: ht.pathlike): """Initialize executor.""" self.job_config = None self.get_config(yaml_config_path) # Set up global plot style and color cycle ampl.use_atlas_style(usetex=False) color_cycle = self.job_config.apply.color_cycle default_cycler = cycler(color=color_cycle) plt.rc("axes", prop_cycle=default_cycler)
def plotLimitATLAS(xval, yval, yval1): ampl.use_atlas_style() ampl.plot.plot_limit('Support vector machine', xval, yval, color='k') ampl.plot.plot_limit(r'$m_{ee}^{both}$ fit', xval, yval1, color='b') ampl.plot.set_xlabel('Dark photon mass [MeV]') ampl.plot.set_ylabel(r'Br$(\mu\to e (A\to ee) \nu\nu) \times 10^{-10}$') plt.legend() plt.show()
def makePlot(df, process): ampl.use_atlas_style(usetex=False) fig, ax = plt.subplots(figsize=(9,8)) # automatic width calculation ax.plot(df['ct'], df['width'], 'o', color='black', label='MadGraph AUTO') # analytic width calculation ax.plot(df['ct'], width_analytic(df['ct'], np.pi / 4, 1500.), color='red', label='analytic') # label plot plt.xlabel('$c_{t}$') plt.ylabel(f'$\\Gamma$ ({process}) [GeV]') plt.text(0.3, 0.05, f'p p > {process}, v1 > tt, $\\sqrt{{s}}$ = 13 TeV, $\\theta$ = $\\pi / 4$', transform=ax.transAxes) plt.legend() # style plot ax.set_xlim(0, 10) ax.set_ylim(0, 7000) # save figure fig.savefig(f'plot_width_ct_{process}.png')
def makePlot(df, process): ampl.use_atlas_style(usetex=False) fig, ax = plt.subplots(figsize=(9,8)) # create contour plot X, Y = np.meshgrid(np.sort(df.mass.unique()), np.sort(df.theta1.unique())) Z = df.pivot(index='theta1', columns='mass', values='cross_fb').values levels = None colors = None linestyles = None if process == 'tjv1': levels = [0.5, 3.0, 10, 30, 60] colors = ['purple', 'blue', 'green', 'red', 'black'] linestyles = ['solid', 'dashdot', 'dashed', 'dotted', 'solid'] if process == 'tWv1': levels = [1, 3, 10, 20, 40] colors = ['purple', 'blue', 'green', 'red', 'black'] linestyles = ['solid', 'dashdot', 'dashed', 'dotted', 'solid'] if process == 'ttv1': levels = [5, 10, 20, 60, 150] colors = ['purple', 'blue', 'green', 'red', 'black'] linestyles = ['solid', 'dashdot', 'dashed', 'dotted', 'solid'] cp = ax.contour(X, Y, Z, levels=levels, colors=colors, linestyles=linestyles) plt.clabel(cp, inline=True, fontsize=8) # label plot plt.xlabel('$m_{V1}$ [GeV]') plt.ylabel('$c_{t}$') plt.text(0.8, 0.9, '$\\sigma$ [fb]', transform=ax.transAxes) plt.text(0.3, 0.05, f'p p > {process}, v1 > tt, $\\sqrt{{s}}$ = 14 TeV, $c_{{t}}$ = 1', transform=ax.transAxes) # style plot ax.set_xlim(375, 1000) ax.set_ylim(0, 3.2) # save figure fig.savefig(f'plot_greiner2015_{process}.png')
def makePlot(df): ampl.use_atlas_style(usetex=False) fig, ax = plt.subplots(figsize=(9, 8)) # create contour plot X, Y = np.meshgrid(np.sort(df.mass.unique()), np.sort(df.ct.unique())) Z = df.pivot(index='ct', columns='mass', values='cross_fb').values levels = [2.0, 5.0, 7.5, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0] cp = ax.contour(X, Y, Z, levels) plt.clabel(cp, inline=True, fontsize=8) # label plot plt.xlabel('$m_{V1}$ [GeV]') plt.ylabel('$c_{t}$') plt.text(0.7, 0.2, '$\\sigma$ [fb]', transform=ax.transAxes) plt.text(0.7, 0.1, 'p p > ttv1, v1 > tt', transform=ax.transAxes) plt.text(0.7, 0.05, '$\\sqrt{s}$ = 14 TeV', transform=ax.transAxes) # style plot ax.set_xlim(990, 2010) ax.set_ylim(0, 5.1) # save figure fig.savefig('plot_1604p07421_fig3.png')
import matplotlib.font_manager import os import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import atlas_mpl_style as ampl ampl.use_atlas_style() # set plotsytle choices here params = {'legend.fontsize': 13, 'axes.labelsize': 18} plt.rcParams.update(params) ampl.set_color_cycle('Oceanic',10) def histogramOverlay(frames, data, labels, xlabel, ylabel, figfile = '', x_min = 0, x_max = 2200, xbins = 22, normed = True, y_log = False, atlas_x = -1, atlas_y = -1, simulation = False, textlist = []): xbin = np.arange(x_min, x_max, (x_max - x_min) / xbins) plt.cla() plt.clf() fig = plt.figure() fig.patch.set_facecolor('white') zorder_start = -1 * len(data) # hack to get axes on top for i, datum in enumerate(data): plt.hist(frames[i][datum], bins = xbin, density = normed,
import atlas_mpl_style as atlas import numpy as np import numexpr as ne import scipy.stats as stats import scipy.interpolate as interp from statsmodels.nonparametric.kernel_regression import KernelReg import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator from matplotlib.markers import CARETUP import argparse import pickle import ROOT as r r.PyConfig.IgnoreCommandLineOptions = True from root_pandas import read_root # noqa atlas.use_atlas_style() class FitFunction: def __init__(self, x, y, yerr=None): reg = KernelReg([y], [x], var_type='c', reg_type='ll') vals = reg.fit(x)[0] self.spline = interp.UnivariateSpline(x, vals, w=np.isfinite(vals), ext='const') # calculate RMS and normalize to stop normalization drifting xs = np.linspace(np.min(x), np.max(x), 1000) ys = self.spline(xs) self.rms = np.sqrt(np.sum(ys**2) / 1000)
from argparse import ArgumentParser import os import uproot import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import atlas_mpl_style as ampl from palettable.colorbrewer.qualitative import Dark2_7 ampl.use_atlas_style(usetex=False) xlabels = { "VLB_m": "VLB m [GeV]", "VLB_pt": "VLB $p_{T}$ [GeV]", "H_m": "Higgs m [GeV]", "H_pt": "Higgs $p_{T}$ [GeV]", "b_pt": "b-quark $p_{T}$ [GeV]", } # xlimits = { # "VLB_m": [30, 100], # "VLB_pt": [0, 600], # "H_m": [0, 500], # "H_pt": [0, 500], # "b_pt": [0, 600], # } def getArguments(): parser = ArgumentParser() parser.add_argument("inputFile") parser.add_argument("--closure", nargs='*')