Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.
Project description
qiskit-state-evolution-recorder
Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.
Installation
pip install qiskit-state-evolution-recorder
Usage
from qiskit.circuit import QuantumCircuit
from qiskit_state_evolution_recorder import StateEvolutionRecorder
qc = QuantumCircuit(4)
# apply Pauli X-gate
qc.x(3)
# apply Hadamart gate
qc.h(range(4))
# apply Toffoli gate
qc.mcx(list(range(3)), 3)
# apply Hadamart gate
qc.h(range(4))
qc.measure_all()
recorder = StateEvolutionRecorder(qc, figsize=(12, 8), num_cols=4, style={'name': 'bw'})
# evolve the circuit using 120 intermediate states for each qubit
# since we have 5 fundamental states it will lead to 481 frames
recorder.evolve(120)
# with FPS of 30, the video duration will be 16.033333s
recorder.record("quantum_circuit.mp4", fps=30)
In a Jupyter notebook, you can do:
from IPython.display import Video
video = Video("quantum_circuit.mp4")
video.reload()
video
https://github.com/user-attachments/assets/8a3c8567-cbb8-4271-9c2c-9588130c01b0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file qiskit_state_evolution_recorder-0.1.4.tar.gz
.
File metadata
- Download URL: qiskit_state_evolution_recorder-0.1.4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0850ce88d44a7134d14f4b1b0d7afbdfd2ef86a6f9558c0027eb34e25d581e7c |
|
MD5 | 89d406a19cd7d861c7faef5b84ea6dcf |
|
BLAKE2b-256 | 1f81b6b2871bb42b052bbb325b36b86a304d9a88eb0338d7937be957dfc8dfcf |
File details
Details for the file qiskit_state_evolution_recorder-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: qiskit_state_evolution_recorder-0.1.4-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d65a1a6778c36f47890cf0238d981cb4fff432cd206d8f85500712062b5f2e28 |
|
MD5 | 5965559fb78e73ff3492eaa9ea683a71 |
|
BLAKE2b-256 | fec1b8bcde9da9f59ed80ac39cd1f43497da671799dbbbb4c83cc627362d80e9 |