DoPe
Douglas-Peucker line simplification (data reduction).
Reduces the number of points in a two-dimensional dataset, while preserving its most striking features.
The resulting dataset is a subset of the original dataset.
Although line simplification is typically used for geographical data, e.g. when zooming a digital map (see e.g. Django's GEOSGeometry.simplify() based on GEOS), this type of algorithm can also be applied to general data reduction problems, as an alternative (or addition) to conventional filtering or subsampling. Some examples:
- creating miniature data plots
- pre-processing time-series data for feature detection (e.g. peak detection)
Installation
Normal installation:
pip install dopelines
With plot support (adds matplotlib):
pip install dopelines[plot]
With development tools:
pip install dopelines[dev]
Note: The PyPi project is called dopelines instead of dope, because PyPi would not let us create a project named dope, even though the name appears to be available.
Example
from dope import DoPeR
data_original = [
[0, 0], [1, -1], [2, 2], [3, 0], [4, 0], [5, -1], [6, 1], [7, 0]
]
dp = DoPeR(data=data_original)
# use tolerance threshold (i.e. max. error w.r.t. normalized data)
data_simplified_eps = dp.simplify(tolerance=0.2)
# compare original data and simplified data in a plot
dp.plot()
# or use maximum recursion depth
data_simplified_depth = dp.simplify(max_depth=2)
Also see examples in tests.
Limitations
Currently we only offer a recursive implementation (depth-first), which is intuitive, but may not be the most efficient solution. An iterative implementation is in the works (breadth-first).
References:
Metadata
Release files for dopelines 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dopelines-0.1.1.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dopelines-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / dopelines-0.1.1.tar.gz
| Download URL | dopelines-0.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c6014335eb7169b5452b60954245163f70325dbc05f49192255aa9ed72118b9
|
|
BLAKE2b-256 checksum How to use checksums |
5a1fce4cc292923c5807a7e66e75b9bc7696fa8fdb2eb7a3f47e333a472eb11a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / dopelines-0.1.1-py3-none-any.whl
| Download URL | dopelines-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a32305f5dccfb28e4f2fac435c3f107bab8162e0227dd82059f4270ef6568894
|
|
BLAKE2b-256 checksum How to use checksums |
0468f0a415362fb6d2fdbef5a15a173736b0ef0bb9bf5ed7974ab0058bcb233d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|