Generators for Engineers
A gentle introduction to infinite sequences.
Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.
from itertools import izip
averages = moving_average(noisy_sensor)
deviations = moving_deviation(noisy_sensor)
for ave, dev in izip(averages, deviations):
if ave > safe_value:
alert("Sensor reads dangerous values.")
if dev < expected_deviation:
alert("Sensor may be disconnected.")