harmonic-measure
Harmonic measure computation and boundary crowding diagnostics for 2D domains.
Overview
Harmonic measure quantifies the "visibility" of boundary subsets from interior points in potential-theoretic terms. This package provides:
- Direct computation of harmonic measure via boundary integral methods
- Corner detection for domains approaching polygonal limits
- Scaling diagnostics to quantify boundary crowding
- Visualization of harmonic measure density on boundaries
Installation
pip install harmonic-measure
# With plotting
pip install harmonic-measure[plot]
Quick Start
from harmonic_measure import HarmonicMeasure
from superellipse import Superellipse
# Create a Lamé domain approaching a rectangle
curve = Superellipse(a=1, b=1, p=32) # p=2n, so n=16
# Compute harmonic measure of a boundary subset
hm = HarmonicMeasure(curve)
omega = hm.measure_subset(
basepoint=[0, 0],
subset_fn=lambda pt: abs(pt[0] - 1) < 0.1 # near corner
)
print(f"Harmonic measure of corner neighborhood: {omega:.6f}")
Theory
Harmonic Measure
For a domain Ω with boundary ∂Ω, the harmonic measure ω_Ω(z, A) of a boundary subset A ⊂ ∂Ω as seen from z ∈ Ω is:
$$\omega_\Omega(z, A) = u_A(z)$$
where u_A solves: Δu = 0 in Ω, u = 1 on A, u = 0 on ∂Ω \ A.
Conformal Invariance
Under a conformal map f: 𝔻 → Ω with f(0) = z:
$$\omega_\Omega(z, A) = \frac{|f^{-1}(A)|}{2\pi}$$
where |·| denotes arc length on ∂𝔻.
Corner Crowding
For polygonal limits with interior angle α, boundary layers of thickness ρ have:
$$\omega \sim \rho^{\pi/\alpha}$$
For right angles (α = π/2): ω ~ ρ² (quadratic crowding)
API Reference
HarmonicMeasure(geometry)
Main class for harmonic measure computations.
| Method | Description |
|---|---|
measure_subset(basepoint, subset_fn) |
Harmonic measure of subset defined by boolean function |
measure_corners(basepoint, radius) |
Harmonic measure of corner neighborhoods |
density(basepoint) |
Harmonic measure density at each boundary node |
plot_density(basepoint) |
Visualize density on boundary |
corner_scaling_diagnostic(curve, ns, c=2.0)
Compute corner harmonic mass across a range of Lamé exponents.
Returns (ns, arc_lengths, fitted_slope).
adaptive_convergence(n, a, c, tol=1e-10)
Adaptively refine discretization until harmonic measure converges.
CLI
# Compute harmonic measure of corner regions
harmonic-measure corners --p 32 --radius 0.1
# Scaling diagnostic across exponents
harmonic-measure scaling --ns 8 16 32 64 --output scaling.csv
# Plot harmonic measure density
harmonic-measure density --p 16 --output density.png
Applications
- Conformal mapping: Diagnose boundary correspondence crowding
- Schwarz-Christoffel limits: Quantify prevertex clustering
- Brownian motion: Exit distribution from domains
- Potential theory: Capacity and extremal length computations
Related Packages
superellipse: Geometry primitivespanel-bie: Boundary integral solvers
References
- Garnett, J.B. & Marshall, D.E. (2005). Harmonic Measure. Cambridge University Press.
- Pommerenke, C. (1992). Boundary Behaviour of Conformal Maps. Springer.
License
MIT License. See LICENSE for details.
Metadata
Release files for harmonic-measure 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| harmonic_measure-1.0.0.tar.gz | 18.1 kB | With provenance | Details for harmonic_measure-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| harmonic_measure-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for harmonic_measure-1.0.0-py3-none-any.whl |
Total release size: 30.2 kB
Release files / harmonic_measure-1.0.0.tar.gz
| Download URL | harmonic_measure-1.0.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dad30659ec50b36787bcccaaa86fba5f48dd7c46af835d6dcaa27d29480008dc
|
|
BLAKE2b-256 checksum How to use checksums |
b12b926f8def3cb3b8511fe7b3238fff3a178e7cf8f854a8a3849b9fb5c39719
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logRelease files / harmonic_measure-1.0.0-py3-none-any.whl
| Download URL | harmonic_measure-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d47add24211858d1aff385b5de31ee83850635c1736bbde49f9b88a32ce158ec
|
|
BLAKE2b-256 checksum How to use checksums |
2724110eb860fcc6716f6a844d7ca553c47a44ca809411b458df7ab71a40c995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logSecurity for harmonic-measure 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for harmonic_measure-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.