uniqc.task.adapters.quafu_adapter module#

Quafu backend adapter.

Translates OriginIR circuits to Quafu QuantumCircuit objects and submits via the quafu package (User / Task API). No raw REST calls.

Installation:

pip install unified-quantum[quafu]

class uniqc.task.adapters.quafu_adapter.QuafuAdapter[source]#

Bases: QuantumAdapter

Adapter for the BAQIS Quafu (ScQ) quantum cloud platform.

Raises:

MissingDependencyError – If quafu package is not installed.

VALID_CHIP_IDS = frozenset({'Dongling', 'ScQ-P10', 'ScQ-P10C', 'ScQ-P136', 'ScQ-P18'})#
property api_token: str#

Return the API token used for Quafu authentication.

Returns:

The Quafu API token.

Return type:

str

is_available()[source]#

Check if the Quafu adapter is available (quafu package installed).

Returns:

True if the quafu package was successfully imported.

Return type:

bool

list_backends()[source]#

Return raw Quafu backend metadata.

For hardware backends, fetches chip_info() to populate fidelity and coherence data.

Returns:

name, num_qubits, status, task_in_queue, qv, valid_gates, plus fidelity/coherence fields (avg_1q_fidelity, avg_2q_fidelity, avg_readout_fidelity, coherence_t1, coherence_t2).

Return type:

List of dicts with keys

name: str = 'quafu'#
query(taskid)[source]#

Query a single Quafu task’s status via SDK Task.retrieve().

Uses the internally maintained history dict so the caller does not need to pass any additional context.

Parameters:

taskid (str)

Return type:

dict[str, Any]

query_batch(taskids)[source]#

Query multiple Quafu tasks and merge results.

Parameters:

taskids (list[str])

Return type:

dict[str, Any]

submit(circuit, *, shots=10000, **kwargs)[source]#

Submit a single circuit to Quafu.

Parameters:
  • circuit (QuantumCircuit)

  • shots (int)

  • kwargs (Any)

Return type:

str

submit_batch(circuits, *, shots=10000, **kwargs)[source]#

Submit multiple circuits as a group to Quafu.

Parameters:
  • circuits (list['QuantumCircuit'])

  • shots (int)

  • kwargs (Any)

Return type:

list[str]

translate_circuit(originir)[source]#

Translate an OriginIR string to a Quafu QuantumCircuit.

Parameters:

originir (str)

Return type:

QuantumCircuit