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.9.tar.gz (16.2 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.9-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blue_sampler-0.1.9.tar.gz
  • Upload date:
  • Size: 16.2 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.9.tar.gz
Algorithm Hash digest
SHA256 bc061677438e1a74c50f739b642e8db021a8af254fd5f7102f66821260fbf1da
MD5 294a8bd86b4a3941374735f4f5ecef36
BLAKE2b-256 fd216624ad406e492250d225cd584571058b1de6a57eea59a6597cc408d6163f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blue_sampler-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 20.3 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e7f831747ce62ab8b74ebe71b34fb2ec00039f7477854042f4310c3c5f174830
MD5 529d628a07c477a50a1632a7bb2e35c5
BLAKE2b-256 f69eaba0212b6acffd4b8f1618162686822fb861628013fa1bcfb191581aa01d

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