daplis_rtp.gui.widgets.peak_stats module

What the peak in view is doing, in numbers.

Aligning a setup means maximising something, and until now the only figure on screen was which pixel was brightest. That tells you a peak moved but not whether it got better: a peak that doubles in height while doubling in width has gained nothing, and one that shifts by half a pixel is invisible against the sample spacing.

So four numbers, over the x-limits currently shown - which is what makes them useful, since narrowing the limits onto the signal is how you stop a hot pixel elsewhere on the sensor dominating the answer:

  • the brightest pixel and its rate - where the peak is,

  • the centroid - where it is to better than a pixel,

  • the FWHM - how tight it is,

  • the sum over the view - how much light is getting through at all.

The arithmetic is a plain function so that it can be tested without a window; the group box below only displays what it returns.

class daplis_rtp.gui.widgets.peak_stats.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.

daplis_rtp.gui.widgets.peak_stats.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