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
Testing
Running Tests
The project includes both unit tests and performance tests. Performance tests can be run optionally.
# Run all tests except performance tests
python -m pytest --benchmark-skip
# Run all tests including performance tests
python -m pytest --benchmark-enable
# Run only performance tests
python -m pytest --benchmark-enable --benchmark-only
Backend Support
The library supports multiple animation backends:
- FFmpeg (default, preferred): Uses matplotlib's FuncAnimation with FFmpeg
- OpenCV: Uses OpenCV for video creation (fallback when FFmpeg is not available)
The system automatically selects the best available backend. To install additional backends:
# Install OpenCV backend
pip install opencv-python
# Install FFmpeg (system-dependent)
# Ubuntu/Debian: sudo apt-get install ffmpeg
# macOS: brew install ffmpeg
# Windows: Download from https://ffmpeg.org/download.html
Metadata
Release files for qiskit-state-evolution-recorder 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qiskit_state_evolution_recorder-1.0.5.tar.gz | 26.2 kB | Without provenance | Details for qiskit_state_evolution_recorder-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qiskit_state_evolution_recorder-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for qiskit_state_evolution_recorder-1.0.5-py3-none-any.whl |
Total release size: 51.4 kB
Release files / qiskit_state_evolution_recorder-1.0.5.tar.gz
| Download URL | qiskit_state_evolution_recorder-1.0.5.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
856f486a9a1685fceff18a860e03bfd4650b155605e872337a4d51443872ebf5
|
|
BLAKE2b-256 checksum How to use checksums |
5ef5643fb39e93fd0dd4214e7f656498e0fa1a43ef9365d1314a739cdc103d92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / qiskit_state_evolution_recorder-1.0.5-py3-none-any.whl
| Download URL | qiskit_state_evolution_recorder-1.0.5-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18a4b37e5c9f087994988bc2226fec3ce1479b8d6f275a9b8c456a8e78055aea
|
|
BLAKE2b-256 checksum How to use checksums |
95c3472d6c97446a0b1aceda4178a711d8cd6bf51e06341df82d37bce5dc0545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for qiskit-state-evolution-recorder 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.