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:
objectOne 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.
- class daplis_rtp.gui.widgets.DirectoryPicker(parent=None, caption='Data folder', title='Select Directory', tip=None)[source]
Bases:
QWidgetA 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.
- 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
- class daplis_rtp.gui.widgets.FileSyncPanel(parent=None, labels=('Board 1', 'Board 2'), with_paths=False)[source]
Bases:
QGroupBoxStatus 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'}
- 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
- class daplis_rtp.gui.widgets.GaussianFitStrip(parent=None, scrollable=False)[source]
Bases:
QWidgetThe 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.
scrollableswaps the elided result line for one that scrolls sideways, for the full sensor, where the lines outrun the row.- 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
- property enabled
- class daplis_rtp.gui.widgets.LimitPair(parent=None, caption='x limits', spin=False, maximum=255, values=(0, 255), tip=None)[source]
Bases:
QWidgetTwo edges of one axis, side by side under the plot.
spinbuilds 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
- class daplis_rtp.gui.widgets.PeakStatsPanel(parent=None)[source]
Bases:
QGroupBoxThe 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.
- property enabled
- class daplis_rtp.gui.widgets.PixelMaskWindow(parent=None, boards=(('', 4, 64),), title='Pixel mask', n_pixels=256)[source]
Bases:
QDialogNon-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 * rowsmust come ton_pixels. The grid is filled across, so the first row is pixels 0 tocolumns - 1.title (str, optional) – Window title.
n_pixels (int, optional) – Pixels per board, by default 256.
- 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
- 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:
QWidgetA 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.
- class daplis_rtp.gui.widgets.TdcOccupancyPanel(parent=None, n_pixels=256)[source]
Bases:
QGroupBoxThe status box, and the pixel selection that feeds it.
- LED_STATES = {'bad': 'error', 'idle': 'idle', 'ok': 'ok', 'waiting': 'warn', 'warn': 'warn'}
- 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
- 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.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
thresholdin 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,lowandhigh(the window fitted). A successful fit addsamplitude,centre,sigmaandbackground, andcentre_errandsigma_err-Nonewhere the fit could not say. A failed one haserrorinstead, saying why.- Return type:
list of dict
- daplis_rtp.gui.widgets.float_value(field)[source]
A field’s value as a float, or
Nonewhen 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.peak_stats(rates, x_lim=None)[source]
Describe the peak in
ratesbetween 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:
Nonewhen the window holds nothing to describe - no pixels, or every one of them at zero. Otherwisepeak_pixel,peak_rate,centroid,fwhmandtotal, any of which except the first two may beNonewhere the window does not support the figure.- Return type:
dict or None
- 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
Submodules
- daplis_rtp.gui.widgets.controls module
- daplis_rtp.gui.widgets.file_sync module
- daplis_rtp.gui.widgets.gaussian_fit module
- daplis_rtp.gui.widgets.peak_stats module
- daplis_rtp.gui.widgets.pixel_mask module
- daplis_rtp.gui.widgets.tdc_occupancy module