QUBIC · End-to-end work

Separating the pipeline from sky to map

What the two agents built, what the comparison established, and what is still needed for a stronger scientific pipeline.

11-slide technical briefing

Based on objective.txt, whatAgent1did.txt, and whatAgent2did.txt.

01 · Objective

Turn one fragile demonstration into two reusable stages

The starting point was a monolithic QUBIC example: simulate a sky, generate detector timelines, and reconstruct a map in one notebook.

InputSky model, dictionary, instrument and scan
→
Stage 1Sky simulation → TES time-ordered data
→
Stage 2TES TOD → reconstructed sky map
→
OutputMaps, coverage, diagnostics and provenance
The split matters because stage 2 can consume saved or real TOD without rerunning the sky simulation.
02 · Starting point

The supplied notebooks mixed three concerns

1

Sky generation

Build a dictionary and simulate a CMB sky at the selected frequency and resolution.

2

Instrument response

Construct pointing and acquisition operators, then produce a TOD for every detector.

3

Map making

Apply the acquisition operator and solve the inverse problem with coverage and PCG.

The original notebook was written against an older flat qubic API and failed at import time in the installed environment.

03 · Agent 1

Agent 1 established the first workable separation

API migration

Created a corrected monolithic notebook using the refactored qubic.lib modules and a demo-scale configuration.

Stage boundary

Kept the split at the dictionary, TOD, convolved maps and map center, so stage 2 can reload simulation products.

Real-data path

Added a TOD-to-map example and a command-line script for a QUBIC galactic-plane dataset.

First diagnosis

Compared monolithic and split maps, saved residual figures, and documented telemetry assumptions.

04 · Agent 1 findings

The first version showed that the architecture worked, but exposed uncertainty

FindingMeaning for the pipeline
Monolithic and split maps were very closeThe proposed stage boundary did not change the simulated result at demo resolution.
Original FI150 settings were unavailable as writtenSoftware API and calibration-file assumptions had to be separated from the algorithmic comparison.
Real data required sparse housekeeping interpolationStage 2 needs explicit time axes, detector ordering and telemetry handling.
Initial real solve was not convergedA visually plausible scan footprint is not evidence of a valid sky reconstruction.
05 · Agent 2

Agent 2 made the comparison controlled and reproducible

Fair simulation pairs

Regenerated the same sky and TOD, saved explicit pointing, and compared matched FI220, FI150 and TD150 runs.

Correct noise control

Used the acquisition noise seed where QUBIC resets the random generator, instead of seeding NumPy beforehand.

Real-data corrections

Converted qubicpack current values from microamps to amperes locally before forming electrical power; installed packages stayed untouched.

Robust stage 2

Added detector-order checks, support clipping, azimuth unwrapping, block averaging, offset projection and true normal-equation residual checks.

06 · Evidence

The split can reproduce the monolithic map exactly in controlled runs

FI220nside 64 · 992 detectors
PCG residual 9.86 × 10⁻⁵
FI150nside 64 · 992 detectors
PCG residual 9.76 × 10⁻⁵
TD150nside 32 · 248 detectors
PCG residual 9.21 × 10⁻⁵

Within each matched pair, the saved-TOD split and monolithic reconstruction were bit-for-bit equal. This validates the data handoff and execution order, not the completeness of the physical model.

07 · What remains lacking

Agent 2 delivered a strong diagnostic pipeline, not a finished science pipeline

08 · Where the separation can improve

The handoff is useful, but still couples data format, instrument assumptions and solver behavior

Current handoffdictionary.json
pointing.npz
TOD.npy
maps_convolved.npy
→
Hidden dependenciesDetector ordering
frequency and beam files
HWP/pitch conventions
noise model and units
→
RiskA file can be readable while its units, calibration or operator assumptions are wrong.

A better interface must carry numerical arrays together with the assumptions that make them meaningful.

09 · Possible improvements

A practical roadmap for the next iteration

  1. Define a versioned stage contract. Store schema version, units, frequency, nside, detector IDs, pointing convention, calibration provenance and hashes beside every array.
  2. Make stage 2 source-agnostic. Accept simulated TOD, qubicpack TOD and synthetic fixtures through one validated adapter interface.
  3. Preserve native time resolution where possible. Stream or chunk the pointing operator instead of relying on a large dense in-memory representation.
  4. Add instrument realism. Integrate HWP and pitch telemetry, detector gains, current offsets, optical calibration, glitches and a colored-noise model.
  5. Test scientific adequacy separately from solver convergence. Use injected skies, recovered amplitudes, cross-validation and TOD residual structure.
10 · Recommended next design

Keep the split, strengthen the contract

Stage 0 · Ingest and calibrate

Read raw files, convert units, identify detectors, align telemetry, flag gaps and write a provenance-rich observation package.

Stage 1 · Forward model

Generate or load a sky, construct the exact pointing and beam model, and write TOD plus a reproducible model manifest.

Stage 2 · Inverse map

Read the manifest, validate compatibility, solve I/Q/U with the appropriate noise and nuisance model, and report convergence.

Stage 3 · Validation

Compare injected truth, split versus monolithic execution, held-out TOD residuals and calibration-aware physical metrics.

The deliverables in Final_pipeline/ are a solid diagnostic baseline. The next scientific milestone is to make every assumption explicit and test whether the reconstructed map explains independent detector data.

Useful references: executed example notebook · real-data CLI · Agent 2 results · original objective