daplis_rtp.gui.canvas package

Plot canvases: one themed base class and one subclass per plot.

class daplis_rtp.gui.canvas.BaseCanvas(parent=None, width=7, height=4, dpi=100)[source]

Bases: QWidget

A matplotlib figure, its toolbar, and the current theme.

Subclasses override draw_data() to say what to draw, and x_label / y_label to say what the axes are. Nothing else should need overriding.

__init__(parent=None, width=7, height=4, dpi=100)[source]
clear()[source]
draw_data(data)[source]

What this kind of plot draws. Overridden by every subclass.

property fontsize
glow(gradient=True)[source]

The look the application is known for, when the theme wants it.

Off by default in every theme but “Cyberpunk”, because it is not free: each line is redrawn several times over, which is felt on a stream refreshing as fast as the files arrive.

rc()[source]
refresh_theme()[source]

Redraw in the new theme, keeping whatever is on the plot.

render()[source]

Draw the stored data in the current theme.

Everything is drawn inside one rc_context: matplotlib reads the parameters when an artist is created, so styling has to wrap the drawing rather than follow it. The old code pushed values into the global plt.rcParams from inside each draw, which meant whichever canvas drew last decided how the others looked.

resizeEvent(event)[source]

Grow the plot font with the plot, once the dragging stops.

Each tab used to do this for itself, off the width of the whole window and with the same four magic numbers copied out five times. Off the canvas’s own width it is both in one place and correct: adding a control column beside the plot no longer changes the font on it.

scientific_y(*axes)[source]

Label the y-axis as ‘4.3’ against a ‘1e5’, where that applies.

Photon rates run to a few million, and an axis labelled in full needs more room beside the plot than the plot can spare.

Silently skipped on a logarithmic axis: ticklabel_format only understands the linear formatter and raises otherwise, which used to mean that new data arriving while the plot was on a log scale took the stream down with an AttributeError.

set_data(data)[source]

Hand in what to draw, and draw it.

set_scale_linear(linear)[source]

Switch the left y-axis between linear and logarithmic.

style_axes()[source]

Ticks, spines and labels, identical on every plot.

Inward ticks on all four sides with a minor set between them: the convention the group’s published figures use, and the reason a plot lifted straight out of the application needs no editing.

property theme
twin = False
x_label = ''
y_label = ''
class daplis_rtp.gui.canvas.DualSensorCanvas(parent=None, **kwargs)[source]

Bases: SensorCanvas

Photon rate across both halves of the full sensor, 512 pixels.

boundary = 255.5
group_lines = (64, 128, 192, 320, 384, 448)
n_pixels = 512
class daplis_rtp.gui.canvas.HistogramCanvas(parent=None, width=7, height=4, dpi=100)[source]

Bases: BaseCanvas

Counts against time within the acquisition cycle.

draw_data(data)[source]

What this kind of plot draws. Overridden by every subclass.

x_label = 'Time (ps)'
y_label = '# of timestamps (-)'
class daplis_rtp.gui.canvas.MziCanvas(parent=None, width=7, height=4, dpi=100)[source]

Bases: BaseCanvas

Photon rate in two pixels against elapsed time.

draw_data(data)[source]

What this kind of plot draws. Overridden by every subclass.

twin = True
x_label = 'Time (s)'
y_label = 'Photon rate (Hz)'
class daplis_rtp.gui.canvas.SensorCanvas(parent=None, **kwargs)[source]

Bases: BaseCanvas

Photon rate per pixel, for one LinoSPAD2 board.

__init__(parent=None, **kwargs)[source]
boundary = None
draw_data(data)[source]

What this kind of plot draws. Overridden by every subclass.

group_lines = (64, 128, 192)
n_pixels = 256
pixel_ctrl_clicked

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

x_label = 'Pixel (-)'
y_label = 'Photon rate (Hz)'
daplis_rtp.gui.canvas.toolbar_min_width(toolbar, sample='(x, y) = (255.0, 2000.0)\n[0.957, 0.514, 0.514, 0.0857]')[source]

Width at which every toolbar button and the readout still fit.

A QToolBar squeezed below its contents hides them behind a ‘>>’ overflow button rather than forcing its parent wider - its own minimumSizeHint is barely wider than that button - and the coordinate readout, being the widest item, is the first to go. It is also empty until the cursor reaches the axes, so nothing in the toolbar’s size hints reserves room for it while it is not needed.

The width is measured rather than assumed: the readout is asked how wide it would be with a full reading in it, which picks up the application’s font and any padding the style adds, both of which differ between machines.

Submodules