Skip to main content

Stealthy point-pattern sampling on the unit torus

Project description

blue-sampler

Generate stealthy point patterns — low-discrepancy, spectrally isotropic samples on the unit torus [0, 1)^D.

Stealthy patterns suppress long-range density fluctuations while remaining aperiodic. They are useful in rendering, quadrature, and computational physics wherever quasi-random, isotropic spatial coverage is needed.

Installation

pip install blue_sampler

Quick start

import blue_sampler as blue

# 10 000 points in 2-D
x = blue.sample_points(10_000)
blue.plot(x)
blue.plot_structure_factor(x)

# 3-D
x = blue.sample_points(5_000, D=3)

# Tessels (only supports 2D and  N has to be a power of 2)
quad = blue.sample_tessels(N=2**10)

Supported dimensions

D Notes
2 Fast, recommended for exploration
3 ~3× slower than 2-D
4/5 Requires more iterations
>= 6 Only with bruteforce method and thus for small sample size (<10_000 points)

Algorithm overview

The pipeline alternates between:

  1. Spatial gradient — short-range Gaussian repulsion via neighbour convolution on the torus.
  2. Spectral gradient — minimises the structure factor S(k) for k below a chosen cut-off, using a set of all the wave vectors within an integer half-ball.
  3. Grid assignment (SquareNet) — periodic re-assignment to a regular grid for efficient sparse local operations.

For N ≤ Z 000 a direct O(N²) bootstrap is used. For larger N a hierarchical strategy clones and refines a coarser solution.

License

MIT

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

blue_sampler-0.1.8.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

blue_sampler-0.1.8-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file blue_sampler-0.1.8.tar.gz.

File metadata

  • Download URL: blue_sampler-0.1.8.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for blue_sampler-0.1.8.tar.gz
Algorithm Hash digest
SHA256 47ea463e709553b1583a8a1b40993cbd84e4c8842b746025e535a2d635a4e930
MD5 2224b1d0aeec3d2c6864e0eb2883b638
BLAKE2b-256 dad0e593cf32059e4428f93fe319954ce1e63fa418cb6be14d3481f8091b265c

See more details on using hashes here.

File details

Details for the file blue_sampler-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: blue_sampler-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for blue_sampler-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5c198180b8f9490cb170dd5630c7b4697c0d03a83a5ac5cddfbac14583a14e
MD5 443011c769805b6f930de660ec0483b4
BLAKE2b-256 4b7c207a5ac3fa576a84bb7e6d2933a46bbb9d51314649d3db02a15f4a8cd96c

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