iqm.error_reduction_tools.utils.general_utils.remove_whitespace_from_bitstrings

iqm.error_reduction_tools.utils.general_utils.remove_whitespace_from_bitstrings#

iqm.error_reduction_tools.utils.general_utils.remove_whitespace_from_bitstrings(counts)#

Remove whitespace from bitstring keys in a counts dictionary.

Parameters:

counts (Mapping[str, _V]) – Dictionary mapping bitstrings (possibly with spaces) to counts.

Returns:

Dictionary with whitespace removed from all bitstring keys.

Return type:

dict[str, _V]

Example

>>> remove_whitespace_from_bitstrings({"0 1": 10, "1 0": 5})
{'01': 10, '10': 5}