calamari.quality#
Per-point quality screening: which points of a file deserve a second look.
Measurement.quality()
returns a QualityReport – one row per measured point, stating what
the file offers about that point’s trustworthiness, and flagging the points
whose value breaks the continuity of its neighbours.
One gate, and evidence beside it. A point is flagged on its continuity
score alone (continuity_scores()): its departure from a straight line
through its neighbours, scaled by how far those neighbours stray from that
line themselves.
The threshold is an empirical diagnostic choice, not a probability or a
calibrated test of instrument quality. The remaining fields provide context:
relative uncertainty, within-point temperature/field spread, fit quality,
status departures and range changes. None alone proves a point defective;
nonzero statuses and range changes can accompany ordinary measurements or
physical features.
Nothing is dropped. The report describes; a caller decides. Three
consumers take that decision through an outliers= keyword, all warning
by default and all using the same score: the map helpers
(calamari.plot.chi_map_grid()), which can exclude flagged points from
a map; the family plots (calamari.plot.plot_family() and its
aliases), which can exclude them from each curve – where a waterfall’s
baseline= would otherwise let one glitch move every point of its curve;
and calamari.transitions.detect_transitions(), which can exclude them
from the search – a glitch on a smooth sweep is otherwise a sharp extremum,
exactly what a peak finder reports. The family plots and detection share
one contract, whose checks live at the end of this module: the same modes,
the same threshold, and a supplied report refused unless it describes the
measurement it is applied to. These deliberate shared policy/report refusals use
QualityInputError (also ValueError and
CalamariError).
This module imports no plotting library (PK-1): calamari.plot calls
continuity_scores() for its map glitch check, and the shared
outliers= checks for its family plots, not the other way round.
Module attributes
Neighbours on each side a point is compared against (so up to four neighbours, two on each side). |
|
A point is flagged when its departure from a straight line through its neighbours (fitted against the swept quantity) exceeds this multiple of the larger of (a) the neighbours' own disorder about that line and (b) the series-wide robust noise (1.4826 x MAD of every departure). |
|
Columns of |
Functions
Build the |
|
Continuity score for every point of every series. |
Classes
What a file says about the trustworthiness of each of its points. |