from qiskit.transpiler import CouplingMap

t = CouplingMap.from_heavy_hex(5)
t.size()

from transpile_benchy.library import CircuitLibrary
from qiskit import transpile
from mirror_gates.sqiswap_equiv import sel

lib = CircuitLibrary.from_txt("medium_circuits.txt")
for circuit in lib:
    # qc = transpile(circuit, basis_gates=["u", "xx_plus_yy"], optimization_level=0)
    # print(qc.count_ops()["cx"])

    # save the qasm file
    circuit.qasm(filename=circuit.name + ".qasm")

# qc.draw("mpl")

# circuit.decompose().decompose().draw("mpl")

from transpile_benchy.library import CircuitLibrary

lib = CircuitLibrary(circuit_list=[])
for interface in lib.interfaces:
    print(interface.__class__.__name__)
    for circuit in interface.circuits:
        print(circuit)
    print()

lib = CircuitLibrary.from_txt("medium_circuits.txt")