Skip to content

feat: Added interactive analog quantum simulation program builder#5

Open
CodeMaverick2 wants to merge 2 commits intoOpenQuantumDesign:mainfrom
CodeMaverick2:feat/analog-program-builder
Open

feat: Added interactive analog quantum simulation program builder#5
CodeMaverick2 wants to merge 2 commits intoOpenQuantumDesign:mainfrom
CodeMaverick2:feat/analog-program-builder

Conversation

@CodeMaverick2
Copy link

@CodeMaverick2 CodeMaverick2 commented Feb 15, 2026

Summary

  • Replaced the static 2-button analog dialog with an interactive builder for constructing analog quantum simulation programs
  • Users can now add/remove evolution steps and Hamiltonian terms, select Pauli operators (I/X/Y/Z), target ions, set coefficients, and choose time-dependent
    amplitude envelopes (constant, linear, sinusoidal, math expression)
  • "Show IR JSON" exports a valid AnalogCircuit object using oqd-core types (AnalogCircuit, AnalogGate, PauliX/Y/Z/I, OperatorKron,
    OperatorScalarMul, MathNum, MathVar, MathFunc, MathStr) with built-in JSON serialization
  • "Run Program" compiles the spec to laser intensity waveforms and executes on the device
  • Includes 2 presets: Rabi Flopping, Ising Model

Changes from feedback

  • Rewrote ir_builder.py to use actual oqd-core analog interface types instead of manually constructed dicts
  • Expression envelopes now properly parsed via MathStr into oqd-core's MathExpr AST
  • Added oqd-core as a dependency in pyproject.toml
  • Removed All-to-All preset (requires multi-qubit operations not yet supported)

Updated Demo -

Screen.Recording.2026-02-21.042819.2.mp4

Files

  • analog.py - builder state models (AmplitudeEnvelope, HamiltonianTerm, EvolveStep, AnalogProgramSpec)
  • ir_builder.py - converts spec → AnalogCircuit using oqd-core types
  • analog_compiler.py - converts spec → Program laser waveforms
  • gui/analog_builder.py - NiceGUI builder dialog
  • gui/programs.py - added preset functions
  • gui/main.py - wired up the new builder

Test plan

  • pip install -e . and run python src/oqd_teaching_demo/gui/main.py
  • Click Analog Interface → builder opens
  • Add/edit/remove terms and steps
  • Load each preset → UI populates correctly
  • Show IR JSON → valid AnalogCircuit output
  • Run Program → laser intensities print in console
  • Stop → execution halts
  • Control Panel and Digital Interface still work unchanged

Closes - #4

@CodeMaverick2
Copy link
Author

CodeMaverick2 commented Feb 15, 2026

Hey @benjimaclellan @yhteoh , I’ve taken a shot at the issue Please let me know if any changes are required

@CodeMaverick2
Copy link
Author

@benjimaclellan I've updated the demo as well Would love your feedback on the changes

@benjimaclellan
Copy link
Member

Hey @CodeMaverick2 - thanks for making these changes. It looks good so far! I'll take another quick look later today for any small changes, but after that I will accept the PR and assign the bounty to you.

@CodeMaverick2
Copy link
Author

@benjimaclellan Would love your review on the code so that we can close this issue soon

@benjimaclellan
Copy link
Member

Hey @CodeMaverick2 - looks good, thanks for the contribution, its now accepted! I'm going to close the PR and assign the Issue to you for the unitaryDESIGN, and that should assign the bounty to you!

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