Open anpaz opened 3 years ago
For OpenQASM 2.0 I think that the main functionality is covered by #37 with:
import qiskit
qasm = """
// quantum teleportation example
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c0[1];
creg c1[1];
creg c2[1];
// optional post-rotation for state tomography
gate post q { }
u3(0.3,0.2,0.1) q[0];
h q[1];
cx q[1],q[2];
barrier q;
cx q[0],q[1];
h q[0];
measure q[0] -> c0[0];
measure q[1] -> c1[0];
if(c0==1) z q[2];
if(c1==1) x q[2];
post q[2];
measure q[2] -> c2[0];
"""
circ = qiskit.QuantumCircuit.from_qasm_str(qasm)
qviz_json = convert_to_qviz(circ)
Or that the intent here is to be fully JS/TS based?
Is your feature request related to a problem? Please describe. It would be great if we could visualize an OpenQASM circuit using q-viz.
Describe the solution you'd like Ideally this would all work using just javascript. We would have a javascript method that takes OpenQASM as a string, and parse it into a Sqore that can then be visualized. For example:
For OpenQASM 3.0, we might need to do something similar to what we do with Q#, i.e. run a trace of the program and generate the json from the corresponding gates.