Metadata-Version: 2.4
Name: pysampling
Version: 0.2.0
Summary: Sampling methods for design of experiments in Python (random, LHS, Halton, Sobol).
Project-URL: Homepage, https://anyoptimization.com/projects/pysampling
Project-URL: Source, https://github.com/anyoptimization/pysampling
Author-email: Julian Blank <blankjul@outlook.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: design of experiments,halton,latin hypercube,optimization,sampling,sobol
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: numpy>=1.23
Provides-Extra: plot
Requires-Dist: matplotlib>=3.5; extra == 'plot'
Description-Content-Type: text/markdown

# pysampling

[![python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
[![license](https://img.shields.io/badge/license-apache-orange.svg)](https://www.apache.org/licenses/LICENSE-2.0)

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

```bash
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:

```python
from pysampling.sample import sample

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

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

```python
import matplotlib.pyplot as plt

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

See [`examples/plot_sampling.py`](examples/plot_sampling.py) for a runnable demo.

## Development

This project uses [pyclawd](https://github.com/anyoptimization) as its dev
toolkit.

```bash
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/`](docs/)):

```bash
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](https://github.com/anyoptimization/pysampling/issues).

Maintained by [Julian Blank](https://julianblank.com).

## License

Apache License 2.0 — see [LICENSE](LICENSE).
