calamari.scales#
How detected features behave across a declared set of smoothing windows.
Every transition candidate is found in a smoothed representation of a
sweep, and the smoothing window is an analysis choice. It matters most
where the feature is weakest: the curvature a 'kink' is found in is
far noisier than the signal a 'peak' is found in, so a slope change’s
significance, and sometimes its sign, can move a long way between two
reasonable windows, while a strong cusp barely moves at all. Fisher’s
d(yT)/dT maximum shifts with the window too (see docs/DETECTION.md).
The tempting response – try windows until one gives a clean answer, then
quote that one – is a forking path: the window was chosen after looking
at the result, and the quoted significance no longer means what it says.
scan_smoothing() closes that path by making the choice explicit and
complete. The caller declares a set of windows up front; every one of them
is run through detect_transitions_all(), every
result is kept, and each sweep’s features are tracked across the set
with the same deterministic nearest-unclaimed walk that
link() uses across sweeps,
the window index playing the part of the held field. The tracks table
then says, per feature, in how many of the windows it appeared, how far
it moved, whether its sign held, and the range of its per-window
significance.
This is the scale-space picture: follow each extremum of a signal and of its derivatives as the smoothing scale changes, and prefer the description that is stable over a wide range of scales (A. P. Witkin, “Scale-space filtering”, Proc. 8th Int. Joint Conf. Artificial Intelligence (IJCAI-83), vol. 2, pp. 1019-1022 (1983)). Its statistical counterpart, which asks where a curve’s slope is significantly non-zero at each bandwidth of a family and shows the whole family at once, is SiZer (P. Chaudhuri and J. S. Marron, “SiZer for exploration of structures in curves”, J. Am. Stat. Assoc. 94, 807-823 (1999)).
What persistence is, and is not#
Persistence is robustness to an analysis choice. It is not evidence. Every window sees the same data, so the per-window significances are strongly correlated: a noise excursion that scores 4 at one window scores about 4 at its neighbour, and a feature found in all four windows has not been seen four times. So:
the per-window significances are never combined – no Stouffer sum, no mean used as a score.
link()may combine across sweeps because each sweep is a separate measurement; windows are not.trackstherefore carries the range of the significance (min, median, max) and no combined statistic;there is no
best_window. Quoting whichever window happened to maximise the significance is exactly what the scan exists to prevent. Report the whole declared set;the scan gates nothing. It is a recorded description, like
link();scan.reference(window)attaches diagnostics to a declared result, whose optionalrobust()sensitivity thresholds record the decision.
A feature that persists is one whose existence does not hinge on the window you picked. A feature that does not persist may still be real (too sharp for the widest window, too weak for the narrowest); a feature that persists may still be an artefact the data share at every scale (a glitch, a background step). Persistence answers “would another reasonable window have told me something different?”, nothing more.
This module never imports calamari.plot or matplotlib (PK-1).
Module attributes
The fewest windows a scan accepts. |
|
Columns that must match along a track, on top of |
|
one row per (track, window) hit. |
|
one row per track. |
Functions
Run detection at every declared smoothing window and track each feature across them. |
Classes
One detection per declared smoothing window, and each feature tracked across them. |