Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarumaj/qiskit-state-evolution-recorder
Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.
https://github.com/sarumaj/qiskit-state-evolution-recorder
matplotlib-animation python3 qiskit quantum-computing qubits rendering-engine vizualisation
Last synced: 2 days ago
JSON representation
Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.
- Host: GitHub
- URL: https://github.com/sarumaj/qiskit-state-evolution-recorder
- Owner: sarumaj
- License: bsd-3-clause
- Created: 2024-10-27T13:54:55.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-28T21:44:18.000Z (3 months ago)
- Last Synced: 2025-01-27T11:51:54.380Z (5 days ago)
- Topics: matplotlib-animation, python3, qiskit, quantum-computing, qubits, rendering-engine, vizualisation
- Language: Python
- Homepage: https://pypi.org/project/qiskit-state-evolution-recorder/
- Size: 168 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![release](https://github.com/sarumaj/qiskit-state-evolution-recorder/actions/workflows/release.yml/badge.svg)](https://github.com/sarumaj/qiskit-state-evolution-recorder/actions/workflows/release.yml)
[![GitHub Release](https://img.shields.io/github/v/release/sarumaj/qiskit-state-evolution-recorder?logo=github)](https://github.com/sarumaj/qiskit-state-evolution-recorder/releases/latest)
[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/sarumaj/qiskit-state-evolution-recorder)](https://github.com/sarumaj/qiskit-state-evolution-recorder/blob/main/requirements.txt)---
# qiskit-state-evolution-recorder
Simple module allowing to record animations to trace changes in qubit states for arbitrary quantum circuits.
## Installation
```bash
pip install qiskit-state-evolution-recorder
```## Usage
```python
from qiskit.circuit import QuantumCircuit
from qiskit_state_evolution_recorder import StateEvolutionRecorderqc = 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:
```python
from IPython.display import Videovideo = Video("quantum_circuit.mp4")
video.reload()
video
```https://github.com/user-attachments/assets/8a3c8567-cbb8-4271-9c2c-9588130c01b0