Skip to main content

Implementation of the Ramer-Douglas-Peucker algorithm

Project description

fastrdp

PyPI Latest Release

The fastrdp package contains an implementation of the Ramer–Douglas–Peucker algorithm for reducing the number of points in a curve.

Example

There is a single function in the fastrdp package. Here is an example from the Wikipedia page linked to above with a description of the algorithm. The original line is black and the approximating line is red.

import matplotlib.pyplot as plt
import numpy as np
import fastrdp

x = np.linspace(0, 5, 10_000)
y = np.exp(-x) * np.cos(2 * np.pi * x)
x_new, y_new = fastrdp.rdp(x, y, 0.06)

fig, ax = plt.subplots()
ax.plot(x, y, color='black', linewidth=2.0)
ax.plot(x_new, y_new, linestyle='dashed', color='red')
plt.show()

Performance

Here we compare the performance of fastrdp with that of a pure Python implementation. The example above is executed with fastrdp in less than a millisecond on my machine

from timeit import timeit
timeit(lambda: fastrdp.rdp(x, y, 0.1), number=10_000)
0.9715354799991474

The pure Python implementation in the rdp package takes more than a second to finish the same computation

import rdp
z = np.column_stack((x, y))
timeit(lambda: rdp.rdp(z, epsilon=0.1), number=1)
1.636681150062941

To illustrate how fastrdp scales consider the following graph that shows execution time for an increasing number of random input points. The figure is produced with the scripts in the performance folder.

Compilation

To specify package metadata fastrdp is using the contemporary pyproject.toml. Execute the following commands to build and install fastrdp

pip install .

If you want an editable installation, then add a -e to the last command. To also install the optional dependencies used for development add a little extra:

pip install -e '.[dev]'

The single quotes are needed in zsh, but is perhaps superfluous in other shells.

Acknowledgements

Setting up package metadata to build and compile fastrdp is inspired by the pybind11 example package.

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

fastrdp-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distributions

