Skip to content

Commit 3d85245

Browse files
committed
Add complex test.
1 parent 0e8f3d8 commit 3d85245

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ TODO
111111
====
112112

113113
- matplotlib in dev install
114-
- unit test to check that they are equal when signal is real
115114
- example file with hydra
116115
- manifest file to not include file in package
117116
- GitHub actions

tests/test_fftconvolve.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,22 @@ def test_fft():
3535

3636
# check results
3737
assert np.allclose(fft_out, fft_out)
38+
39+
40+
def test_fft_complex():
41+
42+
# create complex signal
43+
signal = np.random.randn(n) + 1j * np.random.randn(n)
44+
45+
# create complex filter
46+
filter = np.random.randn(n) + 1j * np.random.randn(n)
47+
48+
# create object
49+
fft_convolver = FFTConvolve(filter=filter, length=len(signal))
50+
51+
# convolve
52+
fft_out = fft_convolver(signal)
53+
54+
# check results
55+
fft_naive = np.convolve(signal, filter, mode="full")
56+
assert np.allclose(fft_out, fft_naive)

0 commit comments

Comments
 (0)