PilotNoiseParams
PilotNoiseParams is a pybind11 data class (defined in the C++ extension) that holds noise simulation parameters for the QPilot OS pilot service. It defines the noise model type and associated gate error rates used in noisy quantum circuit simulations.
Note: In pyqpanda3 0.4.0,
PilotNoiseParamsis an internal C++ type whose constructor is not directly exposed to Python. To create and configure noise parameters, useQCloudNoiseModelfrompyqpanda3.qcloudinstead -- see the examples below.
Attributes
All attributes are publicly accessible read/write fields.
| Attribute | Type | Description |
|---|---|---|
| noise_model | str | The noise model identifier (one of the NOISE_MODEL enum names, e.g. "DEPOLARIZING_KRAUS_OPERATOR") |
| single_gate_param | float | Noise parameter for single-qubit gates |
| double_gate_param | float | Noise parameter for two-qubit gates |
| single_p2 | float | Secondary single-qubit noise parameter (used in some noise models) |
| double_p2 | float | Secondary two-qubit noise parameter (used in some noise models) |
| single_pgate | float | Single-qubit gate error probability |
| double_pgate | float | Two-qubit gate error probability |
NOISE_MODEL Enum
The NOISE_MODEL enum (from pyqpanda3.qcloud) defines the supported noise model types:
| Enum Value | Numeric ID | Description |
|---|---|---|
NOISE_MODEL.BITFLIP_KRAUS_OPERATOR | 0 | Random X (bit-flip) errors |
NOISE_MODEL.BIT_PHASE_FLIP_OPERATOR | 1 | Combined bit and phase flip errors |
NOISE_MODEL.DAMPING_KRAUS_OPERATOR | 2 | Amplitude damping (T1 decay) |
NOISE_MODEL.DECOHERENCE_KRAUS_OPERATOR | 3 | Combined T1 and T2 decoherence |
NOISE_MODEL.DEPHASING_KRAUS_OPERATOR | 4 | Phase damping (T2 decay) |
NOISE_MODEL.DEPOLARIZING_KRAUS_OPERATOR | 5 | Uniform depolarizing noise |
NOISE_MODEL.PHASE_DAMPING_OPERATOR | 6 | Pure dephasing errors |
Examples
Create and inspect a noise model using QCloudNoiseModel:
from pyqpanda3.qcloud import QCloudNoiseModel, NOISE_MODEL
# Create a depolarizing noise model with 0.1% single-gate
# and 1% two-gate error probabilities
noise_params = QCloudNoiseModel(
NOISE_MODEL.DEPOLARIZING_KRAUS_OPERATOR,
[0.001], # single-qubit gate error probability
[0.01] # two-qubit gate error probability
)
# Read noise parameters
print(f"Noise model: {noise_params.get_noise_model()}")
print(f"Single gate params: {noise_params.get_single_params()}")
print(f"Double gate params: {noise_params.get_double_params()}")Output:
Noise model: DEPOLARIZING_KRAUS_OPERATOR
Single gate params: [0.001]
Double gate params: [0.01]You can also construct an empty (disabled) noise model and configure it later:
from pyqpanda3.qcloud import QCloudNoiseModel, NOISE_MODEL
# Create an empty noise model (disabled by default)
noise_params = QCloudNoiseModel()
# Configure parameters
noise_params.set_single_params([0.001])
noise_params.set_double_params([0.01])
# Check state
print(f"Enabled: {noise_params.is_enabled()}")
print(f"Single gate params: {noise_params.get_single_params()}")
print(f"Double gate params: {noise_params.get_double_params()}")Output:
Enabled: True
Single gate params: [0.001]
Double gate params: [0.01]Note: A
QCloudNoiseModelconstructed with the default constructor initially hasis_enabled() == False. It becomes enabled once noise parameters are assigned.
See Also
- QPilotService -- Main service class that uses noise parameters
- ErrorCode -- Error codes for pilot operations
- QCloudNoiseModel -- Working noise model class for cloud and simulator configurations