qmc-sampler
Quasi-Monte Carlo point sampling from spectral optimisation.
qmc-sampler is a lightweight wrapper around blue_sampler that provides several sampling methods for generating quasi-Monte Carlo (QMC) point sets, by minimising the spectral loss over all wave vectors within an exclusion region. 3 kinds of exclusion regions, with different geometrical shape, are available: l2, l1, wd.
Installation
Install from PyPI:
pip install qmc-sampler
Available sampling methods
The package provides three sampling methods:
sample_l2(N, D, **kwargs)— uses a classical isotropic L_2-ball as the spectral exclusion region.sample_l1(N, D, **kwargs)— uses an L_1-ball, producing an anisotropic spectral exclusion region that can be useful when exploiting low effective dimensionality.sample_wd(N, D, **kwargs)— uses the wrap-around discrepancy (WD), a criterion designed to further exploit low-effective-dimensionality structure.
Here, N denotes the number of points and D the dimension.
Basic usage
from qmc_sampler import sample_l1, sample_l2, sample_wd
N = 1000
D = 2
points_l2 = sample_l2(N, D)
points_l1 = sample_l1(N, D)
points_wd = sample_wd(N, D)
Additional keyword arguments e.g. "Chi = 0.4" can be passed to the sampling functions and forwarded to the underlying implementation.
Accelerated L2 sampling with FINUFFT
For supported 2D and 3D problems, blue_sampler provides an accelerated NUFFT-based implementation that can reduce the computational complexity from approximately O(N^2) to O(N\log N).
This backend requires a compatible GPU environment and additional dependencies. Install the appropriate extras supported by your version of blue_sampler, for example:
pip install "blue-sampler[gpu13]"
To use the accelerated backend, overwright the default sample_l2 implementation with:
def sample_l2(N, D, **kwargs):
from blue_sampler.run.run_nufft import _nufft_pipeline
kwargs.setdefault("verbose", 0)
return _nufft_pipeline(N, D, **kwargs)
Plotting utilities
The package also exposes plotting functions from blue_sampler:
from qmc_sampler import plot, plot_structure_factor
plot(...)
plot_structure_factor(...)
Refer to the upstream documentation for the accepted arguments.
Links
- Source code: hyperuniform-samplers on GitHub
- Underlying package: blue_sampler on PyPI
- Upstream repository: Recursive Gaussian Blue Noise
- Documentation: blue-sampler.readthedocs.io
License
MIT
Metadata
Release files for qmc-sampler 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| qmc_sampler-2.0.1.tar.gz | 8.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qmc_sampler-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / qmc_sampler-2.0.1.tar.gz
| Download URL | qmc_sampler-2.0.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d04fdf7c599c437f06ad4cdc4240f561e5e9f8bdb93f8181740f4d83c65b163
|
|
BLAKE2b-256 checksum How to use checksums |
45aa4045bb7bf346d77a15972f7f8a786e037f8ba130db51fa304875a1d16bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / qmc_sampler-2.0.1-py3-none-any.whl
| Download URL | qmc_sampler-2.0.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d49b43200722f37a2ea1e4e25403119009df6408f55d7215d65ba0e07d51f0f3
|
|
BLAKE2b-256 checksum How to use checksums |
5b40fc76b241ad84da469fe472eddd5553865accad311c6c2eb4b1b1b43bea9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for qmc-sampler 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.