{"id":13561063,"url":"https://github.com/secomind/ex_lttb","last_synced_at":"2025-12-11T23:47:54.531Z","repository":{"id":62429215,"uuid":"124531360","full_name":"secomind/ex_lttb","owner":"secomind","description":"An Elixir downsampling library that retains the visual characteristics of your data","archived":false,"fork":false,"pushed_at":"2018-03-23T14:19:43.000Z","size":39,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T00:13:04.898Z","etag":null,"topics":["downsampling","elixir"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/secomind.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}},"created_at":"2018-03-09T11:21:39.000Z","updated_at":"2025-04-21T21:45:36.000Z","dependencies_parsed_at":"2022-11-01T20:04:17.476Z","dependency_job_id":null,"html_url":"https://github.com/secomind/ex_lttb","commit_stats":null,"previous_names":["ispirata/ex_lttb"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secomind%2Fex_lttb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secomind%2Fex_lttb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secomind%2Fex_lttb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secomind%2Fex_lttb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/secomind","download_url":"https://codeload.github.com/secomind/ex_lttb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251602831,"owners_count":21615969,"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","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":["downsampling","elixir"],"created_at":"2024-08-01T13:00:52.154Z","updated_at":"2025-12-11T23:47:54.505Z","avatar_url":"https://github.com/secomind.png","language":"Elixir","funding_links":[],"categories":["Actors"],"sub_categories":[],"readme":"# ExLTTB [![hex.pm version](https://img.shields.io/hexpm/v/ex_lttb.svg)](https://hex.pm/packages/ex_lttb) [![Build Status](https://travis-ci.org/ispirata/ex_lttb.svg?branch=master)](https://travis-ci.org/ispirata/ex_lttb) [![Coverage Status](https://coveralls.io/repos/github/ispirata/ex_lttb/badge.svg)](https://coveralls.io/github/ispirata/ex_lttb)\n\nAn Elixir downsampling library that retains the visual characteristics of your data.\n\nExLTTB is based on [Largest-Triangle-Three-Buckets](https://skemman.is/handle/1946/15343) (LTTB) and it contains two implementation modules: `ExLTTB` implements the original algorithm using `Enum` and eager evaluation, `ExLTTB.Stream` implements a slightly modified version to cope with lazy evaluation and using `Stream`.\n\nThe data is assumed to be ordered by its x coordinate in both implementations.\n\n## Installation\n\nAdd `ex_lttb` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_lttb, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\n## Documentation\n\nYou can read the documentation on [HexDocs](https://hexdocs.pm/ex_lttb).\n\n## Examples\n\n```elixir\n# Downsample a list of data in the default shape of %{x: x, y: y}\ninput_samples = for x \u003c- 1..100, do: %{x: x, y: :random.uniform() * 100}\n\n# 30 output samples\noutput_samples = ExLTTB.downsample_to(input_samples, 30)\n\n# Downsample a list of data of arbitrary shape\ninput_samples =\n  for x \u003c- 1..100 do\n    %{nested: %{timebase: x},\n      data: :random.uniform() * 100,\n      untouched_other_key: :random.uniform() * 3\n    }\n  end\n\nsample_to_x_fun = fn sample -\u003e sample[:nested][:timebase] end\nsample_to_y_fun = fn sample -\u003e sample[:data] end\nxy_to_sample_fun = fn x, y -\u003e %{nested: %{timebase: x}, data: y} end\n\noutput_samples =\n  ExLTTB.downsample_to(\n    input_samples,\n    30,\n    sample_to_x_fun: sample_to_x_fun,\n    sample_to_y_fun: sample_to_y_fun,\n    xy_to_sample_fun: xy_to_sample_fun\n  )\n\n# Downsample a stream of data\ninput_stream =\n  Stream.iterate(%{x: 0, y: :random.uniform() * 100}, fn %{x: x} -\u003e %{x: x + 1, y: :random.uniform() * 100} end)\n\n# Downsample rate of 2.3\noutput_samples = ExLTTB.Stream.downsample(input_stream, 2.3) |\u003e Enum.take(20)\n\n# The options for arbitrary shaped data are the same for the streaming version\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecomind%2Fex_lttb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecomind%2Fex_lttb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecomind%2Fex_lttb/lists"}