cirq_superstaq.compiler_output ============================== .. py:module:: cirq_superstaq.compiler_output Classes ------- .. autoapisummary:: cirq_superstaq.compiler_output.CompilerOutput Functions --------- .. autoapisummary:: cirq_superstaq.compiler_output.active_qubit_indices cirq_superstaq.compiler_output.measured_qubit_indices cirq_superstaq.compiler_output.read_json cirq_superstaq.compiler_output.read_json_aqt cirq_superstaq.compiler_output.read_json_qscout Module Contents --------------- .. py:class:: CompilerOutput(circuits: cirq.Circuit | list[cirq.Circuit] | list[list[cirq.Circuit]], initial_logical_to_physicals: dict[cirq.Qid, cirq.Qid] | list[dict[cirq.Qid, cirq.Qid]] | list[list[dict[cirq.Qid, cirq.Qid]]], final_logical_to_physicals: dict[cirq.Qid, cirq.Qid] | list[dict[cirq.Qid, cirq.Qid]] | list[list[dict[cirq.Qid, cirq.Qid]]], pulse_gate_circuits: Any | None = None, seq: qtrl.sequencer.Sequence | None = None, jaqal_programs: list[str] | str | None = None) A class that arranges compiled circuit information. .. py:method:: has_multiple_circuits() -> bool Checks if this object has plural attributes (e.g. `.circuits`). Otherwise, the object represents a single circuit, and has singular attributes (`.circuit`). :returns: `True` if this object represents multiple circuits; `False` otherwise. .. py:attribute:: seq :value: None .. py:function:: active_qubit_indices(circuit: cirq.AbstractCircuit) -> list[int] Returns the indices of the non-idle qubits in a quantum circuit. .. note:: The "index" refers to the argument of a `LineQubit` (so e.g. `cirq.LineQubit(5)` has index 5 regardless of the total number of qubits in the circuit). :param circuit: The input quantum circuit. :returns: A list of active qubit indicies. :raises ValueError: If qubit indices are requested for non-line qubits. .. py:function:: measured_qubit_indices(circuit: cirq.AbstractCircuit) -> list[int] Returns the indices of the measured qubits in a quantum circuit. .. note:: The "index" refers to the argument of a `cirq.LineQubit` (so e.g. `cirq.LineQubit(5)` has index 5 regardless of the total number of qubits in the circuit). :param circuit: The input quantum circuit. :returns: A list of the measurement qubit indicies. :raises ValueError: If qubit indices are requested for non-line qubits. .. py:function:: read_json(json_dict: dict[str, Any], circuits_is_list: bool) -> CompilerOutput Reads out returned JSON from Superstaq API's IBMQ compilation endpoint. :param json_dict: A JSON dictionary matching the format returned by /ibmq_compile endpoint :param circuits_is_list: A bool flag that controls whether the returned object has a .circuits attribute (if `True`) or a .circuit attribute (`False`). :returns: A `CompilerOutput` object with the compiled circuit(s). If included in the server response, the returned object also stores the corresponding pulse gate circuit(s) in its .pulse_gate_circuit(s) attribute (provided qiskit-superstaq is available locally). .. py:function:: read_json_aqt(json_dict: dict[str, Any], circuits_is_list: bool, num_eca_circuits: int | None = None) -> CompilerOutput Reads out returned JSON from Superstaq API's AQT compilation endpoint. :param json_dict: A JSON dictionary matching the format returned by aqt_compile endpoint. :param circuits_is_list: A bool flag that controls whether the returned object has a .circuits attribute (if `True`) or a .circuit attribute (`False`). :param num_eca_circuits: Number of logically equivalent random circuits to generate for each input circuit. :returns: A `CompilerOutput` object with the compiled circuit(s). If `qtrl` is available locally, the returned object also stores the pulse sequence in the .seq attribute. .. py:function:: read_json_qscout(json_dict: dict[str, Any], circuits_is_list: bool) -> CompilerOutput Reads out returned JSON from Superstaq API's QSCOUT compilation endpoint. :param json_dict: A JSON dictionary matching the format returned by /qscout_compile endpoint. :param circuits_is_list: A bool flag that controls whether the returned object has a .circuits attribute (if `True`) or a .circuit attribute (`False`). :returns: A `CompilerOutput` object with the compiled circuit(s) and a list of jaqal programs represented as strings.