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 popy

Quick Start

import popy
import numpy as np

# Calculate the arrival rate of a Poisson hyperplane process
rate_2d = popy.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 = popy.plot_hyperplanes_color_2d(
    radius=10,
    grid_resolution=100,
    colorcutoffs=np.array([0.5]),
    cmap_list=popy.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 = popy.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/popy.git
cd popy
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.0.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.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hyperpopy-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 59cdaf6afc18939f7861a15af04acdf6f7fa91aea00ce8f64fe809a9cf27906b
MD5 6213cfadcfbc933a09f85ee46d0a6250
BLAKE2b-256 b8f6608ebeffb5dd0f6948e3fff9e08b04a63fc2d5d5c060da449cb357e45de1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hyperpopy-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7a2e4b23da502c42f9baf73c9d387d601187e9dde0f1c848c3b717994e1178
MD5 3a15eb70d000cf796043649c2eccc336
BLAKE2b-256 a3cf970e4212988703b9ad17dc147952156c456758ce074e4a7378f4b01b1870

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