56 lines
2.0 KiB
Plaintext
56 lines
2.0 KiB
Plaintext
---
|
||
title: disassemble
|
||
description: API reference for qiskit.assembler.disassemble
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.assembler.disassemble
|
||
---
|
||
|
||
<span id="qiskit-assembler-disassemble" />
|
||
|
||
# qiskit.assembler.disassemble
|
||
|
||
<Function id="qiskit.assembler.disassemble" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.24/qiskit/assembler/disassemble.py" signature="disassemble(qobj)">
|
||
Disassemble a qobj and return the circuits or pulse schedules, run\_config, and user header.
|
||
|
||
<Admonition title="Note" type="note">
|
||
`disassemble(assemble(qc))` is not guaranteed to produce an exactly equal circuit to the input, due to limitations in the [`QasmQobj`](qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj") format that need to be maintained for backend system compatibility. This is most likely to be the case when using newer features of [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). In most cases, the output should be equivalent, if not quite equal.
|
||
</Admonition>
|
||
|
||
**Parameters**
|
||
|
||
**qobj** ([*Qobj*](qiskit.qobj.Qobj "qiskit.qobj.Qobj")) – The input qobj object to disassemble
|
||
|
||
**Returns**
|
||
|
||
The disassembled program which consists of:
|
||
|
||
> * programs: A list of quantum circuits or pulse schedules
|
||
> * run\_config: The dict of the run config
|
||
> * user\_qobj\_header: The dict of any user headers in the qobj
|
||
|
||
**Return type**
|
||
|
||
Union\[CircuitModule, PulseModule]
|
||
|
||
**Examples**
|
||
|
||
```python
|
||
from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit
|
||
from qiskit.compiler.assembler import assemble
|
||
from qiskit.assembler.disassemble import disassemble
|
||
# Create a circuit to assemble into a qobj
|
||
q = QuantumRegister(2)
|
||
c = ClassicalRegister(2)
|
||
qc = QuantumCircuit(q, c)
|
||
qc.h(q[0])
|
||
qc.cx(q[0], q[1])
|
||
qc.measure(q, c)
|
||
# Assemble the circuit into a Qobj
|
||
qobj = assemble(qc, shots=2000, memory=True)
|
||
# Disassemble the qobj back into a circuit
|
||
circuits, run_config_out, headers = disassemble(qobj)
|
||
```
|
||
</Function>
|
||
|