blue_sampler.sample_points

blue_sampler.sample_points(N=32768, D=2, bruteforce=False, warmstart=None, n_iter=6, targets=None, verbose=1)[source]

Generate N stealthy (blue-noise) points in [0, 1)^D.

Parameters:
  • N (int) – Number of output points.

  • D (int) – Spatial dimension.

  • bruteforce (bool) – Use the bruteforce O(N^2) algorithm instead of the recursive one. Gives a better sample but is intractable for N >= 50_000. Automatically forced to True when N <= 2_000.

  • warmstart (str | NDArray | None) –

    Initial point configuration. - None : default random/recursive initialisation. - “Sobol” : initialise with a Sobol low-discrepancy sequence

    (requires scipy.stats.qmc.Sobol).

    • ndarray : use given points as the starting configuration.

  • n_iter (int) – Number of solver iterations. Each iteration runs 10 gradient steps plus a structural gridification step (neighbor lookup). More iterations = better quality but slower.

  • targets (NDArray | None) – Atoms describing a target density. can also be a path to an image, e.g. targets = “zebra.jpg”

  • verbose (int) – 0 = silent, 1 = live progress.

Returns:

points – The sampled point coordinates in [0, 1)^D.

Return type:

NDArray