-
Notifications
You must be signed in to change notification settings - Fork 15
make_edc_from_energy fixture #82
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
Conversation
…fixture tests for clarity
|
As requested this is the proposed fixture for the parameter tests. A few conceptual problems though:
Before continuing though I'd love some feedback on this. |
ahms5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks, I have some conseptual questions.
would it make sence to define different fixtures with more describing names for energy, "geometric" and "real"?
could you also add more details to what geometic and real means?
Yes, will do. I think I will also allow handover of e.g. the parameters for the geometrical decay because we usually need them in the tests anyway. Right now it's a rough sketch to get the idea across. I was thinking about implementing different fixtures for those cases but I like the idea of having one universal fixture to get different EDCs for these kind of tests. |
mberz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this started.
In general I feel that the fixture is more complex than it needs to be and can be simplified, see the comments below.
I would propose to reduce the number of different parameterizations to for example:
- passing energy values which represent an edc
- passing a reverberation time/ intercept (simple exponential decay function)
In most test cases, I'd expect that an edc with a dynamic range between 0 and -65 (or a bit more headroom) is sufficient. I don't think there's need for -inf dB dynamic range for the average test case. This in my opinion could be a more representative default.
Currently, the fixture is not tested, please add some basic tests for the fixture.
Please also do not mix up adding this fixture with other changes such as changing the tests for other functions at this point.
…ential decays for RT or returns as energy input.
|
I restructured the factory so that we follow a more generalized approach for an exponential decay as requested. For test convenience it now returns a simple empty edc for typechecks etc. dynamic range can also be adjusted - not sure though if this is neccessary but it leaves flexibility. More tests for the fixture will follow. |
mberz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. It looks much cleaner.
I only have a couple of comments left.
tests/test_parameters.py
Outdated
| import numpy.testing as npt | ||
| import re | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move the tests for the fixture to a separate file (something like test_edc_fixture or similar)?
tests/test_parameters.py
Outdated
| if invalid_energy is None: | ||
| pytest.skip("None is allowed and defaults to baseline") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is happening here? If the input does not raise an error there should be no reason to test this here, or am I misunderstanding this?
If that is correct, It would make more sense to remove None from the parameters, so there's no need for the skip functionality.
tests/test_parameters.py
Outdated
| snr = 90 # -90 dBFS | ||
| edc = make_edc_from_energy(energy=np.zeros(10), dynamic_range=snr) | ||
| assert np.allclose(edc.time, 10 ** (-snr / 10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| snr = 90 # -90 dBFS | |
| edc = make_edc_from_energy(energy=np.zeros(10), dynamic_range=snr) | |
| assert np.allclose(edc.time, 10 ** (-snr / 10)) | |
| dynamic_range = 90 # -90 dBFS | |
| edc = make_edc_from_energy( | |
| energy=np.zeros(10), dynamic_range=dynamic_range) | |
| assert np.allclose(edc.time, 10 ** (-dynamic_range / 10)) |
The term SNR has another meaning and could be confusing here
tests/conftest.py
Outdated
|
|
||
|
|
||
| @pytest.fixture | ||
| def make_edc_from_energy(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def make_edc_from_energy(): | |
| def make_edc(): |
I feel that the _from_energy extension is confusing here, since it is only one of the parameterizations which can be used.
fixture added in conftest.py, test_parameters.py adjusted to contain fixture-tests for clarity
Which issue(s) are closed by this pull request?
Closes #81
Changes proposed in this pull request: