Skip to content

Commit

Permalink
Return an empty array rather than throwing an exception if no QRS dat…
Browse files Browse the repository at this point in the history
…a is found.
  • Loading branch information
ajb5d committed Jul 10, 2024
1 parent a56c909 commit feaf6ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neurokit2/ecg/ecg_findpeaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def _ecg_findpeaks_neurokit(
qrs = smoothgrad > gradthreshold
beg_qrs = np.where(np.logical_and(np.logical_not(qrs[0:-1]), qrs[1:]))[0]
end_qrs = np.where(np.logical_and(qrs[0:-1], np.logical_not(qrs[1:])))[0]

if len(beg_qrs) == 0:
return []
# Throw out QRS-ends that precede first QRS-start.
end_qrs = end_qrs[end_qrs > beg_qrs[0]]

Expand Down

0 comments on commit feaf6ef

Please sign in to comment.