Skip to content

feat(python): expose per-scan trailer parameters via RawFile.scan_parameters()#5

Open
oskarsari wants to merge 1 commit into
Sigilweaver:mainfrom
karsa-oy:pr/python-scan-params
Open

feat(python): expose per-scan trailer parameters via RawFile.scan_parameters()#5
oskarsari wants to merge 1 commit into
Sigilweaver:mainfrom
karsa-oy:pr/python-scan-params

Conversation

@oskarsari

@oskarsari oskarsari commented Jun 16, 2026

Copy link
Copy Markdown

What

Adds RawFile.scan_parameters(scan_number) -> dict | None to the Python bindings, returning the per-scan "trailer" parameters as a {label: value} dict (or None when the scan has no record).

Why

The core already decodes the per-scan trailer: RawFileReader::scan_parameters returns a GenericRecord with get / get_f64 / get_string. The Python bindings, however, only surfaced a small typed subset on the scan() 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 a PyDict, converting each GenericValue to the matching Python type (str / int / float / bool; None for Gap). No new format work, just surfacing data the core already decodes similar to #1

Testing

cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test --all pass. Built with maturin develop and verified the returned labels/values match the vendor reader on real Orbitrap files (e.g. scan_parameters(n)["HCD Energy V:"] agrees exactly).

Checklist

  • CHANGELOG [Unreleased] updated
  • cargo fmt / cargo clippy -D warnings / cargo test --all pass
  • ASCII-only source

…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.
@oskarsari oskarsari changed the title feat(python): expose per-scan trailer parameters via RawFile.scan_parameters() feat(python): expose per-scan trailer parameters via RawFile.scan_parameters() Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant