localuf.plot.runtime

Plot runtime data from sim.runtime.

Available functions:

  • mean

  • distribution

  • distributions

  • violin

Functions

distribution(data, noise_level[, bins, ...])

distributions(data, noise_level[, bins, ...])

Histogram runtime distributions for each DataFrame in data.

mean(data[, title, per_measurement_round, ...])

Plot mean timestep count against code distance.

violin(data, noise_level[, title, widths, ...])

Violin plot of runtime distributions for a given noise level.

localuf.plot.runtime.mean(data, title='', per_measurement_round=False, layers_per_sample=<function <lambda>>, yerr_shows='sem', plot_noise_levels=None, legend=None, grid=False, xlabel=None, ylabel=None, base_color=None, fill_between=True, fill_alpha=0.15, capsize=2, quantile=None, quantile_linestyle='--', **kwargs)[source]

Plot mean timestep count against code distance.

Parameters:
  • data (DataFrame) – a DataFrame where each column a (distance, probability); row, a runtime sample.

  • title (str) – plot title.

  • per_measurement_round (bool) – whether to divide runtime by measurement round count.

  • layers_per_sample (Callable[[int], int]) – a function with input d that outputs the measurement round count per row of data. Affects output only if per_measurement_round.

  • yerr_shows (Literal['sem', 'std']) – what errorbars show: either 'sem' for standard error, or 'std' for standard deviation.

  • plot_noise_levels (Sequence[float] | None) – sequence specifying which noise levels to plot, in case want to omit any.

  • base_color (None | tuple[float, float, float] | str) – a single color for all errorbars and their connecting lines. Decreasing noise level is then shown by increasing opacity. If None, each noise level is shown by a different, fully opaque color.

  • fill_between (bool) – whether to use fill_between instead of errorbar.

  • fill_alpha (float) – alpha value for the filled area.

  • capsize (float) – length of error bar caps in points.

  • quantile (None | float) – optional quantile (in the interval [0, 1]) to line plot.

  • quantile_linestyle (str) – linestyle for the quantile line.

  • kwargs – passed to either errorbar or fill_between depending on which is used.

  • legend (None | bool)

  • grid (bool)

  • xlabel (None | str)

  • ylabel (None | str)

Return data_copy:

A copy of data with runtimes divided by distance if per_measurement_round else an exact deep copy of data.

Return containers:

A dictionary where each key is a noise level; value, the ErrorbarContainer for that noise level.

localuf.plot.runtime.distribution(data, noise_level, bins=80, horizontal=True, figsize=None, log_scale=True, grid=False, global_range=True)[source]
Parameters:
  • data (DataFrame)

  • noise_level (float)

  • figsize (None | tuple[float, float])

localuf.plot.runtime.distributions(data, noise_level, bins=80, figsize=None, log_scale=True, grid=False, global_range=True, show_xticks=False, subplots_hspace=0.05, quantile=1, supxlabel_y=0.15, **kwargs_for_ylabel)[source]

Histogram runtime distributions for each DataFrame in data.

Parameters:
  • data (Sequence[DataFrame]) – sequence of DataFrames. In each DataFrame, each column a (distance, probability); row, a runtime sample.

  • noise_level (float) – noise level associated to the runtimes histogrammed.

  • bins (int | Iterable[int]) – bin count in each histogram. If an int, use same bin count for all entries in data. If any bin count is 0, set bin width to 1.

  • global_range – whether to use same bins for all distances within a DataFrame.

  • quantile (float) – the quantile (in the interval [0, 1]) to draw as a horizontal red line. Default is 1 i.e. the maximum of the sample.

  • supxlabel_y (float) – y-coordinate for the figure x-label.

  • kwargs_for_ylabel – passed to plt.ylabel for the leftmost subplot in each row.

  • figsize (None | tuple[float, float])

localuf.plot.runtime.violin(data, noise_level, title='', widths=1, showextrema=False, capsize=3, errorbar_kwargs=None, **kwargs_for_violinplot)[source]

Violin plot of runtime distributions for a given noise level.

Parameters:
  • capsize (float) – length of error bar caps in points.

  • data (DataFrame)

  • noise_level (float)

  • errorbar_kwargs (None | dict)