feat(python): expose per-scan trailer parameters via RawFile.scan_parameters()#5
Open
oskarsari wants to merge 1 commit into
Open
feat(python): expose per-scan trailer parameters via RawFile.scan_parameters()#5oskarsari wants to merge 1 commit into
RawFile.scan_parameters()#5oskarsari wants to merge 1 commit into
Conversation
…ameters()
Add RawFile.scan_parameters(scan_number) -> dict | None, returning the per-scan
generic ("trailer") parameters as a {label: value} dict. Keys are the
instrument's own labels (e.g. "HCD Energy V:", "MS2 Isolation Width:") and
values keep their stored type (str / int / float / bool). The Rust core already
decodes these (RawFileReader::scan_parameters / GenericRecord); the bindings
previously surfaced only the typed subset on the scan() dict (e.g. the nominal
collision energy), so the calibrated trailer fields were unreachable from Python.
RawFile.scan_parameters()
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.
What
Adds
RawFile.scan_parameters(scan_number) -> dict | Noneto the Python bindings, returning the per-scan "trailer" parameters as a{label: value}dict (orNonewhen the scan has no record).Why
The core already decodes the per-scan trailer:
RawFileReader::scan_parametersreturns aGenericRecordwithget/get_f64/get_string. The Python bindings, however, only surfaced a small typed subset on thescan()dict (e.g. the nominal collision energy), so the instrument's own trailer fields (e.g. the calibrated"HCD Energy V:"and"MS2 Isolation Width:") were unreachable from Python. This exposes them, mirroring the vendor reader's trailer-extra information.How
Thin wrapper over
reader.scan_parameters(scan_number): iterate the record's(label, value)pairs into aPyDict, converting eachGenericValueto the matching Python type (str / int / float / bool;NoneforGap). No new format work, just surfacing data the core already decodes similar to #1Testing
cargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo test --allpass. Built withmaturin developand verified the returned labels/values match the vendor reader on real Orbitrap files (e.g.scan_parameters(n)["HCD Energy V:"]agrees exactly).Checklist
[Unreleased]updatedcargo fmt/cargo clippy -D warnings/cargo test --allpass