feat(frames): system-agnostic frame-transformation layer + TransmonSystem.lab_frame carrier fix - #257
Open
aarontrowbridge wants to merge 9 commits into
Open
aarontrowbridge wants to merge 9 commits into
aarontrowbridge wants to merge 9 commits into
Conversation
…site auto-derivation)
… (Guarantees 3–4)
…ned convention - _frames.jl: module docstring + rotating→lab usage example - frame_transforms.jl: docstring φ=atan2(-u_y,u_x) matches the test-pinned convention; note the rwa=false branch is completeness-only (not round-trip guarded) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a public
Framessubmodule (src/quantum/frames/): a system-agnosticframe-transformation layer that converts a rotating-frame
QuantumSysteminto thephysically correct lab frame (carrier-modulated, time-dependent) and back under
the RWA. Also fixes the incomplete
TransmonSystem.lab_frame, whose drives werestatic rotating-frame quadratures with no carrier.
Motivation: the calibration ablative study v2 (transmon arm) needs a real device
that evolves in the lab frame under a fast carrier with counter-rotating terms and
|2⟩ leakage — the transmon analogue of the atoms finite-blockade out-of-model error.
What's here
RotatingFrame(ωs)/LabFrame()— frame descriptors (H_f = Σ ωᵢ nᵢ).FrameSpec(number_ops, drive_map, drive_ops)— the subsystem/drive metadata thetransforms read (operators are input data, never guessed); auto-derivable from
a
CompositeQuantumSystemor a matrix-driveQuantumSystem.to_lab_frame(sys_rot, frame, spec)— adds the frame generator back into the driftand reconstructs each quadrature pair
(u_x, u_y)asΩ cos(ω_d t + φ)(a+a†),Ω=√(u_x²+u_y²),φ=atan2(−u_y, u_x). Returns atime_dependent=truefunctionsystem rolled via the
RolloutsODE path (KetTrajectory/UnitaryTrajectoryMagnusAdapt4()) — notSplineIntegrator(which rejects function-basedHand has interval-localt).to_rotating_frame(sys_lab, frame, spec; rwa=true)— the RWA inverse.TransmonSystem(lab_frame=true)now routes through the layer → a correctcarrier-modulated, time-dependent system.
Guarantees (tests) — verified locally: frames 64/64 green
to_rotating_frame(to_lab_frame(s)) ≈ s(RWA) to < 1e-8.(monotone, < 1e-3 at large ω_d), driving both quadratures so the carrier
physics (φ, y-sign, field factor) is actually pinned.
TransmonSystem(lab_frame=true)applies acarrier-modulated drive (guards against reverting to static quadratures).
CompositeQuantumSystem,distinct per-subsystem ω_d) with the same invariants.
Verification (main env,
--startup-file=no):run_tests(filter="frame")→ 64 pass / 0 fail.except 3
pulse_plots.jltests that error onCairoMakie not found(a test-env-only dep; they error identically on
mainand are unrelated to this change).Reviewer-critical deviations / decisions
QuantumSystemstores no
H_drives, soFrameSpeccarriesdrive_opsand both transformsread operators from the spec — never from a system's drive list. This is what makes
the round-trip a clean structural inverse.
tests, not derived in prose. The converged convention is
φ = atan2(−u_y, u_x)with
field = 2·(½-quadrature op); a lone:realdrive is modulated directly (no2×). The
rwa=falseinverse branch is completeness-only (not round-trip-guarded).(not just a threshold), and drives both quadratures — otherwise the round-trip
(a structural inverse) would not exercise the carrier math.
FrameSpec(comp)auto-derivation skips coupling drives (no single-subsystemcarrier) and reads per-subsystem quadrature operators from
comp.H_drives.Notes
consumer follows after this API is reviewed).
🤖 Generated with Claude Code