wfdb icon indicating copy to clipboard operation
wfdb copied to clipboard

gqrs issues

Open cx1111 opened this issue 6 years ago • 1 comments

I'm refactoring Julien's python port of gqrs and hence am also looking through gqrs.c.

I'm going to list bugs and things about it that could be cleaned up along the way.

cx1111 avatar Jan 07 '18 21:01 cx1111

  • The dt variable, a filter time constant measured in sample numbers, is initialized and never changes. smdt, which serves the same role for the smoothed filter, is initialized to dt and never changes. It may as well be replaced by dt.
  • The gqrs function for state == LEARNING only runs up to sample number t = sps (samples per second) + 2, rather than tf as the function implies. I don't think it is intentional, given that tf_learn was deliberately calculated to determine how much of the signal should be used for training.
  • Once again for the LEARNING state, it seems nothing is actually accomplished. The filter function qf is never called, hence the only thing that can possibly be executed is reducing pthr to its minimum value.
  • WFDBINVALID samples are not treated differently. They are taken as regular samples.
  • Line 570: for (p = cpeak->next; p->time < t - rtmax; p = p->next) {, why does the peak pointer p start at the next peak? It seems the goal is to go through the circular buffer of peaks from the beginning to the current one. Why not just point p to peaks to begin with? Also, why do we need both an array and linked list?
  • Line 587: else if (p->amp < qthr) qthr--; This line is within the if statement on line 572: if (p->amp > qthr) { hence it cannot possibly be triggered.
  • The peak threshold pthr can only ever be decreased (line 641) but not increased. I don't know if this is intentional.

cx1111 avatar Jan 07 '18 21:01 cx1111