daplis_rtp.gui.widgets package

Widgets the tabs share: the controls, the two status boxes, the mask.

class daplis_rtp.gui.widgets.BoardOccupancy(label, occupancy, tdcs)[source]

Bases: object

One board’s occupancy, ready for the panel to render.

‘tdcs’ holds the TDCs of interest - the ones carrying the pixels being measured - as read out by the board, so a caller using ‘pix_add_fix’ must have mapped its pixels through ‘tdc_occupancy.pixel_to_tdc_map’ with the same flag. Callers hand over one entry per pixel, four of which share a TDC, so the list is reduced to the TDCs themselves here.

__init__(label, occupancy, tdcs)[source]
class daplis_rtp.gui.widgets.DirectoryPicker(parent=None, caption='Data folder', title='Select Directory', tip=None)[source]

Bases: QWidget

A caption, a path, and a Browse button - one header row’s worth.

Every tab that reads data files has one of these, and on the full sensor tab there are two, which is why the shell reserves two header rows on every tab: the plot has to start at the same height whether a tab fills both or one.

__init__(parent=None, caption='Data folder', title='Select Directory', tip=None)[source]
changed

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

path()[source]
set_path(path)[source]
class daplis_rtp.gui.widgets.FileSyncPanel(parent=None, labels=('Board 1', 'Board 2'), with_paths=False)[source]

Bases: QGroupBox

Status box for the check, with the sweeping thread behind it.

The host tab calls ‘start’ when the acquisition starts and ‘stop’ when it ends; with ‘with_paths’ the box also carries its own pair of directory selectors, for tabs that do not have them already.

LED_STATES = {'bad': 'error', 'idle': 'idle', 'ok': 'ok', 'pending': 'warn', 'waiting': 'warn'}
__init__(parent=None, labels=('Board 1', 'Board 2'), with_paths=False)[source]
is_enabled()[source]
paths()[source]

The pair of directories the check compares.

problem

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

set_paths(path_1, path_2)[source]

Point the check at the two working directories.

start()[source]

Begin sweeping; re-arms the alert of a previous run.

stop()[source]

End the sweep; the last verdict stays on display.

class daplis_rtp.gui.widgets.GaussianFitStrip(parent=None, scrollable=False)[source]

Bases: QWidget

The switch, the threshold, and one sigma per line, in one row.

Sits directly above the plot, under the row naming the brightest pixels, so that the widths being watched are read in the same glance as the peaks they belong to.

scrollable swaps the elided result line for one that scrolls sideways, for the full sensor, where the lines outrun the row.

__init__(parent=None, scrollable=False)[source]
changed

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

clear(text='')[source]
property enabled
show_fits(fits)[source]

Render one refresh’s fits, sigma first, in the result line.

threshold()[source]
class daplis_rtp.gui.widgets.LimitPair(parent=None, caption='x limits', spin=False, maximum=255, values=(0, 255), tip=None)[source]

Bases: QWidget

Two edges of one axis, side by side under the plot.

spin builds the integer pair the pixel axes use, where every value is a pixel and both edges always have one; the float pair is for the axes where an edge can simply be left to autoscale.

__init__(parent=None, caption='x limits', spin=False, maximum=255, values=(0, 255), tip=None)[source]
changed

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

values()[source]
class daplis_rtp.gui.widgets.PeakStatsPanel(parent=None)[source]

Bases: QGroupBox

The four figures, in the control column.

Checkable, like the other two status boxes, and for the same reason: the tick is a row of the column saved over a check box of its own. Cleared, it stops the host asking for the arithmetic at all.

__init__(parent=None)[source]
clear(text='—')[source]
property enabled
show_stats(stats)[source]

Render one refresh’s figures, or blank them.

class daplis_rtp.gui.widgets.PixelMaskWindow(parent=None, boards=(('', 4, 64),), title='Pixel mask', n_pixels=256)[source]

Bases: QDialog

Non-modal window holding one grid of check boxes per board.

Parameters:
  • parent (QWidget) – The host tab. The window is a top-level one all the same, so it can be moved away from the application and left beside it.

  • boards (sequence) – One (label, columns, rows) per board; columns * rows must come to n_pixels. The grid is filled across, so the first row is pixels 0 to columns - 1.

  • title (str, optional) – Window title.

  • n_pixels (int, optional) – Pixels per board, by default 256.

__init__(parent=None, boards=(('', 4, 64),), title='Pixel mask', n_pixels=256)[source]
changed

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

clear_requested

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

masked_counts()[source]

Masked pixels per board, for the host’s summary label.

open_beside()[source]

Show the window, raising it if it is already open.

refresh_counts()[source]

Update the ‘n masked’ line under each board’s grid.

set_all(masked=False)[source]

Tick or untick every box on every board, with one changed.

set_pixels(board, pixels, masked=True)[source]

Tick or untick many boxes at once, with one changed.

The preset mask ticks a couple of hundred boxes in a row, and each one emitting for itself would be a couple of hundred redraws of the plot - which is what masking now triggers, since a tick is meant to take effect on the trace immediately rather than at the next data file.

class daplis_rtp.gui.widgets.ReadoutStrip(parent=None)[source]

Bases: QWidget

A row of ‘name: value’ readings, for the second header row.

