contur.plot package

Submodules

contur.plot.color_config module

Defines the colour mapping to analysis pools.

contur.plot.contur_plot module

main model of plotting functions TODO rename functions from CamelCase to under_score

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, iSigma=0.75, clLevel=0, style='DRAFT', showcls=False, simplecls=False)[source]

Bases: contur.factories.depot.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_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

Todo

this method seems to be a bit of a monster that does a lot more than the name and doc would indicate…

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_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

set_output_path(outputpath)[source]

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

class contur.plot.contur_plot.altDataHolder[source]

Bases: object

Data structure to keep things legible in the code, book keep for external grids/exclusion functions as each may have different sampled values

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, iSigma=0.75, style='DRAFT', showcls=False, simplecls=False)[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, colorCycle, filled=True)[source]

Add the overlaid extra limit contours

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

show the bin contents as text

interpolate_grid(level=3, sigma=0.75)[source]

Use scipy’s interpolators to create smoothed & zoomed versions of the grids 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

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

plot_levels()[source]

Make an individual levels plot, currently just used for compatibility to show the individual pools .. 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

plot_mesh_overlay(make_cbar=False)[source]

Make an individual colormesh plot with overlaid limit contours

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

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]

Module contents