telescopic.plotting

Plots of results: meeting times, the TV bound and signed histograms (needs matplotlib).

telescopic.plotting.CHAIN_X = '#D93A74'

The color of chain \(X\) in plots: the magenta of the documentation’s identity.

telescopic.plotting.CHAIN_Y = '#0095A6'

The color of chain \(Y\) in plots: the identity’s teal.

telescopic.plotting.MET = '#062A4F'

The color of a pair once its chains have met: the identity’s ink of met chains.

telescopic.plotting.corner(result, dims=None, bins=20)

A corner plot of signed histograms: marginals on the diagonal, pairs below it.

The pairs are colored by signed density with a diverging map centered on 0. Telescopic never passes signed weights to corner or ArviZ, whose weighted quantiles assume non-negative weights.

Parameters:
resultResult

The result to plot.

dimsint or sequence of int, optional

Coordinates; all by default.

binsint

The number of bins along each coordinate.

Returns:
ndarray of Axes, shape (len(dims), len(dims))
telescopic.plotting.marginals(result, dims=None, bins=20, axes=None)

Signed histograms of the marginals, with boxes of plus or minus 2 standard errors.

A bin’s density is the average over replicates of its signed mass, divided by its width, so a bin can be negative: the bias corrections carry negative weights, and where few atoms fall they can outweigh the others. The boxes show the Monte Carlo error.

Parameters:
resultResult

The result to plot.

dimsint or sequence of int, optional

Coordinates; all by default.

binsint

The number of bins along each coordinate.

axessequence of Axes, optional

One per coordinate; by default, those of a new figure.

Returns:
list of Axes
telescopic.plotting.meeting_times(result, axes=None)

The meeting times: a histogram of \(\tau - L\), and its survival function.

The survival function \(P(\tau - L > t)\), drawn by survival(), is on a log scale, where a straight tail means geometric meeting times. A censored pair counts in it at every time up to the cap, where the curve ends at the fraction censored, and not in the histogram.

Parameters:
resultResult

The result to plot.

axessequence of two Axes, optional

By default, those of a new figure.

Returns:
list of two Axes
telescopic.plotting.paths(replicates, dims=(0, 1), n=3, ax=None)

The coupled paths of a few replicates, for teaching: X solid, Y dashed.

They need the paths that telescopic.engine.run() keeps with keep_paths=True. In one dimension they run against time, with Y shifted by the lag so that each pair meets at its meeting time; otherwise they are drawn in the plane of dims.

X is drawn in CHAIN_X and Y in CHAIN_Y until they meet; from the meeting time on, the path of X, now the pair’s, is drawn in MET. The colors are chosen for a light figure ground. Pairs are told apart by position, not by color, and a legend names the three lines, after the lines that ax already labels. In one dimension the ticks of the time axis are integers.

Parameters:
replicatestelescopic.engine.Replicates

The output of a run that kept its paths.

dimstwo ints

The plane, for more than one dimension.

nint

Replicates drawn, the first ones.

axAxes, optional

By default, that of a new figure.

Returns:
Axes
telescopic.plotting.survival(meeting_times, lag, ax=None, *, max_iter=None, label=None)

The survival function \(P(\tau - L > t)\) of meeting times, on a log scale.

The curve steps at each meeting time, from \(t = 0\). A censored pair, given as inf, counts at every time up to the cap, max_iter, where the curve ends at the fraction censored. Several calls on one ax overlay their curves.

Parameters:
meeting_timesarray_like, shape (R,)

Meeting times \(\tau\), integers from lag on, inf for a censored pair, as telescopic.CoupledSampler.meeting_times() and Result.meeting_times give them.

lagint

The lag \(L\) of the runs that produced them.

axAxes, optional

By default, that of a new figure.

max_iterint, optional

The cap of the runs, needed when a pair is censored.

labelstr, optional

The curve’s label, for a legend.

Returns:
Axes
telescopic.plotting.tv_bound(result, ax=None)

The estimated bound on the total variation distance to the target against t.

The bound is on a log scale, with k marked and a band of two standard errors about the average before its cap at 1, capped in turn: where the cap holds the average well above 1 the band shrinks to the line at 1. Where its lower edge is not positive, the band reaches the bottom of the axis.

Parameters:
resultResult

The result to plot.

axAxes, optional

By default, that of a new figure.

Returns:
Axes