plots¶
This module contains functions to plot the results of the fits.
-
SMEFT19.plots.
binerrorbox
(binmin, binmax, central, error, centralline=False, rect_args=None, line_args=None)[source]¶ Plots an error box.
- Arguments
binmin: Minimum x value of the error box.
binmax: Maximum x value of the error box.
central: Central y value.
error: Error in the y direction. error must be a float if the error is symmetric, or a tuple (error_inf, error_sup) if the error is not symmetric.
centralline: True to plot a horizontal line for the central value. Default: False.
rect_args: Optional arguments passed to plot the box.
line_args: Optional arguments passed to plot the central line.
-
SMEFT19.plots.
compare_plot
(wfun, fin, fout, sigmas=1)[source]¶ Plots the pull of each observable in the SM and in the NP hypothesis.
- Arguments
wfun: Function that takes a point in parameter space and returns a dictionary of Wilson coefficents.
fin: Path to the .yaml file where the ellipsoid is saved.
fout: Path to the files where the plots will be saved. Two files are created, one .pdf and one .pgf (to use in TeX). Extensions are added automatically.
-
SMEFT19.plots.
darken_color
(color, amount=0.5)[source]¶ Darkens the given color by multiplying luminosity by the given amount. Input can be matplotlib color string, hex string, or RGB tuple. Examples: >> darken_color(‘g’, 0.3) >> darken_color(‘#F034A3’, 0.6) >> darken_color((.3,.55,.1), 0.5)
-
SMEFT19.plots.
error_plot
(fout, plottype, flist, flist2=None, legend=0)[source]¶ Plots the uncertainty intervals for several observables in NP scenarios, SM and experimental values.
- Arguments
fout: Path to the files where the plots will be saved. Two files are created, one .pdf and one .pgf (to use in TeX). Extensions are added automatically.
plottype: Selects the observables to be plotted:
‘RK’: Plots RK in the [1.1,6.0] bin and RK* in the [0.045,1.1] and [1.1,6] bins.
‘RD’: Plots RD, and RD* using only muons or muons+electrons.
flist: List of paths to files created by obsuncert.calculate.
flist2: Additional list of paths to files created by obsuncert.calculate.
legend: 0 for no legend, 1 for legend next to the plot and 2 for legend inside the plot.
-
SMEFT19.plots.
evolution_plot
(obscodes, wfun, fin, direction, fout, obsnames=None)[source]¶ Plots the vairation of the pull of several observables along a line connecting two opposite notable points of the ellipsoid.
- Arguments
obscodes: List of ID-Numbers of the observables, as returned by comparepulls.pointpull
wfun: Function that takes a point in parameter space and returns a dictionary of Wilson coefficents.
fin: Path to the .yaml file where the ellipsoid is saved.
direction: string with the following format:
‘ax’ + str(i): for the i-th principal axis of the ellipsoid.
‘sm’: for the direction joining the bf and sm points.
fout: Path to the files where the plots will be saved. Two files are created, one .pdf and one .pgf (to use in TeX). Extensions are added automatically.
-
SMEFT19.plots.
hatch_contour
(x, y, z, levels, interpolation_factor=1, interpolation_order=2, col=0, label=None, hatched=True, contour_args=None, contourf_args=None)[source]¶ Plots coloured and hatched confidence contours (or bands) given numerical input arrays.Based on the flavio function
- Arguments
x, y: 2D arrays containg x and y values as returned by numpy.meshgrid
z: value of the function to plot. 2D array in the same shape as x and y. The lowest value of the function should be 0 (i.e. the best fit point).
levels: list of function values where to draw the contours. They should be positive and in ascending order.
[interpolation factor:: in between the points on the grid, the functioncan be interpolated to get smoother contours. This parameter sets the number of subdivisions (default: 1, i.e. no interpolation). It should be larger than 1.]
[col: number between 0 and 9 to choose the color of the plot from a predefined palette.]
[label: label that will be added to a legend created with maplotlib.pyplot.legend().]
[contour_args: dictionary of additional options that will be passed to matplotlib.pyplot.contour() (that draws the contour lines).]
[contourf_args: dictionary of additional options that will be passed to matplotlib.pyplot.contourf() (that paints the contour filling).]
-
SMEFT19.plots.
likelihood_plot
(grid, xmin, xmax, ymin, ymax, axlabels, fout=None, locleg=0, n_sigma=(1, 2), colors=None, styles=None, widths=None, ticks=0.5, bf=None)[source]¶ Plots a contour plot of the log-likelihood of the fit.
- Arguments
grid: List containing the x coordinates, y corrdinates and a dictionary for the likelihood values in the grid.
xmin: Minimum value of the x coordinate.
xmax: Maximum value of the x coordinate.
ymin: Minimum value of the y coordinate.
ymax: Maximum value of the y coordinate.
axlabels: List containing two strings to label the x and y axes.
[fout: Path to the files where the plots will be saved. Two files are created, one .pdf and one .pgf (to use in TeX). Extensions are added automatically.]
[locleg: Position of the legend of the plot, using matplotlib’s syntaxis. Default=0 (best position).]
[n_sigma: List containing the significance (in sigmas) of each contour. Default = (1,2).]
[colors: List with the colors of each contour. Default: flavio palette.]
[styles: List with the linestyles of each contour. Default: All solid.]
[widths: List with the linewidths of each contour. Default: All 1pt.]
[ticks: Interval between ticks in both axes. Default:0.5]
[bf: Coordinates of the best fit point(s). It can be None (no point marked) or a list containing two floats (one point marked). Default: None.]