Skip to content

docs+feat: decode LC Raw Data/Chromatogram Ch6, characterize Ch5's untestable grammar (#21)#22

Merged
Nathan-D-R merged 1 commit into
Sigilweaver:mainfrom
Nabejo:lc-chromatogram-ch5-ch6-decode
Jul 21, 2026
Merged

docs+feat: decode LC Raw Data/Chromatogram Ch6, characterize Ch5's untestable grammar (#21)#22
Nathan-D-R merged 1 commit into
Sigilweaver:mainfrom
Nabejo:lc-chromatogram-ch5-ch6-decode

Conversation

@Nabejo

@Nabejo Nabejo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #21 (decode the LC Raw Data/Chromatogram Ch5/Ch6 stream found while investigating #2) - Ch6 is decoded and wired into the reader; Ch5 is a confirmed, evidence-backed partial characterization, deliberately left undecoded.

Confirmed, byte-exact (all 5 locally available PXD020792/*.LCD files, both channels, 290 pages total, zero exceptions):

  • The outer RC\x00\x00 segment (one giant segment per channel, as issue Decode LC Raw Data/Chromatogram Ch5 / Ch6 stream (found while investigating #2) #21 already noted) has internal sub-segment structure that hadn't been characterized yet: the body is a back-to-back sequence of "pages", each a u16 LE byte-length prefix, that many data bytes, then a matching u16 LE suffix - the same "symmetric" length-wrapper style already documented for PDA segments, just applied per-page.
  • Within a page: a byte < 0x20 is a signed 5-bit literal delta, a byte >= 0x20 starts a 2-byte signed-13-bit wide delta. This (threshold=0x20, width=2) rule is the unique zero-exception result of an exhaustive (threshold, width) sweep.

Corroborated, not byte-exact-proven: cumulative-summing the decoded deltas produces a smooth, physically plausible chromatogram (baseline, broad rise, stable plateau) for Ch6 in every file, clearly outperforming every alternative layout tried.

Ch5 - deliberately left undecoded: it shares the identical verified framing, but every sample in every available file is the same repeated token, which makes the delta-vs-absolute-value convention untestable from this corpus. Per this project's clean-room honesty policy, the reader skips emitting any channel with fewer than 2 distinct decoded values rather than guess and risk shipping a fabricated unbounded ramp.

Rust implementation: new crates/openszraw::raw::lc_chrom module, wired into Reader's SpectrumSource::iter_chromatograms (probing all 6 conventional LC Raw Data/Chromatogram ChN names generically, not hardcoded to Ch5/Ch6). Records use PSI-MS MS:1000811 "electromagnetic radiation chromatogram". Mirrors the iter_chromatograms wiring pattern from the sibling OpenWRaw#9.

Full derivation and evidence in docs/format/04-lcd-chromatogram-pda.md's "2026-07-21 session" section and docs/format/06-known-limitations.md #11.

Contributed by @Nabejo.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace (35 unit tests incl. 10 new for lc_chrom, plus 2 new corpus-conformance tests verifying Ch6 decodes to a plausible trace and Ch5 is correctly skipped)

Ch5/Ch6 share the same RC\x00\x00 segment header as the still-unsolved
PDA payload, but the single giant per-channel segment turns out to have
its own internal "page" framing (u16 length-prefixed/suffixed blocks of
up to 256 samples) and a clean, exhaustively-verified literal/wide-token
tokenization split. Cumulative-summing the decoded deltas produces a
smooth, physically plausible chromatogram in every one of the 5 locally
available PXD020792 files for Ch6.

Ch5 shares the identical framing but is a single repeated value for its
entire run in every available file, which makes its numeric grammar
(delta vs. absolute-value convention) untestable from this corpus -
crates/openszraw::raw::lc_chrom deliberately skips emitting it rather
than guess, per the project's clean-room honesty policy.

Wires Ch6 into Reader::iter_chromatograms via openmassspec-core's
SpectrumSource trait, tagged with PSI-MS MS:1000811 "electromagnetic
radiation chromatogram".

Partially resolves Sigilweaver#21.

Claude-Session: https://claude.ai/code/session_01ETdxFx6Mb8XcZqctf1AHtF
@Nathan-D-R
Nathan-D-R force-pushed the lc-chromatogram-ch5-ch6-decode branch from cffbd6e to 7860be0 Compare July 21, 2026 00:58
@Nathan-D-R
Nathan-D-R merged commit 425aad2 into Sigilweaver:main Jul 21, 2026
4 checks passed
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.

2 participants