Skip to content

fix: annotated-frame notebook corrections (Codex review)#438

Merged
theGreatHerrLebert merged 1 commit into
mainfrom
fix/annotated-nb-codex-review
Jul 2, 2026
Merged

fix: annotated-frame notebook corrections (Codex review)#438
theGreatHerrLebert merged 1 commit into
mainfrom
fix/annotated-nb-codex-review

Conversation

@theGreatHerrLebert

Copy link
Copy Markdown
Owner

Corrections to the onboarding notebook (#436/#437) from an independent Codex review, grounded against the imspy_simulation source + the Rust to_dense_windows_with_labels implementation.

Material fix

  • .df noise label is -1, not -2. peptide_ids_first_only (and the charge/isotope variants) return -1 when the dominant contributor has no signal attributes — including random noise (imspy_connector/src/py_annotation.rs:168). -2 is only assigned in the dense-window label planes for SourceType::RandomNoise (mscore/src/simulation/annotation.rs:936). Section 3's label table + peak-composition count are corrected; verified empirically on a noisy dataset (.df shows no -2).

Robustness / precision

  • Guard the fragment section against a missing fragment_ions table (the COUNT(*) would raise on precursor-only runs, not just return 0).
  • Sparsity stat now counts unique populated (scan, m/z) cells rather than peaks (peaks can share a cell), so occupancy isn't overstated.
  • m/z–RT map: clarified the per-cell label is the single highest-intensity peak, not the largest-summed-intensity peptide after mobility collapse.
  • Shuffle before the train/val split (tiles are RT-ordered).

Codex confirmed the rest is correct: grid_peaks accumulation + dominant-label logic, the dense-window reconstruction formula vs the Rust start-index/n_cols, the N/Y + overlap-duplicates explanation, the fragment API usage, and the PyTorch shapes.

Re-executed end-to-end against a real DIA synthetic_data.db: 20 cells, 0 errors, 5 plots.

🤖 Generated with Claude Code

- .df noise label is -1, not -2: the *_first_only accessors return -1 when the
  dominant contributor has no signal attributes (incl. random noise). The
  -2 = noise convention only exists in the dense-window label planes. Fix the
  Section 3 label table + the (previously always-zero-or-wrong) noise count.
- Guard the fragment section against a missing fragment_ions table (COUNT would
  otherwise raise on precursor-only datasets), not just an empty one.
- Sparsity: count unique populated (scan, m/z) cells instead of peaks
  (multiple peaks can share a cell), so occupancy isn't overstated.
- m/z-RT map: clarify the per-cell label is the single highest-intensity peak,
  not the peptide with the largest summed intensity after the mobility collapse.
- Shuffle before the train/val split (tiles are RT-ordered).

Re-executed end-to-end: 20 cells, 0 errors, 5 plots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@theGreatHerrLebert theGreatHerrLebert merged commit ccb1e07 into main Jul 2, 2026
2 checks passed
@theGreatHerrLebert theGreatHerrLebert deleted the fix/annotated-nb-codex-review branch July 2, 2026 10:01
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