Expand description
Instrument-dispatch P2: the projector.
Turns the vendor-neutral trunk (scalar PeptideScalar / IonScalar
physics) into device-sampled signal, parameterised by the instrument’s
sampling geometry and an absolute event timeline derived from the
AcquisitionScheme. This replaces the two device-projection jobs that the
legacy pipeline baked into the DB (frame_occurrence/abundance and
scan_occurrence/abundance) with a render-time computation:
- time projection (all instruments): the EMG RT profile integrated over
each event’s true
[start, end]interval —mscore’sproject_emg_over_events(the corrected, non-fixed-cycle kernel). - mobility projection (IMS only): the ion mobility Gaussian sampled onto
the scan grid via the existing gaussian kernels; for a non-IMS instrument
(
MobilityModality::None) the distribution is marginalised onto a single scan, conserving total signal.
P2 builds and verifies these projections in isolation. Wiring assemble_frames
onto them (with a DB fallback) and the byte-parity proof are P3.
Structs§
- Event
Slot - One concrete acquisition event placed on the absolute run timeline, with its
[start_s, end_s]exposure interval (the input to the time projection). - Event
Timeline - The full run as an ordered list of
EventSlots. - Instrument
Config - The vendor-specific configuration the render core dispatches on (P6c). Bundles the three orthogonal axes that decide how a vendor-neutral trunk is recorded:
- Projection
Params - Parameters the projector needs to reproduce / improve the legacy distribution
jobs. Defaults mirror the simulator’s config defaults (
target_p=0.999,sampling_step_size=0.001, scan step0.0001,n_steps=1000,remove_epsilon=1e-4). - Rendered
Spectrum - A spectrum tagged with where it sits in the coordinate/intensity pipeline, so writers and the detector model never double-apply a transform.
- Sampling
Geometry - The instrument’s mobility sampling geometry. For
Tims,inv_mobilityholds the per-scan 1/K0 grid in ascending order (the order the gaussian occurrence kernel expects internally).project_mobility_ionreturns scan indices as positions into this ascending vector; callers that need native (descending) Bruker scan numbers map at the device boundary.
Enums§
- Distribution
Source - Where the per-analyte occurrence/abundance distributions come from when constructing the builder entities (P4 canonical-state contract).
- Intensity
Stage - Point on the intensity-conservation chain (mirrors the Python
dispatch.IntensityStage; see plan §3.5). - Mobility
Modality - Ion-mobility separation modality. Only the cases the engine handles today are
listed;
DriftTube/Faimsare reserved for later instruments. - MzCoord
Space - Which coordinate space a rendered spectrum’s m/z values are in.
- Projection
Mode - Which projection math to use.
- Rendered
Event - One acquisition event’s rendered signal.
Scanfor non-IMS instruments;MobilityFramefor IMS (preserving per-scan simultaneity rather than flattening + rebundling).
Functions§
- project_
mobility_ accurate_ par - Batched + parallel Accurate mobility projection over many ions sharing one
ascending mobility grid.
means/sigmasare per-ion 1/K0 mean+std. Returns one(ascending_scan_index, abundance)list per ion. - project_
mobility_ gaussian - Accurate mobility projection core: a Gaussian (
mean,sigma) in 1/K0 onto an ascending mobility grid, returning(ascending_scan_index, abundance)where each occupied scan’s abundance is the CDF over that scan’s own midpoint-bounded bin (correct on non-uniform grids). σ ≤ 0 is a point mass at the nearest scan; empty/singleton grids are handled. - project_
mobility_ ion - Mobility projection for a single ion:
(scan_index, abundance)over the geometry’s scan grid, scan indices being positions into the ascendinggeometry.inv_mobility(per theSamplingGeometrycontract). - project_
mobility_ ion_ legacy - LegacyCompat mobility projection for one ion: reproduce
scan_occurrence/scan_abundanceexactly assimulate_scan_distributions_with_variancedid —calculate_scan_occurrence_ gaussianwithn_lower/upper = 5, andcalculate_abundance_gaussianover the fixedim_cycle_lengthbin.mean/sigmaare the original stored 1/K0 mean + std at f64 (NOT a CCS round-trip).scan_mobilitiesmust be ascending withscan_idsaligned (exactly as the legacy job feedsscanssorted soim_cycle_length > 0); a descending grid makes the occurrence kernel return nothing. The occurrence kernel’s indices are the values the legacy job stored directly, so they are returned as-is. Returns(scan, abundance). - project_
mobility_ legacy_ par - Batched + parallel LegacyCompat scan projection over many ions (the kernels
the legacy job used).
means/sigmasare the original per-ion 1/K0 mean+std;scan_ids/scan_mobilitiesascending+aligned (shared by all ions). Returns one(scan, abundance)list per ion. Requires positive sigmas (real data); useproject_mobility_ion_legacyfor the point-mass-guarded single- ion path. - project_
time - Time projection: for each peptide, the
(global_event_index, abundance)list over every acquisition event in the run (MS1 and MS2 alike), integrating the EMG over each event’s true[start, end]exposure interval. The index is the position intimeline.events(i.e.EventSlot::global_index), so MS2 events receive their own RT abundance rather than reusing the MS1 value — this matches the legacyframe_occurrence/frame_abundance, which span all frames. - project_
time_ legacy - LegacyCompat time projection: reproduce
frame_occurrence/frame_abundanceover the full frames table, exactly assimulate_frame_distributions_emgdid. Inputs are taken at f64 (the precision the legacy pipeline used) — NOT the f32 trunk entities — so the result is bit-faithful:rt_mus,rt_sigmas,rt_lambdasare per-peptide EMG params (rt_mu, not the GRU apex);frame_ids/frame_timesare the whole frames table ascending by id. Occurrence positions (1-indexed intoframe_times) are translated to frame ids viaframe_ids[pos-1]; theremove_epsilonfilter drops frames whose abundance is<= remove_epsilon(matching the legacy job). Returns(frame_id, abundance)per peptide.