Largest-Triangle-Three-Buckets algorithm for downsampling time series–like data
Project description
Numpy implementation of Steinarsson’s Largest-Triangle-Three-Buckets algorithm for downsampling time series–like data
It is based on the original JavaScript code at https://github.com/sveinn-steinarsson/flot-downsample and Sveinn Steinarsson’s 2013 MSc thesis Downsampling Time Series for Visual Representation.
Usage
import numpy as np
import lttb
data = np.array([range(100), np.random.random(100)]).T
small_data = lttb.downsample(data, n_out=20)
assert small_data.shape == (20, 2)
A test data set is provided in the source repo in tests/timeseries.csv. It was downloaded from http://flot.base.is/ and converted from JSON to CSV.
This is what it looks like, downsampled to 100 points:
Installation
To install the lttb package into your (virtual) environment:
pip install lttb
Development
In a virtual environment, install the dependencies and development tools:
pip install -r requirements.txt pip install -e . pip install -r requirements-dev.txt
The linters and tests can then be run with the commands in the Makefile:
make lint make test make test-all
Note that the test-all task requires the versions of Python used by tox to have already been installed with pyenv.
History
0.2.1 / 2019-11-25
Versions are now managed with setuptools_scm rather than bumpversion.
The code is formatted with Black.
0.2.0 / 2018-02-11
Performance improvements
Released on PyPI (on 2019-11-06)
0.1.0 / 2017-03-18
Initial implementation
Contributors
Jack Viljoen (@javiljoen) – original Numpy implementation
Guillaume Bethouart (@guillaumeB) – performance improvements
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lttb-0.2.1.tar.gz.
File metadata
- Download URL: lttb-0.2.1.tar.gz
- Upload date:
- Size: 100.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff1fb9c48ab623dd2cd608a329f54b39ff0e315019e22b5b15c8dd7ea6070c13
|
|
| MD5 |
031a65aabccd96e6690c1cfe45b6d526
|
|
| BLAKE2b-256 |
3ba2cdca81cdf8a982e03a30e3b49edb7a108de4de963ce2b7688d1b05bde0d3
|
File details
Details for the file lttb-0.2.1-py3-none-any.whl.
File metadata
- Download URL: lttb-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5127c6fa15af3fe1b1cacae13ece11cf5370ffc42db06bc2294035514cdedbd5
|
|
| MD5 |
99d252e10afc19b4fd0d7a7f67c8c881
|
|
| BLAKE2b-256 |
ba42ea3c7c7fbfe6ebfb02cf69437559855e45cfb1dd32d75756b5bf6e882d88
|