tn_noise_learning.simulate#
Synthetic datasets from a known channel: exact outcome distributions sampled one setting at a time.
A setting is a pair (state_labels, basis_labels) with one entry per qubit. One exact contraction gives the joint
distribution over all 2**num_qubits bit strings of that setting, from which all its shots are drawn with a single
multinomial draw. Effect labels follow the convention 2 * basis + bit.
outcome_distribution #
outcome_distribution(
channel: LPDO,
circuit: QuantumCircuit | None,
state_labels: Labels,
basis_labels: Labels,
*,
states: ndarray,
povms: ndarray,
optimize: str = "auto-hq",
) -> np.ndarray
Joint probability of every bit string for one setting, shape (2,) * num_qubits with qubit 0 first.
Source code in src/tn_noise_learning/simulate.py
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 | |
sample_shots #
sample_shots(
channel: LPDO,
circuit: QuantumCircuit | None = None,
*,
num_settings: int = 100,
shots_per_setting: int = 100,
seed: int | None = None,
states: ndarray | None = None,
povms: ndarray | None = None,
settings: Sequence[Setting] | None = None,
) -> NoiseDataset
Sample a dataset from channel applied after circuit.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
ground-truth channel; stored in the dataset as
TYPE:
|
circuit
|
ideal circuit applied before the channel (
TYPE:
|
num_settings
|
number of random
TYPE:
|
shots_per_setting
|
shots drawn per setting.
TYPE:
|
seed
|
seed for settings, shots and the final shuffle.
TYPE:
|
states
|
input states per qubit, shape
TYPE:
|
povms
|
effects per qubit as consecutive basis pairs; default Pauli eigenstates.
TYPE:
|
settings
|
explicit settings, overriding
TYPE:
|
Source code in src/tn_noise_learning/simulate.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 | |