qubic.results.counts
CircuitCounts
Object for storing shot count results (i.e. number of '000', '100', etc) from a batch of experiments. Intended to only store counts from a single circuit, but possibly with multiple reads.
CircuitCounts are summed along the nshots dimension, so bitstring count values have shape (reads_per_shot,)
The keys of count_dict and bitstring_dict have results in the same order as qubits.
Attributes:
| Name | Type | Description |
|---|---|---|
qubits |
List[str]
|
list of qubits in dataset |
count_dict |
Dict[Tuple, int]
|
dictionary of counts indexed by bitstring formatted as tuple of sequential gmm labels.
Tuple is indexed in the same order as |
bitstring_dict |
Dict[str, int]
|
dictionary of counts indexed by bitstring literal |
TODO |
add heralded bitstring dict |
Source code in qubic/results/counts.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
bitstring_dict
property
lazy generation + store
__init__(shot_dict, gmm_labels=[0, 1])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shot_dict
|
Dict[ndarray]
|
dictionary of classified shots, indexed by qubit values have shape (nshots, reads_per_shot) |
required |
gmm_labels
|
list
|
list of possible shot classification values |
[0, 1]
|
Source code in qubic/results/counts.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
get_mitigated_results(mitig_mat)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mitig_mat
|
ndarray
|
shape (len(self.count_dict), len(self.count_dict)); (2n_qubits, 2n_qubits) for two state readout. multiplies the measurement vector to get mitigated results |
required |
Source code in qubic/results/counts.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
shots_to_batchcounts(shot_dict, gmm_labels=[0, 1], herald=False, herald_read_ind=0)
Given a dictionary of classified shots from a batch, compute bitstring results
(CircuitCounts) for each circuit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shot_dict
|
Dict[ndarray]
|
dictionary of classified shots, indexed by qubit values have shape (n_circuits, n_shots, reads_per_shot) |
required |
gmm_labels
|
list
|
list of possible shot classification values |
[0, 1]
|
Returns:
| Type | Description |
|---|---|
List[CircuitCounts]
|
list of CircuitCounts objects, one per circuit in batch |
Source code in qubic/results/counts.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |