contur.plot package

Submodules

contur.plot.color_config module

contur.plot.color_config.sanitise_poolName(poolid)[source]

contur.plot.contur_plot module

main module of heatmap plotting functions

class contur.plot.contur_plot.AxesHolder(xAxis, xAxisMesh, xLabel, xLog, yAxis, yAxisMesh, yLabel, yLog, title)[source]

Bases: object

Data structure to keep things legible in the code, holds the Axes scoped from the map file and information about how we visualise it. Just used for book keeping

class contur.plot.contur_plot.ConturPlotBase(conturDepot, outPath, plotTitle='', savePlotFile=False, omittedPools='', iLevel=3, iOrder=3, iSigma=0.75, clLevel=0, style='DRAFT', showcls=False, simplecls=False, show_secondary=False, interactive_mode=False, min_cls=0.68)[source]

Bases: Depot

ConturPlotBase extends the depot class to dress things nicely for plotting, it also contains all the steering functions the default plotting macro needs

Todo

a config file based setup to stop the command line argument bloat in the plotting macro

add_external_functions(ExternalFunctions)[source]

Switch to provide the external exclusion function files to the PlotBase instance

add_external_grids(ExternalGrids)[source]

Switch to provide the external exclusion grid files to the PlotBase instance

build_axes()[source]

Function to build the axis dictionaries used for plotting, parameter space points are otherwise stored unordered

Built variables:
  • mapAxis (dict)

  • plotAxis (dict)

@TODO should seperate the data structures from the plotting.

build_axes_from_grid(xarg, yarg, logX=False, logY=False, xlabel=None, ylabel=None)[source]

Function to build the axes out of the underlying map, creates an AxesHolder instance to store the info and pass nicely to the plotting engine

Todo

Refactor how we store the grids in general, should just reuse the initial scanning functions to build the space OTF

build_grid(xarg, yarg)[source]

Build the grid in the style mpl needs to make it easy to plot, converts the unordered dictionary of paramPoints into a structured numpy array

Todo

revive ND capabilities, might need a total overhaul of how we do this

build_grid_from_data(stat_type, xarg, yarg)[source]

Build a plotting grid from the expected and secondary statistics Assumes the keys for the parameters are the same for all points and grabs them from first point :param xarg: the x-axis variable name :param yarg: the y-axis variable name

build_grid_from_functions(xarg, yarg)[source]

Builds the grid to pointwise evaluate external function on :param xarg: the x-axis variable name :param yarg: the y-axis variable name

build_grid_from_grid(xarg, yarg)[source]

Build a plotting grid from the supplied external grids Assumes the keys for the parameters are the same for all points and grabs them from first point :param xarg: the x-axis variable name :param yarg: the y-axis variable name

build_special_grid(xarg, yarg)[source]

build_special_grid allows us to build an empty grid from the sampled points dictionary, this is used for adding custom functions to evaluate on the grid. For example see the log-read snippets prepared for the BL paper

check_args(xarg, yarg)[source]

Function to call to check the requested arguments of what to plot are compatible with what is in the map

dump_color_palette_tex()[source]

Function to dump a .tex file containing a LaTeX legend for the dominant pools plots.

dump_plot_objects()[source]

Small function to dump a pickle of the plot objects if requested, this is to allow any mpl image manipulation without using the contur package at all

get_pool_name_from_ID(currID)[source]

return the name of the analysis pool, given the ID number

property map_axis

Dictionary of the sampled values in each axis

type (dict) – key – Parameter name (string), value – (numpy.ndarray)

property plot_axis

Dictionary of the offset midpoints in each axis, for colormesh purposes

type (dict) – key – Parameter name (string), value – (numpy.ndarray)

plot_figures()[source]

make the various figures

set_output_path(outputpath)[source]

Convenience switch to set the output path name for the PlotBase instance

contur.plot.contur_plot.color_tint(col, tintfrac)[source]

