Skip to main content

Shoot a knarrow to the knee

Project description

knarrow

PyPI - Python Version PyPI - Downloads PyPI - License PyPI PyPI - Format GitHub tag (latest by date) GitHub Workflow Status Read the Docs Website

Shoot a knarrow to the knee ;)

(The lib is better than this pun, I swear.)

Detect knee points in various scenarios using a plethora of methods

Usage

Just plugin your values in a list, tuple or an np.ndarray and watch knarrow hit the knee:

>>> from knarrow import find_knee
>>> find_knee([1, 2, 3, 4, 6])  # use a list
3
>>> find_knee((1, 2, 3, 4, 6))  # or a tuple
3
>>> import numpy as np
>>> y = np.array([1.0, 1.05, 1.15, 1.28, 1.30, 2.5, 3.6, 4.9])
>>> find_knee(y)  # provide just the values
4
>>> x = np.arange(8)
>>> find_knee(x, y)  # or both x and y
4
>>> A = np.vstack((x, y))
>>> A
array([[0.  , 1.  , 2.  , 3.  , 4.  , 5.  , 6.  , 7.  ],
       [1.  , 1.05, 1.15, 1.28, 1.3 , 2.5 , 3.6 , 4.9 ]])
>>> find_knee(A)  # works with x in first row, y in the second
4
>>> A.T
array([[0.  , 1.  ],
       [1.  , 1.05],
       [2.  , 1.15],
       [3.  , 1.28],
       [4.  , 1.3 ],
       [5.  , 2.5 ],
       [6.  , 3.6 ],
       [7.  , 4.9 ]])
>>> find_knee(A.T)  # also works with x in the first column, y in the second column
4
>>> find_knee(x, y, smoothing=0.01)  # for better results use cubic spline smoothing
4

Note: this project was bootstrapped by python-blueprint

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

knarrow-0.4.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knarrow-0.4.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file knarrow-0.4.1.tar.gz.

File metadata

  • Download URL: knarrow-0.4.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for knarrow-0.4.1.tar.gz
Algorithm Hash digest
SHA256 964568470caf288767a5e75d2952335794ffb12cc6b5f8342c1d7281f5ec08d6
MD5 3365b3a1fbed663ce8b06efc6184167b
BLAKE2b-256 b3923ada74c226f16d69c7e9839de6b41a073edf8a85f8b240e3abeb8682b934

See more details on using hashes here.

File details

Details for the file knarrow-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: knarrow-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for knarrow-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 054b6abf997c3f74f6616d431892030aebc52287f5705aa28ac6bee95382ca9b
MD5 e6bb4294729a4676ba23b5e6a2bef66c
BLAKE2b-256 5bc81ba9c1fa5fd903a2abed97602cf5e71acadb4d8361757f9607a937d55a63

See more details on using hashes here.

Supported by

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