Skip to main content

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.

Bloch Sphere Example

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 coordinates
    • theta: 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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bloch_sphere_plotter-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

bloch_sphere_plotter-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for bloch_sphere_plotter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9fb7ef2d882046c1707823d975a3574522bfa133d189fc8cc62d9345336ee79c
MD5 f2ee457e9f37f3098ea3eda25f55c80a
BLAKE2b-256 9457e4528be686d22135c7a3ea4a0b7d656a66078a5500d395427f80979a8ba7

See more details on using hashes here.

File details

Details for the file bloch_sphere_plotter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bloch_sphere_plotter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07a721e672a40a78e3302dd6f7a51c1083c4b692db0887910c64ea2a3b741122
MD5 c9527e34c61032b86ae32b7ac4139a79
BLAKE2b-256 b6ae066726e8aab5fa6374915b454e942117bfaec72e6499808fed029e5e00a4

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