lttbc: Largest-Triangle-Three-Buckets (Python using a c implementation)

This is a low-level implementation of the Largest-Triangle-Three-Buckets (LTTB) downsampling algorithm written in Python.
The code has been translated from the work of Sveinn Steinarsson (https://github.com/sveinn-steinarsson/flot-downsample/).
Demo and 'Known Issues'
The examples show the efficiency of the downsampling algorithm with a data set
set of 5000 data points down sampled to 500 and 250 points.
Known features and requirements:
- The algorithm requires monotonically increasing x data (finite)
- The algorithm requires finite y data (otherwise problems might occur)
- x and y data have to be of same length (of course)
- The algorithm returns arrays of dtype double
Installing
You can also install it from PyPI to use in other environments with Python 3.5 or later:
pip install lttbc
How to use on the field
The module lttbc differs in the standard input from other largest triangle three buckets implementations.
The downsample function takes an input for x and y in addition to the threshold:
import lttbc
import numpy as np
ARRAY_SIZE = 10000
THRESHOLD = 1000
x = np.arange(ARRAY_SIZE, dtype=np.int32)
y = np.random.randint(1000, size=ARRAY_SIZE, dtype=np.uint64)
nx, ny = lttbc.downsample(x, y, THRESHOLD)
assert len(nx) == THRESHOLD
assert len(ny) == THRESHOLD
assert nx.dtype == np.double
assert ny.dtype == np.double
# List data or a mixture is accepted as well ...
x = list(range(ARRAY_SIZE))
y = [np.random.uniform(0, 1000) for _ in range(ARRAY_SIZE)]
assert isinstance(x, list)
assert isinstance(y, list)
nx, ny = lttbc.downsample(x, y, THRESHOLD)
assert len(nx) == THRESHOLD
assert len(ny) == THRESHOLD
assert nx.dtype == np.double
assert ny.dtype == np.double
Metadata
Release files for lttbc 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lttbc-0.3.0.tar.gz | 93.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| lttbc-0.3.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| lttbc-0.3.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.5+ x86-64 | Details |
| lttbc-0.3.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| lttbc-0.3.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.5+ x86-64 | Details |
| lttbc-0.3.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
Total release size: 310.6 kB
Release files / lttbc-0.3.0.tar.gz
| Download URL | lttbc-0.3.0.tar.gz |
|---|---|
| Size | 93.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eecffefddf8883091070cbde460011c5301c9291ab61b707c87260071588a897
|
|
BLAKE2b-256 checksum How to use checksums |
1aa2a5a2b4f7839ca9ed5e226fbd6062e0f279449bd83fd9f0faf55123b2b0b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / lttbc-0.3.0-cp312-cp312-win_amd64.whl
| Download URL | lttbc-0.3.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 10.7 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
640163f7337c43cdb4b3545d8f7670a18a29bcc8a9e1c7f2182a2d5d07055b51
|
|
BLAKE2b-256 checksum How to use checksums |
f807412ac37f4560768048d73476ddf0a654cf6bd4910d32377def0d51988023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Release files / lttbc-0.3.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl
| Download URL | lttbc-0.3.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
|---|---|
| Size | 92.4 kB |
| Tags | CPython 3.12 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e626ae7ab2a046303fb5663ee02c079637dad243ad90b54a3d84ec69d357469c
|
|
BLAKE2b-256 checksum How to use checksums |
4a2296bb74852f49c7b85450f48b2de1464022b53d016874ad7dc42fd26ca7e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / lttbc-0.3.0-cp311-cp311-win_amd64.whl
| Download URL | lttbc-0.3.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 10.7 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
573daf16ef466bce59c0e357534766db96ec99b18021db58bd9b80a8843a730f
|
|
BLAKE2b-256 checksum How to use checksums |
fcfcd6c3c5a9dadf9c6bbba1520329e142d0d0b182ad2c333ae9de482f0894eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Release files / lttbc-0.3.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl
| Download URL | lttbc-0.3.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
|---|---|
| Size | 92.2 kB |
| Tags | CPython 3.11 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9b7865e705f590d6dca2e2e7ed64a763bbcf1a3c47daff94ec1deb3646bb2513
|
|
BLAKE2b-256 checksum How to use checksums |
07ba859878518dbc14d92e06835c8a05e0909068f072492b9dcb6b1b728e5f96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / lttbc-0.3.0-cp310-cp310-win_amd64.whl
| Download URL | lttbc-0.3.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 10.7 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a2bc3dfdf8f7bed57803e90e52ab9dc07dd889d3962ca03095eef0037199234d
|
|
BLAKE2b-256 checksum How to use checksums |
69f31549df12144a914dddd0e7dd1fd709da9e9408033d31351bbb719b4fa763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|