marginal_counts(counts, meas_qubits=True, pad_zeros=False)[source]

Compute marginal counts from a counts dictionary.

  • counts (Dict[str, int]) – a counts dictionary.

  • meas_qubits (Union[bool, List[int]]) – (default: True) the qubits to NOT be marinalized over if this is True meas_qubits will be all measured qubits.

  • pad_zeros (bool) – (default: False) Include zero count outcomes in return dict.

Return type

Dict[str, int]


A counts dictionary for the specified qubits. The returned dictionary will have any whitespace trimmed from the input counts keys. Thus if meas_qubits=True the returned dictionary will have the same values as the input dictionary, but with whitespace trimmed from the keys.