- Replace bare metadata["sample_rate"] access with .get() + clear
ValueError in threshold_qualifier, energy_detector, cusum_annotator,
parallel_signal_separator, and signal_isolation
- Add --sample-rate option to energy, threshold, cusum, and separate
CLI commands with a pre-flight error if sample rate is still absent
- Normalize namespaced metadata keys (e.g. BlockGenerator:Foo:sample_rate)
to standard keys on legacy .npy load
- Cap threshold_qualifier smoothing window at 1% of signal length to
prevent over-smoothing short recordings into a flat envelope
- Warn when threshold or energy detector returns 0 annotations due to
constant-envelope signal; point to cusum as the right tool
- Enforce --overwrite before any work begins; error fires before load
and detection, not after
- Fix qualify_slice off-by-one that silently dropped the last slice
- Surface split failures in parallel_signal_separator via warnings.warn
instead of swallowing them silently
- Add threshold annotation example image to getting_started docs
Remote annotationsfix had a partial port of threshold_qualifier without
the Pass 2 hysteresis spillover fix. Kept our corrected version in both
conflicting sections:
- Pass 2 mask expanded by window_size guard band around Pass 1 ranges
- Pass 2 expansion runs against residual_power instead of smoothed_power
The OSS threshold_qualifier was last synced from utils on Feb 23 2026,
before the major robustness improvements landed in utils on Mar 19 2026.
This commit brings it fully up to date.
Changes ported from utils:
- Multi-pass detection (Pass 1 strong burst, Pass 2 weak residual,
Pass 3 sustained faint burst via macro-window averaging)
- Noise floor estimation via percentile instead of simple max*threshold
- Dynamic range ratio guard (early exit on low-contrast captures)
- Improved _find_ranges, _expand_and_filter_ranges, _merge_ranges helpers
- Spectral smoothing in _estimate_spectral_bounds for wideband bursts
- Minimum duration filter expressed in absolute time (5ms) not sample count
Also includes the Pass 2 hysteresis spillover fix:
- Pass 2 expansion now runs against residual_power (masked) instead of
smoothed_power, preventing it from walking into Pass 1 territory
- Pass 2 mask now has a window_size guard band around Pass 1 ranges,
matching the guard already used in Pass 3
Only change from utils: import swapped to ria_toolkit_oss.datatypes.
Resolves unresolved merge conflict markers left in committed files across
the annotations, view, data, and CLI packages. Updates all remaining
imports from the old utils.* namespace to ria_toolkit_oss.datatypes,
ria_toolkit_oss.io, and ria_toolkit_oss.view equivalents.
Annotations package (new):
- Add threshold_qualifier with 3-pass hysteresis detector (Pass 1: strong
bursts, Pass 2: weak residual bursts, Pass 3: macro-window faint burst
detection), auto window_size scaled to 1ms, channel selection, and
stable noise_floor baseline throughout
- Add energy_detector, cusum_annotator, parallel_signal_separator,
qualify_slice, signal_isolation, annotation_transforms
- Add __init__.py exporting the four functions used by the CLI
- Fix all imports from utils.data → ria_toolkit_oss.datatypes
CLI annotate command (new):
- Port full annotate CLI from utils including list, add, remove, clear,
energy, cusum, threshold, and separate subcommands
- Fix imports from utils.* → ria_toolkit_oss.* and utils_cli.* →
ria_toolkit_oss_cli.*
- Safe overwrite logic: _annotated files always writable, originals
protected; --overwrite writes in-place only on _annotated inputs
CLI view command:
- Add 'annotations' as a valid --type, wiring view_annotations from
view_signal
view_signal.py:
- Add view_annotations function with blue/purple alternating palette and
threshold %-sorted drawing order (lower % renders on top)
recording.py (datatypes):
- Fix lazy imports in to_wav() and to_blue() from utils.io → ria_toolkit_oss.io
io/recording.py:
- Add compatibility shim in from_npy to remap utils.data.annotation.Annotation
to ria_toolkit_oss.datatypes.annotation.Annotation when loading .npy files
pickled by the utils package