qiskit_superstaq.compiler_output ================================ .. py:module:: qiskit_superstaq.compiler_output Classes ------- .. autoapisummary:: qiskit_superstaq.compiler_output.CompilerOutput Functions --------- .. autoapisummary:: qiskit_superstaq.compiler_output.active_qubit_indices qiskit_superstaq.compiler_output.classical_bit_mapping qiskit_superstaq.compiler_output.measured_qubit_indices qiskit_superstaq.compiler_output.read_json qiskit_superstaq.compiler_output.read_json_aqt qiskit_superstaq.compiler_output.read_json_qscout Module Contents --------------- .. py:class:: CompilerOutput(circuits: qiskit.QuantumCircuit | list[qiskit.QuantumCircuit] | list[list[qiskit.QuantumCircuit]], initial_logical_to_physicals: dict[int, int] | list[dict[int, int]] | list[list[dict[int, int]]], final_logical_to_physicals: dict[int, int] | list[dict[int, int]] | list[list[dict[int, int]]], pulse_gate_circuits: qiskit.QuantumCircuit | list[qiskit.QuantumCircuit] = None, seq: qtrl.sequencer.Sequence | None = None, jaqal_programs: str | list[str] | None = None) A class that stores the results of compiled circuits. .. 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: A boolean indicating whether this object represents multiple circuits. .. py:attribute:: seq .. py:function:: active_qubit_indices(circuit: qiskit.QuantumCircuit) -> list[int] Returns the indices of the non-idle qubits in the input quantum circuit. :param circuit: A `qiskit.QuantumCircuit` circuit. :returns: A list containing the indices of the non-idle qubits. .. py:function:: classical_bit_mapping(circuit: qiskit.QuantumCircuit) -> dict[int, int] Returns the index of the (final) measured qubit associated with each classical bit. If more than one measurement is assigned to the same classical bit, only the final measurement is considered. :param circuit: A `qiskit.QuantumCircuit` circuit. :returns: A dictionary mapping classical bit indices to the indices of the measured qubits. .. py:function:: measured_qubit_indices(circuit: qiskit.QuantumCircuit) -> list[int] Returns the indices of the measured qubits in the input quantum circuit. :param circuit: A `qiskit.QuantumCircuit` circuit. :returns: A list containing the indices of the measured qubits. .. py:function:: read_json(json_dict: collections.abc.Mapping[str, Any], circuits_is_list: bool) -> CompilerOutput Reads out returned JSON from Superstaq API's compilation endpoints. :param json_dict: A JSON dictionary matching the format returned by /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 (if applicable to this target) corresponding pulse gate circuit(s). .. py:function:: read_json_aqt(json_dict: dict[str, str], circuits_is_list: bool, num_eca_circuits: int | None = None) -> CompilerOutput Reads out the 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: Bool flag that controls whether the returned object has a .circuits attribute (if True) or a .circuit attribute (False). :param num_eca_circuits: Optional 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, str | list[str]], circuits_is_list: bool) -> CompilerOutput Reads out the 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: 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 in a string representation.