Skip to content

Commit

Permalink
Fix calibration defaultdict issue in compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhartman committed Jul 22, 2024
1 parent 7c373c6 commit d0f3103
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,9 +1989,15 @@ def _format(operand):
dag.global_phase = dag.global_phase.add(&other.global_phase, py);

for (gate, cals) in other.calibrations.iter() {
dag.calibrations[gate]
.bind(py)
.update(cals.bind(py).as_mapping())?;
let calibrations = match dag.calibrations.get(gate) {
Some(calibrations) => calibrations,
None => {
dag.calibrations
.insert(gate.clone(), PyDict::new_bound(py).unbind());
&dag.calibrations[gate]
}
};
calibrations.bind(py).update(cals.bind(py).as_mapping())?;
}

// This is all the handling we need for realtime variables, if there's no remapping. They:
Expand Down

0 comments on commit d0f3103

Please sign in to comment.