iqm.error_reduction_tools.twirling.twirling_api.TwirlingConfiguration#

class iqm.error_reduction_tools.twirling.twirling_api.TwirlingConfiguration(readout_twirl_strategy='LOCAL', seed=None, circuit_twirling=True, num_twirling_instances=20)#

Bases: object

Configuration for circuit twirling.

Attributes

circuit_twirling

Whether to apply Pauli twirling to two-qubit gates ("Poor Man's Pauli Twirling").

num_twirling_instances

Total number of randomized variants per input circuit when circuit_twirling=True.

readout_twirl_strategy

Readout-twirling strategy.

seed

RNG seed for reproducibility.

Methods

__eq__(other)

Return self==value.

__repr__()

Return repr(self).

Parameters:
  • readout_twirl_strategy (Literal['LOCAL', 'MINIMAL', 'HADAMARD', 'NONE'])

  • seed (int | None)

  • circuit_twirling (bool)

  • num_twirling_instances (int)

readout_twirl_strategy: Literal['LOCAL', 'MINIMAL', 'HADAMARD', 'NONE'] = 'LOCAL'#

Readout-twirling strategy.

Supported values are "LOCAL" (4 strings, requires topology), "MINIMAL" (2 strings), "HADAMARD" (up to $2^n$ strings), and "NONE" to disable readout twirling entirely. When "NONE" is combined with circuit_twirling=True, num_twirling_instances random circuit-twirled variants are generated instead.

seed: int | None = None#

RNG seed for reproducibility. None means non-deterministic.

circuit_twirling: bool = True#

Whether to apply Pauli twirling to two-qubit gates (“Poor Man’s Pauli Twirling”).

When False, the inserted Pauli rotations on single-qubit gates are suppressed; readout twirling (if any) still works.

num_twirling_instances: int = 20#

Total number of randomized variants per input circuit when circuit_twirling=True.

This budget is split evenly across the readout-twirling rot-strings (whose count is fixed by readout_twirl_strategy) so that every rot-string receives the same number of independent Pauli randomizations.

Reconciliation rules (a warning is emitted whenever the effective count differs from the requested one):

  • If num_twirling_instances is a multiple of the number of rot-strings, it is used as-is.

  • If it is not a multiple, it is rounded up to the next multiple.

  • If it is smaller than the number of rot-strings, the number of rot-strings is used (one Pauli randomization per rot-string).

When circuit_twirling=False this field is ignored: each rot-string is emitted exactly once. Default of 20 follows common Pauli-twirling practice (10–50 instances).