Skip to content

QCloudResult ​

QCloudResult stores parsed job output plus optional raw fields returned by the cloud service.

Signature ​

python
QCloudResult(cloud_job_id: str, result_string: str)

In practice, use the object returned by QCloudJob.query() or QCloudJob.result().

Standard result methods ​

MethodSignatureDescription
get_probsget_probs(base: DataBase = DataBase.Binary) -> dict[str, float]Probability dictionary.
get_countsget_counts(base: DataBase = DataBase.Binary) -> dict[str, int]Count dictionary.
get_probs_listget_probs_list(base: DataBase = DataBase.Binary) -> list[dict[str, float]]Batched probability outputs.
get_counts_listget_counts_list(base: DataBase = DataBase.Binary) -> list[dict[str, int]]Batched count outputs.
get_amplitudesget_amplitudes() -> dict[str, complex]Amplitude results for amplitude tasks.
get_state_fidelityget_state_fidelity() -> floatState-tomography fidelity.
get_state_tomography_densityget_state_tomography_density() -> list[list[complex]]State-tomography density matrix.
origin_dataorigin_data() -> strRaw JSON payload string.
job_idjob_id() -> strJob id.
job_statusjob_status() -> JobStatusStatus embedded in the result payload.
error_messageerror_message() -> strError text if the task failed.

job_status() returns the status carried in the result; FAILED is terminal. Failed tasks are no longer expressed through exceptions; error_message() prefers obj.errInfo, then message, then errCode. Server-reported task failures are expressed through JobStatus.FAILED and error_message(); network, protocol, or HTTP errors may still be raised by the underlying request. See QCloudJob.result() for the full contract.

Raw-field access ​

0.4.0 also exposes raw service fields returned by QCloud. The table below shows the mapping between QCloud JSON field names (used in keys= requests and membership checks) and Python accessor methods.

QCloud JSON fieldPython methodDescription
convertQProginstructions()Cloud-converted instruction stream.
qprogqprog()Raw QProg data submitted to the cloud.
mappingQprogmapping_qprog()QProg after server-side qubit mapping.
mappingQubitmapping_qubit()Virtual-to-physical qubit mapping relationship.
srcQubitssrc_qubits()Source qubit indices used in the task.
targetCbitstarget_cbits()Target classical bit indices.
measureQubitsmeasure_qubits()Qubit indices where measurements were applied.
probCountprob_count_raw()Raw probability count data from the backend.

You can also access raw fields generically:

python
"mappingQprog" in result
raw_mapping = result["mappingQprog"]

Known aliases accept snake_case names in membership and index access.

timing_info ​

python
timing_info() -> dict[str, str]

Return every non-null field whose key contains "Time", such as startTime, totalTime, pulseTime, or qpuRunTime.

Unlike earlier docs, this is not a fixed 13-field schema.

Example ​

python
from pyqpanda3.core import H, QProg, measure
from pyqpanda3.qcloud import DataBase, QCloudService

service = QCloudService("your_api_key")
backend = service.backend("full_amplitude")
prog = QProg()
prog << H(0) << measure(0, 0)
job = backend.run(prog, shots=1000)

result = job.result(keys=["mappingQprog", "mappingQubit", "probCount"])

print(result.get_probs(base=DataBase.Binary))
print("mappingQprog" in result)
print(result.mapping_qubit() if "mappingQubit" in result else "")
print(result.timing_info())
print(result.origin_data()[:200])

Example output shape:

text
{'0x0': 0.501, '0x1': 0.499}
True
{"0": 1}
{'totalTime': '...', 'qpuRunTime': '...'}
{"success":true,"code":10000,...

Notes ​

  • Raw-field access depends on what the backend and service actually returned.
  • timing_info() is dynamic and may differ across QPU, simulator, and tomography tasks.

See Also ​

Released under the MIT License.