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 Hadamart gate
qc.h(range(4))
# apply Toffoli gate
qc.mcx(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 4 fundamental states it will lead to 361 frames
recorder.evolve(120)
# with FPS of 30, the video duration will be 12.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
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.1.tar.gz
.
File metadata
- Download URL: qiskit_state_evolution_recorder-0.1.1.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 | 8d17dd1664950adf4e70439e070d188ecefec3e450406aebc9dd257757cff1b5 |
|
MD5 | 8f9fa2ebf14d583793d5eb57a0543b3f |
|
BLAKE2b-256 | 0c568230ec5206bfc85e06ad626485e431ee532c065cefc62e338b9b09189639 |
File details
Details for the file qiskit_state_evolution_recorder-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: qiskit_state_evolution_recorder-0.1.1-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 | 9848d93d52b2b2538d80716d941a914a5253d0f7ef37df367a2088a0310f8d51 |
|
MD5 | fcb2287cfd44a0ed0566f13c6264b83f |
|
BLAKE2b-256 | 89cd28e260a5abd961ea97da5ba3b8518456e041205afc7021a925375f87a7ba |