This notebook is a demo of the count peaks analysis. It is a function that takes a time series as input, and returns the number of peaks in that series.

It is designed to take gas sensor data in Watt as input. This first version has a fixed threshold of 3000 W, meaning that only peaks with a sudden increase of more than 3000 W are counted.


In [ ]:
import opengrid as og
from opengrid import datasets

In [ ]:
plt = og.plot_style()

Prepare dataset

In [ ]:
# We have a dataset prepared that contains gas sensor data in W on a minutely resolution
df = datasets.get('gas_dec2016_min')
# we only want to demo on one sensor, let's take the first 100 values
ts = df['313b'].head(100)

In [ ]:
fig = ts.plot()

Run Analysis

In [ ]:

If you count them by hand, you can see that the graph contains 13 different peaks. This includes high and low peaks. Perhaps a next version of the analysis could set a threshold?