iqm.error_reduction_tools.twirling.twirling_modifiers.process_r_gate#
- iqm.error_reduction_tools.twirling.twirling_modifiers.process_r_gate(operation, twirled_circuit, rgen, registers, enforce_readout_twirling_basis=None, twirling_prob=0.5, fix_axes=False)#
Process an R gate: absorb pending operations, then optionally insert a twirling π rotation.
First delegates to take_care_of_pending_operations to commute any accumulated Z and π rotations into the gate parameters. Then, with probability
twirling_prob(possibly adjusted by parity or readout twirling constraints), inserts a new π rotation via insert_twirling_pi_rotation. Finally appends the resulting PRX gate to the twirled circuit.- Parameters:
operation (CircuitOperation) – The PRX CircuitOperation to process.
twirled_circuit (TwirledCircuit) – The new circuit being built.
rgen (Generator) – Random number generator for twirling decisions.
registers (TrackingRegisters) – Tracking registers for Z, π-rotation state, etc.
enforce_readout_twirling_basis (str | None) – If set (‘X’ or ‘I’), overrides twirling_prob to enforce a specific readout twirling outcome on the last SQG.
twirling_prob (float) – Probability of inserting a twirling π rotation. Defaults to 0.5.
fix_axes (bool) – If True, the twirling π rotation axis is fixed to match the gate’s phase rather than being uniformly random. Defaults to False.
- Return type:
None