bencher.plotting.plot_filter

Classes

VarRange

A VarRange represents the bounded and unbounded ranges of integers. This class is used to define filters for various variable types. For example by defining cat_var = VarRange(0,0), calling matches(0) will return true, but any other integer will not match. You can also have unbounded ranges for example VarRange(2,None) will match to 2,3,4... up to infinity. for By default the lower and upper bounds are set to -1 so so that no matter what value is passed to matches() will return false. Matches only takes 0 and positive integers.

PlotFilter

A class for representing the types of results a plot is able to represent.

PlotMatchesResult

Stores information about which properties match the requirements of a particular plotter

Module Contents

class bencher.plotting.plot_filter.VarRange(lower_bound: int = 0, upper_bound: int = -1)

A VarRange represents the bounded and unbounded ranges of integers. This class is used to define filters for various variable types. For example by defining cat_var = VarRange(0,0), calling matches(0) will return true, but any other integer will not match. You can also have unbounded ranges for example VarRange(2,None) will match to 2,3,4… up to infinity. for By default the lower and upper bounds are set to -1 so so that no matter what value is passed to matches() will return false. Matches only takes 0 and positive integers.

lower_bound = 0
upper_bound = -1
matches(val: int) bool

Checks that a value is within the variable range. lower_bound and upper_bound are inclusive (lower_bound<=val<=upper_bound )

Parameters:

val (int) – A positive integer representing a number of items

Returns:

True if the items is within the range, False otherwise.

Return type:

bool

Raises:

ValueError – If val < 0

matches_info(val: int, name: str) tuple[bool, str]

Get matching info for a value with a descriptive name.

Parameters:
  • val (int) – A positive integer to check against the range

  • name (str) – A descriptive name for the value being checked, used in the output string

Returns:

A tuple containing:
  • bool: True if the value matches the range, False otherwise

  • str: A formatted string describing the match result

Return type:

tuple[bool, str]

__str__() str
class bencher.plotting.plot_filter.PlotFilter

A class for representing the types of results a plot is able to represent.

float_range: VarRange
cat_range: VarRange
vector_len: VarRange
result_vars: VarRange
panel_range: VarRange
repeats_range: VarRange
input_range: VarRange
matches_result(plt_cnt_cfg: bencher.plotting.plt_cnt_cfg.PltCntCfg, plot_name: str, override: bool) PlotMatchesResult

Checks if the result data signature matches the type of data the plot is able to display.

Parameters:
  • plt_cnt_cfg (PltCntCfg) – Configuration containing counts of different plot elements

  • plot_name (str) – Name of the plot being checked

  • override (bool) – Whether to override filter matching rules

Returns:

Object containing match results and information

Return type:

PlotMatchesResult

class bencher.plotting.plot_filter.PlotMatchesResult(plot_filter: PlotFilter, plt_cnt_cfg: bencher.plotting.plt_cnt_cfg.PltCntCfg, plot_name: str, override: bool)

Stores information about which properties match the requirements of a particular plotter

matches_info: str = ''
plt_cnt_cfg: bencher.plotting.plt_cnt_cfg.PltCntCfg
to_panel(**kwargs) panel.pane.Markdown | None

Convert match information to a Panel Markdown pane if debug mode is enabled.

Parameters:

**kwargs – Additional keyword arguments to pass to the Panel Markdown constructor

Returns:

A Markdown pane containing match information if in debug mode,

None otherwise

Return type:

pn.pane.Markdown | None