Skip to main content

PyPI Docs GitHub Open in Colab

blue-sampler

Generate large stealthy point patterns on the unit torus $[0, 1)^D$. 📐

Stealthy point patterns exhibit vanishing density fluctuations at low frequencies, making them particularly suited for Monte Carlo integration 🎯, image stippling, and any application requiring well-distributed, low-discrepancy points.

The main blue-noise samplers (RGBN and NUFFT) offer linear complexity in both the number of points and the dimension. ⚡
They can generate e.g. 1 million 2D points in under 15 minutes on a standard CPU, and up to 30× faster on GPU.

Note: Most implemented methods support adaptive sampling from a target distribution.


📦 Installation

pip install blue-sampler

Quick Start

import blue_sampler as blue

# Generate 10,000 2D blue-noise points
x = blue.sample_points(N=10_000, D=2)
blue.plot(x) 📈

# Structure factor
blue.plot_structure_factor(x) 📊

# Image stippling
x = blue.im2points("zebra.jpg") 🖼️

🖼️ Example

Blue noise stippling example


📋 Available Samplers

Main sampling methods

x = blue.sample_points(N, D, method="rgbn") #(N, D)
Method Description
rgbn Recursive Gaussian-Blue Noise 🔄
nufft Non-Uniform Fast Fourier Transform 📈
bruteforce Base GBN sampler (best quality, slower)

Alternative Samplers

Sobol sequence

x = blue.sobol(N, D) #(N, D)

Low-discrepancy quasi-random sequence. 📏

STIT Tessellations

# Raw STIT tessellation (quadrilaterals)
ts = blue.sample_tessels(N, D) #(N, 4, 2)
blue.plot_tessels(ts) 🧩

# Convert to point set
x = blue.tessel2points(ts) #(N, m, 2)

Clusters

# Raw clusters
cl = blue.sample_clusters(N, D) #(N, K, 2)
blue.plot_clusters(cl) 🔗

# Convert to point set
x = blue.cluster2points(cl) #(N, m, 2)

Pinwheel Tilings

# Base pinwheel triangle
pw0 = blue.pinwheel_base() 𖣘 #(3, 2)

# Triangulation level 4
pw4 = blue.pinwheel_transform(pw0, depth=4) #(4*5**depth, 3, 2)
blue.plot_polygons(pw4) 🔺

#===============================
# Convert Pinwheel to point set:
#===============================
#sample points from the BASE pinwheel
x0 = blue.tessel2points(pw0) #(m, 2)
#then replicate the sample on the full triangulation,
#in a fractal way
x4 = blue.pinwheel_transform(x0) #(4*5**depth, m, 2)

Note: The conversion from geometric objects (polygons or clusters) to point sets is performed using a standard moment matching technique. cluster2points(x, p = 3) and tessel2points(x, p = 3) will sample m points per batch that mimic the statistical {0, 1, ... p-1} moments of the batch.


Supported Dimensions

Dimension Status
2–3D Fast ⚡
4–5D Supported
≥6D Experimental 🧪

Documentation & Links 🔗


📚 References

The algorithms and mathematical tools implemented in blue-sampler are based or inspired from the following works.

  • Gaussian Blue Noise (repulsive interaction kernel)
    A. G. M. Ahmed, J. Ren, and P. Wonka.
    Gaussian Blue Noise.
    ACM Transactions on Graphics (SIGGRAPH Asia), 41(6), 2022.
    DOI: 10.1145/3550454.3555519

  • FReSCo (Non uniform FFT)
    A. Shih, M. Casiulis, and S. Martiniani.
    Fast Generation of Spectrally-Shaped Disorder.
    Physical Review E, 110(3):034122, 2024.
    DOI: 10.1103/PhysRevE.110.034122

  • STIT tessellations and moment matching
    L. Lotz and M. A. Klatt.
    Persistence of asymptotic variance under transport: from hyperfluctuation to stealthy hyperuniformity.
    arXiv:2605.22803, 2026.

  • Aperiodic tiling for hyuperuniformity (here pinwheel)
    S. Torquato and F. H. Stillinger.
    Local density fluctuations, hyperuniformity, and order metrics.
    Physical Review E, 68(4):041113, 2003.

  • SquareNet (v1.3.11). 2026.
    Grid data structure for point clouds, codeveloped with RGBN
    for efficient neighbor query and fourier trnasform in Python.

  • Sobol sequences
    Wrapped from scipy.stats.qmc.Sobol (SciPy).


License

MIT

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-1.2.1.tar.gz (5.3 MB view details)

Uploaded Source

Built Distribution

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

blue_sampler-1.2.1-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for blue_sampler-1.2.1.tar.gz
Algorithm Hash digest
SHA256 981c143cf193d48b1e0c0d2bc1794df32bca697bf0fe7b012b61495780c25668
MD5 5a4e359bbc7624ceb626d3fcb14657c1
BLAKE2b-256 f190d7d9ff13c863e8956b5be4e9b6afbc4a277c2d48e1023bea429c68b80e88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blue_sampler-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 43.7 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-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb84120ed9ddded4631147a353cc1ef69e244e5a290a0283b4fdbd82bfb24075
MD5 0a8829aa9d2cff93e94c25e4ccfcf8aa
BLAKE2b-256 c4f45baa36d1b0eeb7c857dc0fc92776c106bac66f8016ab6d564e7628855fc3

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

This release

1.2.1 This release

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page