lintsampler
lintsampler: Easy random sampling via linear interpolation - Published in JOSS (2024)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Repository
Efficient random sampling via linear interpolation.
Basic Info
- Host: GitHub
- Owner: aneeshnaik
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://lintsampler.readthedocs.io
- Size: 54.1 MB
Statistics
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 1
- Releases: 6
Topics
Metadata Files
README.md
lintsampler

Efficient random sampling via linear interpolation.
When you have a density function, but you would like to create a set of sample points from that density function, you can use linear interpolate sampling. Using the evaluation of the density at the two endpoints of 1D interval, or the four corners of a 2D rectangle, or generally the $2^k$ vertices of a $k$-dimensional hyperbox (or a series of such hyperboxes, e.g., the cells of a $k$-dimensional grid), linear interpolant sampling is a technique to draw random samples within the hyperbox. lintsampler provides a Python implementation of this.
See the documentation for further details.
This package was also reviewed for the Journal of Open Source Software (JOSS). See the paper here and the review thread here.
Installation
Three ways of installing lintsampler:
pip:pip install lintsamplerconda:conda install -c conda-forge lintsamplerSimply cloning this repository.
Quickstart Example
If you have a density function, such as this multi-modal 1d pdf with the bulk of the density between -7 and 7,
```python import numpy as np from scipy.stats import norm
def gmm_pdf(x): mu = np.array([-3.0, 0.5, 2.5]) sig = np.array([1.0, 0.25, 0.75]) w = np.array([0.4, 0.25, 0.35]) return np.sum([w[i] * norm.pdf(x, mu[i], sig[i]) for i in range(3)], axis=0) ```
lintsampler can efficiently draw samples from it on some defined interval (here a 100-point grid between -7 and 7):
```python from lintsampler import LintSampler
grid = np.linspace(-7,7,100) samples = LintSampler(grid,pdf=gmm_pdf).sample(N=10000) ```
Making a histogram of the resulting samples and comparing to the input density function shows good agreement -- and we can do even better by increasing the resolution.

See this page of the documentation for a more detailed explanation of this example.
Documentation
Complete documentation, including more example notebooks, is available at lintsampler.readthedocs.io/.
Contributing
The lintsampler maintainers welcome contributions to software, examples, and documentation. The maintainers are actively monitoring pull requests and would be happy to collaborate on contributions or ideas. If you have any requests for additional information or find any bugs, please open an issue directly.
Attribution
If using lintsampler for a research publication, please cite our paper.
License
lintsampler is available under the MIT license. See the LICENSE file for specifics.
Owner
- Name: Aneesh Naik
- Login: aneeshnaik
- Kind: user
- Website: https://aneeshnaik.github.io/
- Repositories: 3
- Profile: https://github.com/aneeshnaik
JOSS Publication
lintsampler: Easy random sampling via linear interpolation
Authors
Tags
statistics numpy random variates random sampling low discrepancy sequenceGitHub Events
Total
- Issues event: 3
- Watch event: 8
- Issue comment event: 3
- Fork event: 1
Last Year
- Issues event: 3
- Watch event: 8
- Issue comment event: 3
- Fork event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Aneesh Naik | 4****k | 218 |
| michael-petersen | p****s@g****m | 58 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 7
- Total pull requests: 9
- Average time to close issues: 3 months
- Average time to close pull requests: 14 days
- Total issue authors: 4
- Total pull request authors: 3
- Average comments per issue: 1.71
- Average comments per pull request: 1.56
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 2
- Average time to close issues: 3 months
- Average time to close pull requests: 5 days
- Issue authors: 2
- Pull request authors: 2
- Average comments per issue: 1.5
- Average comments per pull request: 1.5
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- vankesteren (4)
- charlieprior (1)
- matt-graham (1)
- WuShichao (1)
Pull Request Authors
- michael-petersen (10)
- aneeshnaik (6)
- jbytecode (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 72 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 7
- Total maintainers: 1
pypi.org: lintsampler
Efficient random sampling via linear interpolation.
- Homepage: https://github.com/aneeshnaik/lintsampler
- Documentation: https://lintsampler.readthedocs.io
- License: MIT License
-
Latest release: 1.0.0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- sphinx_rtd_theme *
