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
Metadata
Release files for bloch-sphere-plotter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bloch_sphere_plotter-0.1.0.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bloch_sphere_plotter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / bloch_sphere_plotter-0.1.0.tar.gz
| Download URL | bloch_sphere_plotter-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fb7ef2d882046c1707823d975a3574522bfa133d189fc8cc62d9345336ee79c
|
|
BLAKE2b-256 checksum How to use checksums |
9457e4528be686d22135c7a3ea4a0b7d656a66078a5500d395427f80979a8ba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / bloch_sphere_plotter-0.1.0-py3-none-any.whl
| Download URL | bloch_sphere_plotter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07a721e672a40a78e3302dd6f7a51c1083c4b692db0887910c64ea2a3b741122
|
|
BLAKE2b-256 checksum How to use checksums |
b6ae066726e8aab5fa6374915b454e942117bfaec72e6499808fed029e5e00a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|