Signal Processing

Optimize

simplify

hydrobox.toolbox.simplify(x, flatten=True, threshold=0)[source]

Simplify signal

An given input is simplified by reducing the amount of nodes representing the signal. Whenever node[n+1] - node[n] <= threshold, no information gain is assumed between the two nodes. Thus, node[n+1] will be removed.

In case flatten is True, noise in the signal will be flattened as well. This is done by removing node[n + 1] in case node[n] and node[n + 1] hold the same value. In case the underlying frequency in the noise is higher than one time step or the amplitude is higher than the sensor precision, this method will not assume the value change as noise. In these cases a filter needs to be applied first.

Parameters:
x : numpy.ndarray, pandas.Series, pandas.DataFrame

numpy.array of signal

flatten : bool

Specify if a 1 frequence 1 amplitude change in signal be flattened out as assumed noise.

threshold : int, float

value threshold at which a difference in signal is assumed

Returns:
numpy.ndarray