Fix edge case

This commit is contained in:
linarphy 2024-05-27 16:34:49 +02:00
parent 9f8710c6aa
commit 4c322603d3
No known key found for this signature in database
GPG key ID: E61920135EFF2295

View file

@ -74,7 +74,7 @@ class Signal:
start = min(self.x)
if end is None:
end = max(self.x)
indexes = where(logical_and(self.x > start, self.x < end))
indexes = where(logical_and(self.x >= start, self.x <= end))
return Signal(
self.x[indexes],
self.y[indexes],
@ -120,7 +120,7 @@ class Signal:
end = max(abs(freq_x))
index_to_remove = where(
logical_and(abs(freq_x) < start, abs(freq_x) > end)
logical_and(abs(freq_x) <= start, abs(freq_x) >= end)
)
freq_y[index_to_remove] = 0
y = irfft(freq_y)