envipat.vdetect¶
Valley detection and centroidization.
Port of R’s vdetect. Calls envipat._core.enviPat_py.centroid (the
Python binding of the original iso_core.c algorithm) on each envelope
profile from
envipat.envelope.envelope().
Result shape¶
Returns dict[str, pandas.DataFrame | str] keyed like the input
profiles dict, each DataFrame with two columns "m/z" and
"abundance". As in envipat.envelope.envelope(), an empty/erroring
detection result is reported as the literal string "error",
covering both a raised EnviPatCoreError and a legitimate zero-length
result.
Verified against the golden fixtures at rtol=1e-12 (not exact), for
the same reason as envelope: the profiles this operates on were
themselves built from a seq()-based mass trace whose floating-point
values only approximately match R’s (see envipat._rseq).
- envipat.vdetect.vdetect(profiles, detect='centroid', verbose=True)[source]¶
Detect centroids, intensoids or valleys in envelope profile(s).
Port of R’s
vdetect.- Parameters:
- profiles
Mapping of formula -> envelope-profile DataFrame, as returned by
envipat.envelope.envelope()(columns"m/z","abundance").- detect
"centroid"(default),"intensoid"or"valley"– see R’s?vdetect“Definitions” section for the precise meaning of each.- verbose
If True, prints
" done."on completion (matching R’smessage(paste0("Detect ", detect, "s... "))/message(" done.")– the first, detect-specific message is not reproduced here, only the completion one, matching this module’s siblings).
- Returns:
- dict[str, pandas.DataFrame | str]
Keyed like
profiles; see module docstring for the"error"sentinel.
Notes
R’s
plotitargument is intentionally not ported – no plotting side effect, matchingenvipat.isopattern.isopattern().