fastrdp-0.1.0-cp311-cp311-win_amd64.whl (64.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

fastrdp-0.1.0-cp311-cp311-musllinux_1_1_x86_64.whl (613.5 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

fastrdp-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (97.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

fastrdp-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (95.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

fastrdp-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (61.8 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

fastrdp-0.1.0-cp311-cp311-macosx_10_14_x86_64.whl (64.8 kB view details)

Uploaded CPython 3.11 macOS 10.14+ x86-64

fastrdp-0.1.0-cp310-cp310-win_amd64.whl (63.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

fastrdp-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl (612.1 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

fastrdp-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (95.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

fastrdp-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (93.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

fastrdp-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (60.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

fastrdp-0.1.0-cp310-cp310-macosx_10_14_x86_64.whl (63.4 kB view details)

Uploaded CPython 3.10 macOS 10.14+ x86-64

fastrdp-0.1.0-cp39-cp39-win_amd64.whl (63.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

fastrdp-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl (612.4 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

fastrdp-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (96.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

fastrdp-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (93.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

fastrdp-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (60.7 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

fastrdp-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl (63.6 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

File details

Details for the file fastrdp-0.1.0.tar.gz.

File metadata

  • Download URL: fastrdp-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fastrdp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1cd8d497f0b8d06615ddde5414ce264bd00352e75bddae4919fa3c360d779163
MD5 6fb9b902b7ac746649bcda98aa7198c8
BLAKE2b-256 3e5a5d69ad96a092219032659626715b3c0960844377dbcc377df65abefb8d99

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fastrdp-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 64.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 80b943da369bf0e67a987edee219e916d657f4360874aa14b9806cbc92cd51ac
MD5 9aaa0e595559fe61641546aa920d72ad
BLAKE2b-256 71504bfa5a05f428b47918771f983815501737e6c9c705c16b6798d01b62a079

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 89eab5f097f2f1c1b27f5afb2faf93673b720abe602773ceb4f4c24d092e5d74
MD5 e6167b71ad87fde847a3ab64bf6c2eff
BLAKE2b-256 d225eae6385eada2859e78dac36e998ab7090d7a90a9becdb17651309d3107dd

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 410fa9c58a78b4be80f40497b71329237b02d9488e092eb89fe3660be1a94e9e
MD5 9956b32bf276c720787d8fc5b644a22a
BLAKE2b-256 fd347065777f380eec99dd9b9fd4ded9518c43f0b3685ea65ffe25d9ec9887d0

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 67dc616671f627f50f8a667715fea293ddd4dbe012b891077095988e80325f7e
MD5 d1a2b70c061ef1b00662745bbf595444
BLAKE2b-256 ff4fcd2b7ed3a151b0ffa80b1a6ac6c256c372c3b1da0ca0d32ab8a9929fcb0f

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3c92ff8afa65aa00abfa3455096e19cd51506fef161eba454e6154f41450e47
MD5 f0a3abd24a884ec8470e1b2998964ce7
BLAKE2b-256 2f59173937cf36e0ccebfd7408e3eb957fa3a0d2443cec5a12f90649703a97bd

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 9611ef58a691621d868e6a47d6a888bdc354fd7e2c0adfa3e1ce7d6e32b7cda1
MD5 d240ab158031a1c497eba240a1929f16
BLAKE2b-256 f7ae9b028e4ff291846ee3d41d166767a946b8f1d0a68c452ad351fc330b0313

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fastrdp-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 63.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f18a6885a64a1ab5ad24c99808a8bcf0ae774354b0369cbb5fa4f54b3546e841
MD5 c2309310b8387742fe3158aa7b078dfd
BLAKE2b-256 87a5fd3fa91642a58b1e8c47e57725cf767a2a05e154e20dd3763e7a19f8cd96

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 174d6f9552816b0da7ef4868f7ca4c0d0151ffeb8161459385944a7d3a7a3873
MD5 dce067c9f59133708f714c2f2b653e2b
BLAKE2b-256 c3888d74170307b9194879025dcd6823004e49e21cce676894572ff9bbc215d1

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa4afa4633842720ff2c1a45f78427ee2f5c94b4e8830ab33c9d618a39dcee63
MD5 2c189af7c0bcd5742337d7e0caf8fe1f
BLAKE2b-256 28ea4cafb3649b192cd7c9c3c4b882ff70df71cc553f39c39eec38bc035bf4ce

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4eb19b9a04e6f86f5e7b93b8b8ea0c28aedb1776c0a93e4b52e747b7b930b662
MD5 c58943bc926ee22ea2e108beca4110ad
BLAKE2b-256 76c04f3f9c53fa0120821a946b447a726fecbf4ef14f9ef5fc2e09cf3fac5993

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e504a5314ea59324d2dcaa9301ebf7e84dbe5cb6d9fa08794d073861c395a91
MD5 3370c7c76674ab4a4dec0083223a5efe
BLAKE2b-256 84e36f21f3168158c7cafc43113bcbb4297c054e582c9bd01ed2a7e326eed0b0

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 09ac7c82010efbd98eb185524a9071084269b08b017755f4f6fe7a903fe4129c
MD5 38af773e56d4febf1abe2b542cb95132
BLAKE2b-256 3e22b43016ef794c242d618b796896a867aa7bdfdf3a715a00b4137add8ce6c0

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: fastrdp-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cb5225db0d9058eef1115baf8d3322626034be8bb2cb017b94747dbe260ce864
MD5 14b074364cd91929e9d790069532750f
BLAKE2b-256 daa34179653ca8d20e2cd676291b78dcccef5d85559a76968a2d918ce7de634f

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d787b00c1ce708daaadd316a49020d4dca23556315d1cfdf94aa6f05caa4c047
MD5 ff34d55e9e65c16b1cfb9618fa2bedc2
BLAKE2b-256 1edaea702a3a09abf83c9b486d55bde8dd0566f471d09e849c806130e1e619ab

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a9df6175a064a5f9d9104dfc0e479a7e3d84023b0914c8daa7135b5fc53cf7c
MD5 76e4c99d02249117730e825c9a1b6531
BLAKE2b-256 eb1160f9f93a55049302dfaeb93c12559226e36a2cbf6528d20e69622051ade7

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 28e8eec5dadef94a6ac69274183e1a2a716f29309991003bae9c7bce2fc1bbca
MD5 aba36efa99332609b4439ce951220f43
BLAKE2b-256 2166e38b4989260eac23c4040faf69b47408bec7a275d2ad6341fdbb3441558a

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a063668a2710a70ded1b446a992afc2cd9d1f348339cad1df490de7f5d9c384b
MD5 01e11323eeb714e1fd6041e6f532378f
BLAKE2b-256 6d755be687e369a777bb41c6ce7dee1cd53fd1a5dafc1c1c4757ad4dfbf9421a

See more details on using hashes here.

File details

Details for the file fastrdp-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for fastrdp-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 db719212773f055b43f9861081412944a53ef03ebdb4aef5b0778fcb1416d947
MD5 3cf12cf8d3f689fe14399034e8ceca77
BLAKE2b-256 0610f1dde774f86ade29e02d4c6e6939fce9f8cccf5484fa83da831ef1cda34f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page