qat.runtime.results_processing module

binary(results_list)

Extracted from purr.compiler.execution.

Changes all measurements to binary format.

binary_average(results_list)

Extracted from purr.compiler.execution.

Averages all repeat results and returns a definitive 1/0 for each qubit measurement.

binary_count(results_list, repeats)

Extracted from qat.purr.compiler.runtime.

Returns a dictionary of binary number: count. So for a two qubit register it’ll return

the various counts for 00, 01, 10 and 11.

complex_to_binary(number)

Extracted from purr.compiler.execution.

Base calculation for changing a complex measurement to binary form.

label_count(labels)

Count occurrences of each string state label across all shots in an acquisition.

This is the granular-pipeline equivalent of binary_count(). It works directly on the string state labels produced by the Discriminate step, so multi-state classifiers (qutrit, etc.) are counted correctly without any float conversion.

The input array is flattened before counting, so both 1-D per-shot arrays and multi-dimensional acquisition arrays (e.g. shape (shots, averages)) are handled uniformly — all elements contribute to the same label histogram.

Parameters:

labels (ndarray) – String ndarray of state labels (any shape), e.g. ["0", "0", "1", "2"].

Return type:

dict[str, int]

Returns:

Dictionary mapping each state label to its occurrence count across all shots, e.g. {"0": 2, "1": 1, "2": 1}.

numpy_array_to_list(array)

Extracted from purr.compiler.execution.

Transform numpy arrays to a normal list.