Skip to content

Refactor context management for program builders - #933

Merged
shumpohl merged 5 commits into
masterfrom
feature/program_builder_context
Jan 27, 2026
Merged

shumpohl merged 5 commits into
masterfrom
feature/program_builder_context

Conversation

@shumpohl

@shumpohl shumpohl commented Jan 26, 2026 •

Copy link
Copy Markdown
Member

This PR replaces PulseTemplate._create_program(**a_lot_of__kwargs) with PulseTemplate._build_program(program_builder).

It moves all the information about the current scope, transformations, channel and measurement mappings into the program builder.

  • Add ProgramBuilder.build_context: BuildContext: A dataclass with mutable information like the current scope
  • Add ProgramBuilder.build_settings: BuildSettings: A dataclass with constant information like which templates to translate into a single waveform
  • Add Program.get_defined_channels.
  • Add ProgramBuilder.override to modify the current built settings/context.
  • Add ProgramBuilder.with_mappings for MappingPT
  • Add ProgramBuilder.with_transformation for arithmetic and channel modification PTs
  • Add ProgramBuilder.with_metadata for a semi standadized metadata passing. The only read metadata right now is the minimal sample rate.
  • Remove ProgramBuilder.inner_scope because it is no longer required.

To reduce code duplication the PR contains the BaseProgramBuilder class which contains some default implementations for context management which are shared between the loop and linspace builder.

TODO:

  • fix other tests
  • motivate split between BuildSettings and BuildContext or merge them
  • Transform the PR text into a newspiece

@github-actions

github-actions Bot commented Jan 26, 2026 •

Copy link
Copy Markdown

Test Results

    6 files      6 suites   7m 3s ⏱️
1 234 tests 1 172 ✅  62 💤 0 ❌
7 404 runs  7 032 ✅ 372 💤 0 ❌

Results for commit 1c6516f.

♻️ This comment has been updated with latest results.

@shumpohl

Copy link
Copy Markdown
Member Author

@Nomos11 triggered by properly implementing minimal sample rate

@shumpohl
shumpohl marked this pull request as ready for review January 26, 2026 18:24
@shumpohl
shumpohl requested a review from Nomos11 January 26, 2026 21:18
Comment thread qupulse/program/loop.py
@shumpohl
shumpohl merged commit fa1c64c into master Jan 27, 2026
9 checks passed
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