rusampling
lynnejewson.github.io/rusampling
A Python package for Ratio-of-Uniforms sampling in multiple dimensions.
Ratio-of-Uniforms is a method of sampling random variables that uses the pdf, which does not need to be normalised, and requires minimal setup.
Install from the terminal with pip install RUSampling.
Development of this package was funded by the Lighthill Risk Network: https://lighthillrisknetwork.org.
Many thanks to Paul Northrop, the author of RUST, the package for Ratio-of-Uniforms sampling in R, and who helped me with the development of this project.
Usage
- Create an instance of the Ru class, passing the log-pdf logf, the dimension d (default 1), and any extra arguments that the log-pdf takes.
- Call this object's rvs method, passing the number of samples n to generate. This returns a (n, d)- dimensional numpy array of samples.
Example: Sampling the log-normal distribution
import numpy as np
import scipy
from ru import Ru
logf = scipy.stats.lognorm.logpdf
t = Ru(logf, s=1)
samples = t.rvs(n=100000)
t.plot()
Metadata
Release files for rusampling 0.0.5
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 | Actions |
|---|---|---|---|---|
| rusampling-0.0.5.tar.gz | 10.8 kB | Without provenance | Details for rusampling-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rusampling-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for rusampling-0.0.5-py3-none-any.whl |
Total release size: 23.4 kB
Release files / rusampling-0.0.5.tar.gz
| Download URL | rusampling-0.0.5.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2104b9583930de980474edc4c7f2e2b67ce9583bc3efdf93cc3984b19650d944
|
|
BLAKE2b-256 checksum How to use checksums |
3b86dd093605122b7dce5277d72c57bfb3bcd5f5db500b4b07e752d0b2eaf32f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / rusampling-0.0.5-py3-none-any.whl
| Download URL | rusampling-0.0.5-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6247fb6cf5c2343a74c15eca811811953d7f704085df1eb1fa958268283a500d
|
|
BLAKE2b-256 checksum How to use checksums |
0d35abaaa4b658569a7b5de5d5a3fa4bf1b1ab183f616afc9c434dcb3e51564b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for rusampling 0.0.5
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.