A tool for plotting quantum states on the Bloch sphere
Project description
Bloch Sphere Plotter
A Python package for visualizing quantum states on the Bloch sphere with high-quality, customizable plots.
Overview
The Bloch sphere is a geometrical representation of the pure state space of a two-level quantum mechanical system (qubit). This package provides tools to easily visualize quantum states on the Bloch sphere using matplotlib.
Features
- Clean, publication-quality Bloch sphere visualizations
- Simple API for plotting quantum states
- Customizable appearance with proper 3D rendering
- Includes coordinate axes, meridian circles, and equator
- Clear state vector representation with directional arrows
Installation
From PyPI
pip install bloch-sphere-plotter
From Source
git clone https://github.com/yourusername/bloch-sphere-plotter.git
cd bloch-sphere-plotter
pip install -e .
Usage
Basic Example
import numpy as np
from bloch_sphere_plotter.plot import plot_bloch_sphere
# Plot a state using spherical coordinates (theta, phi)
plot_bloch_sphere((np.pi/3, np.pi/4))
Parameters
state: A tuple(theta, phi)representing the qubit state in spherical coordinatestheta: Polar angle (0 to π)phi: Azimuthal angle (0 to 2π)
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/yourusername/bloch-sphere-plotter.git
cd bloch-sphere-plotter
# Install development dependencies
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=bloch_sphere_plotter
# Run only tests suitable for CI environments (no GUI)
pytest -m ci
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- The matplotlib team for their excellent 3D plotting capabilities
- The quantum computing community for inspiration
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bloch_sphere_plotter-0.1.0.tar.gz.
File metadata
- Download URL: bloch_sphere_plotter-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb7ef2d882046c1707823d975a3574522bfa133d189fc8cc62d9345336ee79c
|
|
| MD5 |
f2ee457e9f37f3098ea3eda25f55c80a
|
|
| BLAKE2b-256 |
9457e4528be686d22135c7a3ea4a0b7d656a66078a5500d395427f80979a8ba7
|
File details
Details for the file bloch_sphere_plotter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bloch_sphere_plotter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07a721e672a40a78e3302dd6f7a51c1083c4b692db0887910c64ea2a3b741122
|
|
| MD5 |
c9527e34c61032b86ae32b7ac4139a79
|
|
| BLAKE2b-256 |
b6ae066726e8aab5fa6374915b454e942117bfaec72e6499808fed029e5e00a4
|