iqm.error_reduction_tools.twirling.twirling_processors.untwirl_counts#
- iqm.error_reduction_tools.twirling.twirling_processors.untwirl_counts(counts, rot_string)#
Apply untwirling to measurement counts.
Flips bits in measurement bitstrings according to a readout twirling string. For each qubit where the twirling operation was ‘X’, the corresponding measurement bit is flipped (0 ↔ 1).
- Parameters:
- Returns:
Dictionary of untwirled counts.
- Raises:
ValueError – If rot_string length doesn’t match number of qubits.
- Return type:
Example
>>> counts = {'000': 10, '001': 5, '010': 3} >>> rot_string = "XII" >>> untwirl_counts(counts, rot_string) {'001': 10, '000': 5, '011': 3}