Noise
Noise for simulations
NoiseHandler(protocol, options=dict())
A container for multiple sources of noise.
Note NoiseProtocol.ANALOG
and NoiseProtocol.DIGITAL
sources cannot be both present.
Also NoiseProtocol.READOUT
can only be present once as the last noise sources, and only
exclusively with NoiseProtocol.DIGITAL
sources.
PARAMETER | DESCRIPTION |
---|---|
protocol |
The protocol(s) applied. To be defined from
TYPE:
|
options |
A list of options defining the protocol.
For
TYPE:
|
Examples:
from qadence import NoiseProtocol, NoiseHandler
analog_options = {"noise_probs": 0.1}
digital_options = {"error_probability": 0.1}
readout_options = {"error_probability": 0.1, "seed": 0}
# single noise sources
analog_noise = NoiseHandler(NoiseProtocol.ANALOG.DEPOLARIZING, analog_options)
digital_depo_noise = NoiseHandler(NoiseProtocol.DIGITAL.DEPOLARIZING, digital_options)
readout_noise = NoiseHandler(NoiseProtocol.READOUT, readout_options)
# init from multiple sources
protocols: list = [NoiseProtocol.DIGITAL.DEPOLARIZING, NoiseProtocol.READOUT]
options: list = [digital_options, readout_noise]
noise_combination = NoiseHandler(protocols, options)
# Appending noise sources
noise_combination = NoiseHandler(NoiseProtocol.DIGITAL.BITFLIP, digital_options)
noise_combination.append([digital_depo_noise, readout_noise])
Source code in qadence/noise/protocols.py
append(other)
Append noises.
PARAMETER | DESCRIPTION |
---|---|
other |
The noises to add.
TYPE:
|
Source code in qadence/noise/protocols.py
verify_all_protocols()
Make sure all protocols are correct in terms and their combination too.
Source code in qadence/noise/protocols.py
apply_readout_noise(noise, samples)
Apply readout noise to samples if provided.
PARAMETER | DESCRIPTION |
---|---|
noise |
Noise to apply.
TYPE:
|
samples |
Samples to alter
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
|
list[Counter]: Altered samples. |