Skip to main content

pysampling

python license

Sampling methods for design of experiments in Python. pysampling generates well-spread point sets in the unit hypercube [0, 1]^d and provides a suite of measures to assess their uniformity.

Detailed documentation: https://anyoptimization.com/projects/pysampling

Algorithms

Key Method
random Uniform random sampling
lhs Latin Hypercube Sampling
halton Halton sequence
sobol Sobol sequence
riesz Riesz s-energy (maximin)

Installation

pip install -U pysampling

Usage

Import the sample function and pick an algorithm. Here we draw 50 points in 2 dimensions with Latin Hypercube Sampling:

from pysampling.sample import sample

X = sample("lhs", 50, 2)

To visualize the result (requires the optional plot extra, pip install pysampling[plot]):

import matplotlib.pyplot as plt

plt.scatter(X[:, 0], X[:, 1], s=30, facecolors="none", edgecolors="r")
plt.show()

See examples/plot_sampling.py for a runnable demo.

Development

This project uses pyclawd as its dev toolkit.

pip install -e . --group dev
pyclawd check        # format-check -> lint -> typecheck -> test
pyclawd test fast    # quick test run

Documentation

The docs are built by a cached pipeline (see docs/):

pip install -e . --group docs   # one-time: install the docs toolchain
pyclawd docs build              # compile -> execute (cached) -> render HTML
pyclawd docs serve              # serve docs/build/html locally

Contact

Questions, bugs, or feature requests? Please open an issue on GitHub.

Maintained by Julian Blank.

License

Apache License 2.0 — see LICENSE.

Release files for pysampling 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysampling 0.2.0
File Size Uploaded
pysampling-0.2.0.tar.gz 3.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysampling 0.2.0
File Interpreter ABI Platform
pysampling-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.5 MB

Release files / pysampling-0.2.0.tar.gz

Download URL pysampling-0.2.0.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c6739e87d16d65fa03df105d9067b010107bc5e93618c7612cec25c210fa2d0a
BLAKE2b-256 checksum
How to use checksums
39b290cf1c318d4b2c08ee36ec1284a223eb8ef14f108fef4c1905910ddd1a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / pysampling-0.2.0-py3-none-any.whl

Download URL pysampling-0.2.0-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
824378a25793b3ad09eb26f19ed5deafa2a0995d25dfde70155bfedfd7ee392f
BLAKE2b-256 checksum
How to use checksums
541804c8501d6e95ed3802903965d329fad07cf6a0245d0bad6cb8b701889dac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page