Skip to content

feat(python): expose raw profile spectra via RawFile.profile()#1

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

feat(python): expose raw profile spectra via RawFile.profile()#1
oskarsari wants to merge 1 commit into
Sigilweaver:mainfrom
karsa-oy:pr/python-profile

Conversation

@oskarsari

Copy link
Copy Markdown

What

Adds RawFile.profile(scan_number) -> (mz: float64[:], intensity: float64[:]) to the Python bindings. The frequency-domain profile bins are converted to m/z via the scan event's calibration coefficients; centroid-only scans return empty arrays.

Why

The Rust core already decodes profile data (ScanDataPacket.profile, Profile::to_mz_intensity), but the Python RawFile exposed centroids only (peaks() / scan()). This surfaces the raw profile to Python without dropping to Rust or round-tripping through mzML.

How

Thin wrapper mirroring peaks(): locks the shared source, calls reader.read_scan(...), and Profile::to_mz_intensity with the scan event's coefficients.

Testing

cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings, and cargo test pass. Spot-checked on a Q Exactive file: the non-zero profile (point count and intensities) matches an independent reference reader.

Happy to file a tracking issue first if you prefer issue-before-PR for new API; it's a small additive wrapper.

Checklist

  • CHANGELOG updated ([Unreleased])
  • fmt / clippy / tests pass
  • ASCII only

The Rust core already decodes profile data (ScanDataPacket.profile,
Profile::to_mz_intensity) but the Python bindings surfaced centroids only.
Add RawFile.profile(scan_number) -> (mz, intensity) NumPy arrays, converting
the frequency-domain bins with the scan event's calibration coefficients;
returns empty arrays for centroid-only scans.
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