0
$\begingroup$

I am interested in retrieving the OpenQasm code of a quantum circuit, as it appears on IBM Quantum Experience. This is the code that the quantum machine actually runs. I used to be able to just copy the code from the results tab, but I seem to not be able to do that anymore. Is there any way to retrieve said Qasm code? Thank you in advance.

$\endgroup$
2
$\begingroup$

On the results tab, above the circuit diagram, there is an option to see the QASM code enter image description here

[EDIT] You cannot copy and paste code from this tab. You can retrieve the QASM in a text format simply by using Qiskit instead, all you need is the Job ID. This code can be run easily in a notebook in the IBM Quantum Experience. You can do this as follows

provider = IBMQ.load_account()
result = backend.retrieve_job('job id')
qob = result.qobj()

from qiskit.assembler import disassemble
jobs = disassemble(qob)
qc = jobs[0][0]

qc.qasm()
| improve this answer | |
$\endgroup$
  • $\begingroup$ Hello, thanks for your answer. I know there is the option, but I want to get the QASM code, not just look at it. Like, I used to be able to just select it and copy-paste it, now I cannot anymore. $\endgroup$ – Samceid Apr 21 at 11:33
  • 1
    $\begingroup$ I see what you mean, that is really weird! It can be done quite simply using Qiskit, which you can run in a notebook on the IBM Quantum Experience, all you need is the job ID. I have updated my answer to show how this can be done. $\endgroup$ – met927 Apr 21 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.