Skip to content

Commit

Permalink
fix wave_sum
Browse files Browse the repository at this point in the history
  • Loading branch information
feihoo87 committed Dec 15, 2023
1 parent 8bf1bda commit 641a904
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions tests/test_wavevstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from scipy.signal import butter, lfilter, lfiltic, tf2sos

from waveforms import *
from waveforms._waveform import wave_sum
from waveforms.waveform import WaveVStack


Expand Down Expand Up @@ -134,3 +135,9 @@ def test_filters():
l = wav.tolist()
wav2 = WaveVStack.fromlist(l)
assert np.allclose(wav2.sample(), points, atol=1e-6)


def test_wave_sum():
assert wave_sum([((-1.0, np.inf), (((), ()), ((((), ()), ), (0.02, )))),
((-1.0, np.inf), (((), ()), ((((), ()), ), (-0.02, ))))
]) == ((np.inf, ), (((), ()), ))
4 changes: 2 additions & 2 deletions waveforms/_waveform.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def wave_sum(waves):
i = 0
while i < len(bounds) - 1:
if seq[i] == seq[i + 1]:
del seq[i + 1]
del bounds[i + 1]
del seq[i]
del bounds[i]
else:
i += 1

Expand Down
2 changes: 1 addition & 1 deletion waveforms/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Define version number here and read it from setup.py automatically"""
__version__ = "1.9.0"
__version__ = "1.9.1"

0 comments on commit 641a904

Please sign in to comment.