Skip to main content

Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.

Project description

release GitHub Release Libraries.io dependency status for GitHub repo


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

qiskit_state_evolution_recorder-0.2.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file qiskit_state_evolution_recorder-0.2.0.tar.gz.

File metadata

File hashes

Hashes for qiskit_state_evolution_recorder-0.2.0.tar.gz
Algorithm Hash digest
SHA256 33d386f8c30ca7e4e1a5f0a867310c2d1dcc501f35a1a2b43288e6db1b35319b
MD5 dfb1d8c2632ff726c1273719bc13794a
BLAKE2b-256 802e8d9be955f763a4fc5a1695ced7b197246d7004b799377916916bfa69abff

See more details on using hashes here.

File details

Details for the file qiskit_state_evolution_recorder-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_state_evolution_recorder-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5809c83f75f6c27748afe0c683b5ad3c2f114a850134b7752fb5ee98b50e5dc
MD5 00451f3b9e0b12774205e7ad1d9d085f
BLAKE2b-256 e3e2c38f5f0ba7ace1c4580722a046324d8166f0798068b11923a9dd3964ec6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page