LookupIndexConverter: derive m/z calibration from the SDK, not a 2-point fit#396
Merged
Merged
Conversation
…int fit The with_calibration path built its LookupIndexConverter with a 2-point boundary m/z model (sqrt(mz) anchored only at the m/z acquisition-range extremes). On some datasets that is off by several Da, silently corrupting m/z-sensitive extraction such as isotope-envelope intensities. When a Bruker SDK path is supplied, m/z is now calibrated with the same regression fit (derive_mz_calibration) the Calibrated converter already uses; the 2-point boundary model stays as the fallback when no SDK is available. with_calibration / new_with_calibration gain an optional bruker_lib_path argument (default "NO_SDK"), so existing callers are unaffected.
Owner
Author
Empirical confirmation — fix verified ✅Rebuilt Took 12 precursors whose stored isotope envelope was all-zero
With the fix every previously-broken precursor recovers a clean, decaying
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
with_calibration(the fast parallel-extraction path) builds itsLookupIndexConverterwith a 2-point boundary m/z model:sqrt(mz)isanchored only at the m/z acquisition-range extremes (
mz_min/mz_maxovertof_max_index). On datasets where the true TOF↔m/z relationship deviates fromthat 2-point line, the error is large — measured at a ~4.6 Da median (up to
6.2 Da) on one timsTOF dataset, versus 0.0001 Da for the regression-fit
Calibratedconverter on the same file.A multi-Da m/z error silently corrupts m/z-sensitive extraction. In our case
isotope-envelope intensities came back all-zero (
isotope_cosim = 0) whiletotal_intensitystayed healthy — the extraction was integrating unrelatedpeaks several Da away from the real isotopes.
Fix
When a Bruker SDK path is available,
LookupIndexConverternow calibrates m/zwith the same regression fit (
derive_mz_calibration) that theCalibratedconverter already uses, via a new
LookupIndexConverter::with_mz_fit. The2-point boundary model stays as the fallback when no SDK is available (macOS,
or
bruker_lib_path="NO_SDK"). The ion-mobility calibration (theprecomputed scan→1/K0 lookup) is unchanged.
with_calibration/new_with_calibrationgain an optionalbruker_lib_pathargument (default"NO_SDK"), so existing callers areunaffected; passing a real SDK path opts into the accurate m/z.
Compatibility
with_calibration(...)calls keep working (boundaryfallback); the 4th
bruker_lib_pathargument is optional.Calibrated/BrukerLib/Simpleconverters.Validation
cargo checkpasses forrustdf+imspy-connector. Empirical end-to-endconfirmation — re-extracting the affected dataset and verifying
isotope_cosimrecovers — is in progress; please hold the merge until that result is posted
here.