{"id":50273359,"url":"https://github.com/dgoeries/downsample","last_synced_at":"2026-05-27T18:32:51.793Z","repository":{"id":260924306,"uuid":"881477850","full_name":"dgoeries/downsample","owner":"dgoeries","description":"Downsampling algorithms for Python written in C","archived":false,"fork":false,"pushed_at":"2025-12-29T08:28:27.000Z","size":493,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T06:32:28.931Z","etag":null,"topics":["c-implementation","downsampling","ltd","ltob","lttb","performance","python"],"latest_commit_sha":null,"homepage":"","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/dgoeries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-31T16:46:10.000Z","updated_at":"2025-12-29T08:28:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"404dafa4-fb3a-4d29-817c-23cfedb40e55","html_url":"https://github.com/dgoeries/downsample","commit_stats":null,"previous_names":["dgoeries/downsample"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dgoeries/downsample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgoeries%2Fdownsample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgoeries%2Fdownsample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgoeries%2Fdownsample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgoeries%2Fdownsample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgoeries","download_url":"https://codeload.github.com/dgoeries/downsample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgoeries%2Fdownsample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33579665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["c-implementation","downsampling","ltd","ltob","lttb","performance","python"],"created_at":"2026-05-27T18:32:50.905Z","updated_at":"2026-05-27T18:32:51.786Z","avatar_url":"https://github.com/dgoeries.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# downsample: Collection of downsample algorithms for Python (Python using a C implementation) [![PyPi](https://img.shields.io/pypi/v/downsample?color=blue)](https://pypi.org/project/downsample/) [![PyPI Downloads](https://img.shields.io/pypi/dm/downsample.svg?label=PyPI%20downloads)](https://pypi.org/project/downsample/)\n\nThis packages includes low level implementations written in C-Python of:\n\n- The `Largest Triangle Dynamic Buckets` (`LTD`) downsampling algorithm\n- The `Largest Triangle Three Buckets` (`LTTB`) downsampling algorithm\n- The `Largest Triangle One Bucket` (`LTOB`) downsampling algorithm\n\nThe algorithm of `LTTB` was initially developed in (https://github.com/dgoeries/lttbc.git)\nParts of this code have been translated and refers to the work of:\n\n- Ján Jakub Naništa (https://github.com/janjakubnanista/downsample) (Typescript)\n- Hao Chen (https://github.com/haoel/downsampling) (Go)\n\nThe algorithms are described in the work of Sveinn Steinarsson (https://github.com/sveinn-steinarsson/flot-downsample/).\n\n## Demo and 'Known Issues'\n\nThe examples show the efficiency of the downsampling algorithm with a data set of ``7500``\ndata points down sampled to ``500`` points.\n\n![SampleView](images/data.png)\n![Close View](images/closedata.png)\n\nKnown features and requirements:\n\n- The algorithm requires that x data is increasing and finite.\n- y data must be finite; otherwise, issues may arise.\n- x and y data must have the same length.\n- The downsample algorithm returns a tuple of two arrays with data type *double*\n\n## Installing\n\nYou can also install it [from PyPI](https://pypi.org/project/downsample/)\nto use in other environments with Python 3.10 or later:\n\n    pip install downsample\n\n## How to use on the field\n\nAll functions take an input for ``x`` and ``y`` in addition to the ``threshold``:\n\n    from downsample import ltob, lttb, ltd\n    import numpy as np\n\n    array_size = 10000\n    threshold = 1000\n\n    x = np.arange(array_size, dtype=np.int32)\n    y = np.random.randint(1000, size=array_size, dtype=np.uint64)\n\n    x_l = x.tolist()\n    y_l = y.tolist()\n\n    for func in {ltd, ltob, lttb}:\n        nx, ny = func(x, y, threshold)\n        assert len(nx) == threshold\n        assert len(ny) == threshold\n        assert nx.dtype == np.double\n        assert ny.dtype == np.double\n\n        # List data or a mixture is accepted as well!\n        nx, ny = func(x_l, y_l, threshold)\n        assert len(nx) == threshold\n        assert len(ny) == threshold\n        assert nx.dtype == np.double\n        assert ny.dtype == np.double\n\n## Performance Overview\n\nFor a performance overview, a sample of 7.500 data points was analyzed with a\nthreshold set at 500 points. The performance test was conducted on a single core,\nutilizing a base clock speed of 3.70 GHz and 32 MB of L3 cache.\n\n- LTD: 977.2 us\n- LTOB: 61.0 us\n- LTTB: 63.1 us\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgoeries%2Fdownsample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgoeries%2Fdownsample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgoeries%2Fdownsample/lists"}