MIT-LCP / physionet

A collection of tools for working with the PhysioNet repository.
http://physionet.org/
MIT License
69 stars 17 forks source link

Bug in epicmp #47

Open tomas-teijeiro opened 7 years ago

tomas-teijeiro commented 7 years ago

There is a small bug in the current implementation of epicmp (Last revision 9 May 2010), particulary in the validation of episodes of atrial fibrillation when the '-x' flag is set in order to exclude episodes of atrial flutter.

Specifically, the bug is at line 208, when the duration is modified to exclude the overlap with an atrial flutter episode. By the condition evaluated at line 198, ex_end[i] is guaranteed to be greater than ep_start[a], so the quantity on the right side of the assignment is always negative, and therefore the duration is increased rather than decreased. The bug is solved by simply changing the order of the operands, so the line 208 should look as follows:

duration -= ex_end[i] - ep_start[a];