envipat.isowrap

Combined (batch) calculation of isotope pattern, envelope and centroids.

Port of R’s isowrap. Composes envipat.isopattern.isopattern(), envipat.envelope.envelope() and envipat.vdetect.vdetect().

resolution is explicit

R’s isowrap takes a calibration table (resmass) plus nknots/ spar, and calls getR internally to interpolate a per-formula resolution from it whenever resmass is given (resolution=FALSE means “use getR”; a numeric resolution bypasses it). This port’s isowrap drops resmass/nknots/spar entirely and only accepts resolution directly (a single value or a per-formula sequence, passed straight through to envipat.envelope.envelope()) – callers wanting curve-based interpolation call envipat.resolution.get_resolution() themselves and pass its result in as resolution.

Result shape

Returns whatever envipat.vdetect.vdetect() returns: a dict[str, pandas.DataFrame | str] keyed by formula.

envipat.isowrap.isowrap(isotopes, checked, resolution, threshold=0.1, charge=1, emass=0.00054857990924, algo=2, ppm=False, dmz='get', frac=0.25, env='Gaussian', detect='centroid', verbose=True)[source]

Run the full isopattern -> envelope -> vdetect pipeline.

Port of R’s isowrap; see module docstring for why resolution is explicit here rather than interpolated from a calibration table (resmass/nknots/spar in R – not ported).

Parameters:
isotopes

Isotope reference table, e.g. envipat.data.isotopes. Passed straight through to envipat.isopattern.isopattern().

checked

Output of check_chemform (envipat.formula.check_chemform): a DataFrame with (by position) a warning column and a new_formula column. Every row must have warning falsy, matching R’s if(any(checked[, 1])) stop(...).

resolution

A single resolution value, or a sequence with one value per row of checked – see module docstring.

threshold, charge, emass, algo

Passed through to envipat.isopattern.isopattern().

ppm, dmz, frac, env

Passed through to envipat.envelope.envelope().

detect

Passed through to envipat.vdetect.vdetect().

verbose

Passed through to all three composed functions.

Returns:
dict[str, pandas.DataFrame | str]

See envipat.vdetect.vdetect()’s return value.

Raises:
ValueError

If any row of checked has a truthy warning (an invalid chemical formula).