Return a colour as rgb tuple, with a fraction tintfrac of white mixed in (or pass a negative tintfrac to mix with black, giving a shade rather than tint

class contur.plot.contur_plot.conturPlot(saveAxes=False, plotTitle='', iLevel=3, iOrder=3, iSigma=0.75, style='DRAFT', showcls=False, simplecls=False, interactive_mode=False, primary_stat='SMBG')[source]

Bases: object

conturPlot is the engine that interacts with the matplotlib.pyplot plotting library

add_external_data_grids(external_data_grids)[source]

Add the alternative data grids, this is a workaround for now .. todo:: Revisit the implementation of smoothing using scipy’s interpolator here

add_grid(numpyGrid, label, dest, axHolder)[source]

Main access method to give the plot all the attributes it needs in a numpy format that feeds directly into mpl

add_limits(ax, level=3, sigma=0.75)[source]

Add the overlaid extra limit contours

induce_CLs_grid(axis, grid, inPercent=False)[source]

show the bin contents as text

interactive_find_index(list, value)[source]
interpolate_grid(level=3, sigma=0.75, order=3)[source]

Use scipy’s interpolators to create smoothed & zoomed versions of the grid and axes

load_style_defaults()[source]

Some core common styling such as figure dimensions, and rcParams

make_canvas(dims=None)[source]

Convenience function for the individual plots

on_button_click(event, cpb)[source]
on_mouse_hover(event, cpb, annotations)[source]
plot_CLs(gridSpecs, grid, title, extend='neither')[source]

plot a mesh of the grid with CLs values

plot_hybrid()[source]

Build the default contur output for combined limit, a hybrid plot showing both a colormesh of the underlying exclusion and the derived 1 and 2 sigma confidence intervals from this space Makes the file combinedHybrid.pdf.

plot_levels()[source]

Make an individual levels plot, currently just used for compatibility to show the individual pools Makes the file combinedLevels.pdf .. todo:: Derive these from the main hybrid plot

plot_mesh(make_cbar)[source]

Make an individual colormesh plot, currently just used for compatibility to show the individual pools .. todo:: Derive these from the main hybrid plot Makes the file combinedMesh.pdf

plot_mesh_overlay(make_cbar=False)[source]

Make an individual colormesh plot with overlaid limit contours Makes the file combinedOverlay.pdf

plot_pool_CLs(cpb, level)[source]

Make a 2D plot of the pools’ CLs

plot_pool_names(cpb, level)[source]

Make a 2D plot of the dominant pool names and their CLs values

prepare_axis(axis)[source]
contur.plot.contur_plot.get_pool_color(pool, tints=True)[source]

Return the colour for a given analysis pool, optionally tinted according to beam energy

class contur.plot.contur_plot.grid[source]

Bases: object

A grid of values which can be plotted (as a heatmap or a contour)

contur.plot.label_maker module

This file is to allow some closer interaction with the labels put on plots, this is just to keep the conturPlot methods cleaner until a good UI for placing labels is dreamt up. In the meantime, if you want to label curves on plots, you will have to write methods here and modify the addLimits function in contur_plot.py to use them.

pass the axes instance you want to dress with a label to a function to do that

#TODO Look at an optional second legend

contur.plot.label_maker.BLCaseA(axes)[source]
contur.plot.label_maker.BLCaseB(axes)[source]
contur.plot.label_maker.BLCaseC(axes)[source]
contur.plot.label_maker.BLCaseDE(axes)[source]
contur.plot.label_maker.DM_LF(axes)[source]
contur.plot.label_maker.typeIIseesaw(axes)[source]

contur.plot.axis_labels module

Define some default axis labels

contur.plot.axis_labels.get_axis_labels()[source]

contur.plot.html_utils module

contur.plot.html_utils.plot_render_html(file, obsname, analysis, vis=False, size='300')[source]

Constructs an html snippet linking a rivet/contur plot. Writes in to the open file

arguments: :param file: an opened file to write to :param obsname: the name of the histogram (last part of the yoda path) :param analysis: the analysis the histogram belongs to. :type analysis: contur.data.data_objects.analysis

contur.plot.html_utils.selectHistogramsForPlotting(histograms, pool_exclusions, CLs, print_only, include_none)[source]

concatenate the histograms dict into a list of python scripts that will be executed based on analysis matching and a CLs cut-off

returns pyScripts = dict of scripts and output directories matchedPools, matchedAnalyses

contur.plot.html_utils.writeAlistHTML(dir, ana_dict)[source]

write index.html file corresponding to a particular analyses and predictions in the cwd

contur.plot.html_utils.writeAnaHTML(analysis, excl, anaDir, histoList, prediction=None)[source]

write index.html file corresponding to a particular analysis, showing the .png of histograms

contur.plot.html_utils.writeIndexHTML(matchedPools, matchedAnalyses, matchedHistos, param_point, exclusions)[source]

write index.html to cfg.plot_dir file for contur plots

contur.plot.html_utils.writePoolHTML(pool, poolDir, thisPoolMatchedAnalyses, exclusion)[source]

Module contents