The tabs that need only one browse row put a reading here instead of leaving the row empty - which is how the top-most pixels came out of the control column, where they were costing every tab in the application a row of height.

__init__(parent=None)[source]
add(key, caption, initial='—', tip=None, width=None)[source]
add_stretch()[source]
set(key, text)[source]
class daplis_rtp.gui.widgets.TdcOccupancyPanel(parent=None, n_pixels=256)[source]

Bases: QGroupBox

The status box, and the pixel selection that feeds it.

LED_STATES = {'bad': 'error', 'idle': 'idle', 'ok': 'ok', 'waiting': 'warn', 'warn': 'warn'}
__init__(parent=None, n_pixels=256)[source]
attach_timestamps_spinbox(spin_box)[source]

Point ‘Apply’ at the tab’s ‘Timestamps’ box.

clear(text='not running')[source]

Blank the readout, e.g. when the check is switched off.

property enabled

Whether the host should ask for the occupancy at all.

explicit_pixels()[source]

The typed-in pixels, or None when the mask is to be used.

Raises:

ValueError – If the text cannot be read as pixels; the caller decides whether to report it or to carry on with the mask.

problem

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

reset()[source]

Called when a stream starts: clear the once-per-run alert.

show_result(boards)[source]

Render one refresh.

Parameters:

boards (list of BoardOccupancy) – One entry per board plotted. The worst ‘Signal’ figure across the boards is the one shown, and likewise the worst ‘Sensor’ one - a full-sensor run is only as good as its worse half.

daplis_rtp.gui.widgets.daughterboard_combo(parent=None)[source]
daplis_rtp.gui.widgets.describe_fit(fit, short=True)[source]

One line for one fit, as the strip and the export show it.

daplis_rtp.gui.widgets.firmware_combo(parent=None)[source]

Not editable: the unpacking only knows these two.

daplis_rtp.gui.widgets.fit_peaks(rates, threshold, x_lim=None, valid=None)[source]

Fit a Gaussian to every line above threshold in view.

Parameters:
  • rates (array-like) – Photon rate per pixel, indexed by pixel number.

  • threshold (float) – Rate a pixel must exceed to belong to a line.

  • x_lim (tuple, optional) – (low, high) pixel numbers, inclusive, as shown on the plot. The whole array when omitted.

  • valid (array-like, optional) – Truthy for the pixels that may be used. Masked pixels read zero, and a zero inside a line would drag its fit down, so they are left out of the fit rather than fitted as data.

Returns:

One per line, left to right. Each has peak_pixel, low and high (the window fitted). A successful fit adds amplitude, centre, sigma and background, and centre_err and sigma_err - None where the fit could not say. A failed one has error instead, saying why.

Return type:

list of dict

daplis_rtp.gui.widgets.float_value(field)[source]

A field’s value as a float, or None when it is unset.

A field left empty - or holding a fragment the validator tolerated while typing, such as a lone ‘-’ or ‘e’ - means that edge should autoscale rather than break the plot.

daplis_rtp.gui.widgets.info_badge(tooltip, parent=None)[source]

The small boxed ‘i’ that carries an explanation beside a control.

daplis_rtp.gui.widgets.mask_summary(counts)[source]

‘18 masked’, or ‘b1: 18, b2: 0’ for two boards.

daplis_rtp.gui.widgets.masked_array(boxes, n_pixels=256)[source]

1 where the pixel is not masked, as the tabs’ mask arrays are.

daplis_rtp.gui.widgets.motherboard_combo(parent=None)[source]
daplis_rtp.gui.widgets.peak_stats(rates, x_lim=None)[source]

Describe the peak in rates between the given x-limits.

Parameters:
  • rates (array-like) – Photon rate per pixel, indexed by pixel number.

  • x_lim (tuple, optional) – (low, high) pixel numbers, inclusive, as shown on the plot. The whole array when omitted.

Returns:

None when the window holds nothing to describe - no pixels, or every one of them at zero. Otherwise peak_pixel, peak_rate, centroid, fwhm and total, any of which except the first two may be None where the window does not support the figure.

Return type:

dict or None

daplis_rtp.gui.widgets.pixel_spin(parent=None, maximum=255)[source]
daplis_rtp.gui.widgets.pixels_of_interest(explicit, mask_valid, x_lim, offset=0, n_pixels=256)[source]

Which of one board’s pixels are worth watching.

Parameters:
  • explicit (ndarray or None) – Pixels typed in by hand, in the coordinates of the plot’s x-axis. None to fall back on the mask and the x-limits.

  • mask_valid (array-like) – The tab’s mask array for this board, one entry per pixel, nonzero where the pixel is not masked.

  • x_lim (tuple) – Current x-axis limits, in the coordinates of the plot.

  • offset (int, optional) – Where this board starts on that x-axis: 0 for a single board or for board 1 of the full-sensor tab, 256 for board 2.

  • n_pixels (int, optional) – Pixels on the board, by default 256.

Returns:

Pixel indices local to the board, 0..n_pixels-1. Empty when the board lies wholly outside the x-limits, or when every pixel of it is masked.

Return type:

ndarray

daplis_rtp.gui.widgets.timestamps_spin(parent=None)[source]

Submodules