Skip to content

Commit

Permalink
Merge pull request #916 from mperreir/fix_plot_eda
Browse files Browse the repository at this point in the history
[Fix] eda_plot throws ValueError when the number of onsets is not the same as the number of peaks
  • Loading branch information
DominiqueMakowski authored Oct 2, 2023
2 parents e424839 + 215f2fa commit 379d219
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions neurokit2/eda/eda_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def eda_plot(eda_signals, info=None, static=True):
onsets = np.where(eda_signals["SCR_Onsets"] == 1)[0]
half_recovery = np.where(eda_signals["SCR_Recovery"] == 1)[0]

# clean peaks that do not have onsets
if len(peaks) > len(onsets):
peaks = peaks[1:]

# Determine unit of x-axis.
x_label = "Time (seconds)"
x_axis = np.linspace(0, len(eda_signals) / info["sampling_rate"], len(eda_signals))
Expand Down

0 comments on commit 379d219

Please sign in to comment.