I am using Python to produce an electrocardiogram (ECG) from signals obtained by an Arduino. I want to perform some analysis on it, what type of analysis I do not know yet that is something I have yet to decide. However my question is, is it possible to do this analysis on a real time flow of data coming through the serial port, or is it easier/better to save the data first to suppose a text file and then perform analysis on it. Right now I can't wrap my head round how to do it. An extra note: I would at the very minimum like to detect the peaks of the signal (R wave) and the R-R interval (so I can measure the beats per minute).
Here is what I have on Python thus far:
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
import matplotlib.figure as mfig
import PyQt4.QtGui as gui, PyQt4.QtCore as core
import collections
import time
<