{"id":23116078,"url":"https://github.com/aneeshnaik/lintsampler","last_synced_at":"2025-08-16T21:32:22.037Z","repository":{"id":227290935,"uuid":"753562436","full_name":"aneeshnaik/lintsampler","owner":"aneeshnaik","description":"Efficient random sampling via linear interpolation.","archived":false,"fork":false,"pushed_at":"2024-09-25T14:16:34.000Z","size":56716,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-30T03:54:10.432Z","etag":null,"topics":["low-discrepancy-sequence","numpy","python","random-generation","random-sampling","statistics"],"latest_commit_sha":null,"homepage":"https://lintsampler.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aneeshnaik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-06T11:19:10.000Z","updated_at":"2025-01-30T19:17:12.000Z","dependencies_parsed_at":"2024-03-12T15:49:55.524Z","dependency_job_id":"7d55cd3b-cb75-4c63-a3b8-1c7d0351a3e5","html_url":"https://github.com/aneeshnaik/lintsampler","commit_stats":null,"previous_names":["aneeshnaik/lintsampler"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/aneeshnaik/lintsampler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshnaik%2Flintsampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshnaik%2Flintsampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshnaik%2Flintsampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshnaik%2Flintsampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aneeshnaik","download_url":"https://codeload.github.com/aneeshnaik/lintsampler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshnaik%2Flintsampler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268337894,"owners_count":24234536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["low-discrepancy-sequence","numpy","python","random-generation","random-sampling","statistics"],"created_at":"2024-12-17T04:10:55.150Z","updated_at":"2025-08-16T21:32:21.039Z","avatar_url":"https://github.com/aneeshnaik.png","language":"Python","readme":"# lintsampler\n![Animation showing 'lintsampler' rendered in points.](docs/source/_static/lintsampler.gif)\n\n**Efficient random sampling via linear interpolation.**\n\n[![Test](https://github.com/aneeshnaik/lintsampler/actions/workflows/test.yaml/badge.svg)](https://github.com/aneeshnaik/lintsampler/actions/workflows/test.yaml)\n[![Coverage Status](https://coveralls.io/repos/github/aneeshnaik/lintsampler/badge.svg?branch=main\u0026kill_cache=1)](https://coveralls.io/github/aneeshnaik/lintsampler?branch=main)\n[![Documentation Status](https://readthedocs.org/projects/lintsampler/badge/?version=latest)](https://lintsampler.readthedocs.io/en/latest/?badge=latest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/aneeshnaik/lintsampler/blob/main/LICENSE)\n[![status](https://joss.theoj.org/papers/133f9681a79ab47b916ecee9e183be9e/status.svg)](https://joss.theoj.org/papers/133f9681a79ab47b916ecee9e183be9e)\n\nWhen 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.\n\nSee the [documentation](https://lintsampler.readthedocs.io/) for further details.\n\nThis package was also reviewed for the Journal of Open Source Software (JOSS). See the paper [here](https://joss.theoj.org/papers/133f9681a79ab47b916ecee9e183be9e) and the review thread [here](https://github.com/openjournals/joss-reviews/issues/6906).\n\n## Installation\n\nThree ways of installing `lintsampler`:\n\n- `pip`:\n```\npip install lintsampler\n```\n\n- `conda`:\n```\nconda install -c conda-forge lintsampler\n```\n\n- Simply cloning this repository.\n\n## Quickstart Example\n\nIf you have a density function, such as this multi-modal 1d pdf with the bulk of the density between -7 and 7,\n\n```python\nimport numpy as np\nfrom scipy.stats import norm\n\ndef gmm_pdf(x):\n    mu = np.array([-3.0, 0.5, 2.5])\n    sig = np.array([1.0, 0.25, 0.75])\n    w = np.array([0.4, 0.25, 0.35])\n    return np.sum([w[i] * norm.pdf(x, mu[i], sig[i]) for i in range(3)], axis=0)\n```\n\n`lintsampler` can efficiently draw samples from it on some defined interval (here a 100-point grid between -7 and 7):\n\n```python\nfrom lintsampler import LintSampler\n\ngrid = np.linspace(-7,7,100)\nsamples = LintSampler(grid,pdf=gmm_pdf).sample(N=10000)\n```\n\nMaking 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.\n![Example 1d pdf with comparative histogram of sampled points.](docs/source/assets/example1.png)\n\nSee [this page of the documentation](https://lintsampler.readthedocs.io/en/latest/examples/1_gmm.html) for a more detailed explanation of this example.\n\n## Documentation\n\nComplete documentation, including more example notebooks, is available at [lintsampler.readthedocs.io/](https://lintsampler.readthedocs.io/).\n\n## Contributing\n\nThe `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.\n\n## Attribution\n\nIf using `lintsampler` for a research publication, please cite our [paper](https://joss.theoj.org/papers/133f9681a79ab47b916ecee9e183be9e). \n\n## License\n\n`lintsampler` is available under the MIT license. See the LICENSE file for specifics.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshnaik%2Flintsampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faneeshnaik%2Flintsampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshnaik%2Flintsampler/lists"}