Fix #80 by offsetting the rolling mean by a percentage of the standard deviation of the signal, making it DC-component-independent.
Independently, I added negative offsets. Various data that I have tested with suggest that sometimes it is more reliable to detect peaks based on the low points which is essentially what we are doing by moving the rolling average down.
This makes the library a bit slower (not too much but I did not measure). If we want to compensate, we can remove any offset above 70% as this corresponds to an average only 0.3% of all samples lie above.
I chose the base value as 4*std as this seemed to be the closest to the rolling mean for the included data, making the results (especially the best value) in that case nearly identical.
Fix #80 by offsetting the rolling mean by a percentage of the standard deviation of the signal, making it DC-component-independent.
Independently, I added negative offsets. Various data that I have tested with suggest that sometimes it is more reliable to detect peaks based on the low points which is essentially what we are doing by moving the rolling average down. This makes the library a bit slower (not too much but I did not measure). If we want to compensate, we can remove any offset above 70% as this corresponds to an average only 0.3% of all samples lie above.
I chose the base value as 4*std as this seemed to be the closest to the rolling mean for the included data, making the results (especially the
best
value) in that case nearly identical.