Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement filter tests for complex signals #460

Merged
merged 6 commits into from Dec 15, 2023

Conversation

tluebeck
Copy link

unit testing for filtering complex signals

@f-brinkmann f-brinkmann changed the title implement filter tests Implement filter tests for complex signals May 3, 2023
@f-brinkmann
Copy link
Member

We might get away with fewer tests if we test only if the three filter classes FilterFIR, FilterIIR, and FilterSOS can handle complex input. If this is the case, all pyfar filter functions will be good, as far as I understand.

@tluebeck tluebeck changed the base branch from complex_time_signals to develop_complex_signals August 11, 2023 09:19
Copy link
Member

@f-brinkmann f-brinkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort. Only had a tiny question

def test_filter_sos_process_complex(impulse_complex):
sos = np.array([[1, 1/2, 0, 1, 0, 0]])
filt = fo.FilterSOS(sos, impulse_complex.sampling_rate)
coeff = np.array([[1, 1/2, 0], [1, 0, 0]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you initializing twice? According to the docs the shape of the coefficients should be (1, 1, 6) did that not work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a copy and paste from the test for the non complex data, to be honest :) ... I removed. Also in the non complex test. Should I also test it with coefficients (1, 1, 6)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and filt.coefficients has shape (1,1,6) in both cases. but maybe inputting the coefficients according to the docs is less confusing, i.e., using sos = np.array([[[1, 1/2, 0, 1, 0, 0]]])

Copy link
Member

@ahms5 ahms5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for implementing

tests/test_filter.py Outdated Show resolved Hide resolved
Co-authored-by: Anne Heimes <64446926+ahms5@users.noreply.github.com>
@f-brinkmann f-brinkmann merged commit b588cb8 into develop_complex_signals Dec 15, 2023
8 checks passed
@f-brinkmann f-brinkmann deleted the test_filter branch December 15, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants