Skip to main content

A small package to detect stagnation in the values of a signal, sort of horizontal steps

Project description

Build Status

Escalator

Escalator is a small "change point detection" Python library allowing to detect stagnation in the values of a signal, sort of horizontal steps. Unlike all the change point algorithms I found, this one doesn't try to to find the moment where the change happens, but search for when the stagnation periods start and end.

Inspired by the ruptures library.

Installation

pip install escalator-nyandams

Example

import step_detection as esc

signal: list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 30, 31, 29, 30, 30, 29, 32, 45, 70, 70, 71, 69, 72, 70, 70, 70, 75, 78, 85, 85, 90, 95, 100, 100, 100, 101, 100, 101, 100, 100, 100, 99, 100, 100]
cost = esc.DistanceMedianCost()
algo = esc.EscalatorRush(cost=cost, min_step_size=3, max_dist=2, jump=1).fit(signal)
stair_steps = algo.predict()
#  [(0, 10, 0.0), (11, 18, 29.833333333333332), (19, 27, 70.28571428571429), (33, 45, 100.0909090909091)]

If steps are really close to each others, you can regroup them to have better results:

import step_detection as esc
...
stair_steps = esc.group_steps(steps=stair_steps, signal=signal, gap=2 , dist=1)

You can then plot easily the result with your favorite package.

Example 1 of the result Example 2 of the result

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

escalator-nyandams-0.0.11.tar.gz (373.1 kB view details)

Uploaded Source

File details

Details for the file escalator-nyandams-0.0.11.tar.gz.

File metadata

  • Download URL: escalator-nyandams-0.0.11.tar.gz
  • Upload date:
  • Size: 373.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for escalator-nyandams-0.0.11.tar.gz
Algorithm Hash digest
SHA256 c99ef45e104d4ea5b66b12c055a01bce87427eac06092069bef9dc379e874ee0
MD5 be65f6934c66f5e6afe83080aa9d3d91
BLAKE2b-256 2a8154fd3f2259eeae07982c51721232fc77867a07a15e439b48fd529e5fb65e

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