Skip to main content

Poisson Hyperplane Model Package

Project description

hyperpopy: Poisson Hyperplane Model Package

PyPI version Python 3.8+ License: MIT

A Python package for working with Poisson hyperplane models, providing tools for analytical calculations, generation, visualization, and Monte Carlo simulation of Poisson hyperplane processes.

Features

  • Analytical Calculations: Compute conditional probability functions for color in Poisson hyperplane models
  • Generation & Visualization: Generate and plot realizations of the Poisson hyperplane process
  • Monte Carlo Simulation: Estimate connectivity distributions and color probabilities
  • Probability Landscapes: Visualize conditional probability functions and convergence analysis
  • Multi-dimensional Support: Works in 1D, 2D, and 3D spaces

Installation

pip install hyperpopy

Quick Start

import hyperpopy
import numpy as np

# Calculate the arrival rate of a Poisson hyperplane process
rate_2d = hyperpopy.rate(2, 1.0)  # 2D, radius 1.0
print(f"2D Poisson rate: {rate_2d}")

# Generate a 2D visualization of the Poisson hyperplane process
fig = hyperpopy.plot_hyperplanes_color_2d(
    radius=10,
    grid_resolution=100,
    colorcutoffs=np.array([0.5]),
    cmap_list=hyperpopy.frozen_lake_colors
)

# Calculate color distribution for given points
points = np.array([[0, 0], [1, 0], [0, 1]])
colors = (0, 1, 0)  # Known colors for first two points
color_dist = (0.5, 0.5)  # Equal probability for each color

prob_dist = hyperpopy.color_distribution(points, colors, color_dist)
print(f"Color probabilities: {prob_dist}")

Key Functions

Analytical Utilities

  • rate(dimension, radius): Calculate Poisson hyperplane arrival rate
  • color_distribution(points, colors, color_dist): Compute conditional color probabilities
  • hitrate_1d/2d/3d(points): Calculate hit rates for convex hulls
  • slash_rates(points): Return rates of hyperplane partitions

Generation & Visualization

  • sample_from_ball(dimension, num_points): Sample points from unit ball
  • plot_hyperplanes_color_2d(): Generate 2D Poisson hyperplane visualizations
  • hyperplane_partition(points, gridpoints): Partition space using hyperplanes

Monte Carlo Simulation

  • monte_carlo_hyperplane_partitions(): Estimate connectivity distributions
  • plot_mc_colors_with_errorbars(): Plot convergence with error bars
  • probability_landscape(): Visualize probability landscapes in 2D/3D

Examples

See the examples/ directory for comprehensive examples including:

  • Figure generation from research papers
  • Monte Carlo convergence analysis
  • Probability landscape visualization
  • Chord length statistics

Requirements

  • Python 3.8+
  • NumPy >= 1.20.0
  • SciPy >= 1.7.0
  • Matplotlib >= 3.3.0
  • scikit-learn >= 1.0.0
  • Numba >= 0.50.0

Development

To install in development mode:

git clone https://github.com/AlecShelley/hyperpopy.git
cd hyperpopy
pip install -e .

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this package in your research, please cite:

@software{hyperpopy2024,
  title={HyperPopy: Poisson Hyperplane Model Package},
  author={Alec Shelley},
  year={2024},
  url={https://github.com/AlecShelley/hyperpopy}
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links

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

hyperpopy-0.1.1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

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

hyperpopy-0.1.1-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file hyperpopy-0.1.1.tar.gz.

File metadata

  • Download URL: hyperpopy-0.1.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for hyperpopy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 189e292e95677b922cfba0a1d495ee94aecb9d2f04e03d9a22e3ebd6a4ee2d5c
MD5 3835fadc8e1115bf41c962d225fa4b4a
BLAKE2b-256 7c0d9cd7e54b095f348c2ee683aea39c33adeffd43ea71459f65e4b8363c345e

See more details on using hashes here.

File details

Details for the file hyperpopy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hyperpopy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for hyperpopy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40052a6edb3aff476dd8f1da65623834861ee00ecd6ef1a009466ee27b0a227d
MD5 a07040e8e194aca4cc5a54a2ce055dd3
BLAKE2b-256 a781f828597826bee1e33dcf1fa7a7bd03066ef8fcc6db958cd70249b6bb8e2a

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