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:
QWidgetA matplotlib figure, its toolbar, and the current theme.
Subclasses override
draw_data()to say what to draw, andx_label/y_labelto say what the axes are. Nothing else should need overriding.- 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.
- 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 globalplt.rcParamsfrom 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_formatonly 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 anAttributeError.
- 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:
SensorCanvasPhoton 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:
BaseCanvasCounts against time within the acquisition cycle.
- x_label = 'Time (ps)'
- y_label = '# of timestamps (-)'
- class daplis_rtp.gui.canvas.MziCanvas(parent=None, width=7, height=4, dpi=100)[source]
Bases:
BaseCanvasPhoton rate in two pixels against elapsed time.
- twin = True
- x_label = 'Time (s)'
- y_label = 'Photon rate (Hz)'
- class daplis_rtp.gui.canvas.SensorCanvas(parent=None, **kwargs)[source]
Bases:
BaseCanvasPhoton rate per pixel, for one LinoSPAD2 board.
- boundary = None
- 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
QToolBarsqueezed below its contents hides them behind a ‘>>’ overflow button rather than forcing its parent wider - its ownminimumSizeHintis 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
- daplis_rtp.gui.canvas.base module
BaseCanvasBaseCanvas.__init__()BaseCanvas.clear()BaseCanvas.draw_data()BaseCanvas.fontsizeBaseCanvas.glow()BaseCanvas.rc()BaseCanvas.refresh_theme()BaseCanvas.render()BaseCanvas.resizeEvent()BaseCanvas.scientific_y()BaseCanvas.set_data()BaseCanvas.set_scale_linear()BaseCanvas.style_axes()BaseCanvas.themeBaseCanvas.twinBaseCanvas.x_labelBaseCanvas.y_label
toolbar_min_width()
- daplis_rtp.gui.canvas.histogram module
- daplis_rtp.gui.canvas.mzi module
- daplis_rtp.gui.canvas.sensor module