Enumerations
This page documents the enumerations used across the qcloud module for job status, data formats, noise models, and logging.
JobStatus
Represents the lifecycle status of a quantum cloud job.
| Value | Description |
|---|---|
| WAITING | The job is waiting to be processed |
| COMPUTING | The job is currently being executed on the backend |
| FINISHED | The job has completed successfully |
| FAILED | The job has failed during execution |
| QUEUING | The job is queued and waiting for available resources |
Example
python
from pyqpanda3.qcloud import JobStatus
status = job.status()
if status == JobStatus.FINISHED:
result = job.result()
elif status == JobStatus.FAILED:
print("Job failed")DataFormat
Specifies the data format used for quantum circuit export and communication with cloud backends.
| Value | Description |
|---|---|
| DEFAULT | Default format; behavior depends on the context or backend implementation |
| BINARY | Compact binary format for efficient transmission and storage |
| INSTRUCTION_SET | Explicit sequence of instructions or gate operations |
DataBase
Specifies the numeric base used for representing quantum measurement results.
| Value | Description |
|---|---|
| Binary | Base-2 (binary) representation, e.g., "0010" |
| Hex | Base-16 (hexadecimal) representation, e.g., "0x2" |
Example
python
from pyqpanda3.qcloud import DataBase
# Get results in binary format (default)
probs_binary = result.get_probs(base=DataBase.Binary)
# Get results in hexadecimal format
probs_hex = result.get_probs(base=DataBase.Hex)NOISE_MODEL
Defines the types of quantum noise models available for cloud-based noisy simulations.
| Value | Description |
|---|---|
| BITFLIP_KRAUS_OPERATOR | Bit-flip noise model (X error with probability p) |
| BIT_PHASE_FLIP_OPERATOR | Bit-phase flip noise model (Y error with probability p) |
| DAMPING_KRAUS_OPERATOR | Amplitude damping noise model (energy dissipation) |
| DECOHERENCE_KRAUS_OPERATOR | Combined decoherence noise model (T1 and T2 relaxation) |
| DEPHASING_KRAUS_OPERATOR | Phase damping noise model (loss of phase coherence) |
| DEPOLARIZING_KRAUS_OPERATOR | Depolarizing noise model (uniform error on all Pauli axes) |
| PHASE_DAMPING_OPERATOR | Phase damping noise model (pure dephasing) |
Example
python
from pyqpanda3.qcloud import QCloudNoiseModel, NOISE_MODEL
# Create a decoherence noise model
noise = QCloudNoiseModel(
model=NOISE_MODEL.DECOHERENCE_KRAUS_OPERATOR,
single_p=[0.001],
double_p=[0.01]
)LogLevel
Defines logging verbosity levels for the cloud service.
| Value | Description |
|---|---|
| CLOUD_INFO | Informational messages about normal operations |
| CLOUD_DEBUG | Detailed debug messages for troubleshooting |
| CLOUD_WARNING | Warning messages about potential issues |
| CLOUD_ERROR | Error messages about failures |
Example
python
from pyqpanda3.qcloud import QCloudService, LogLevel
service = QCloudService(api_key="your_api_key")
# Logging level is configured via setup_logging
service.setup_logging(output=LogOutput.CONSOLE)LogOutput
Specifies the destination for log output from the cloud service.
| Value | Description |
|---|---|
| CONSOLE | Log messages are printed to the console (standard output) |
| FILE | Log messages are written to a file |
Example
python
from pyqpanda3.qcloud import QCloudService, LogOutput
service = QCloudService(api_key="your_api_key")
service.setup_logging(output=LogOutput.FILE, file_path="qcloud_debug.log")See Also
- QCloudService -- Main cloud service class
- QCloudNoiseModel -- Noise model configuration using NOISE_MODEL
- QCloudResult -- Result class using DataBase for output format