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(10_000)
blue.plot(x)
blue.plot_structure_factor(x)

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

Supported dimensions

D Notes
2 Fast, recommended for exploration
3 ~3× slower than 2-D
4 Requires more iterations (set automatically by Config.auto)
5 Experimental

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 ≤ 3 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.5.tar.gz (11.6 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.5-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blue_sampler-0.1.5.tar.gz
  • Upload date:
  • Size: 11.6 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.5.tar.gz
Algorithm Hash digest
SHA256 17ca48cb6a3a426b274a08e7701cbc418ea75ae69f9bf1a2939be8b12bea946c
MD5 c7c14951f9cb1f3b55a2a5eab322a985
BLAKE2b-256 a95ee4ef8eee0f27f39c4f50f4d09719aa89bd76bcfcc37e3603c03cf4a6a3d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blue_sampler-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1bd40585c080fccbaf2ccdd609e846a2cf32032694563874cac871991ad2853d
MD5 c5a39aebea503e12a945d3262ddf4b6e
BLAKE2b-256 b4c1fcc31fd781a4b2518e63bd3c871d013d3351dd3e2570829e4b6327b06e1b

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