Skip to content

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.

ValueDescription
WAITINGThe job is waiting to be processed
COMPUTINGThe job is currently being executed on the backend
FINISHEDThe job has completed successfully
FAILEDThe job has failed during execution
QUEUINGThe 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.

ValueDescription
DEFAULTDefault format; behavior depends on the context or backend implementation
BINARYCompact binary format for efficient transmission and storage
INSTRUCTION_SETExplicit sequence of instructions or gate operations

DataBase

Specifies the numeric base used for representing quantum measurement results.

ValueDescription
BinaryBase-2 (binary) representation, e.g., "0010"
HexBase-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.

ValueDescription
BITFLIP_KRAUS_OPERATORBit-flip noise model (X error with probability p)
BIT_PHASE_FLIP_OPERATORBit-phase flip noise model (Y error with probability p)
DAMPING_KRAUS_OPERATORAmplitude damping noise model (energy dissipation)
DECOHERENCE_KRAUS_OPERATORCombined decoherence noise model (T1 and T2 relaxation)
DEPHASING_KRAUS_OPERATORPhase damping noise model (loss of phase coherence)
DEPOLARIZING_KRAUS_OPERATORDepolarizing noise model (uniform error on all Pauli axes)
PHASE_DAMPING_OPERATORPhase 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.

ValueDescription
CLOUD_INFOInformational messages about normal operations
CLOUD_DEBUGDetailed debug messages for troubleshooting
CLOUD_WARNINGWarning messages about potential issues
CLOUD_ERRORError 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.

ValueDescription
CONSOLELog messages are printed to the console (standard output)
FILELog 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

Released under the MIT License.