Skip to content

Conversation

@SimonBuechner
Copy link

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:

  • make_edc_from_energy fixture implemented in conftest.py
  • test_parameters.py added and fixture-adjusted clarity-tests added.
  • newly proposed testing structure reducing redundancy

@SimonBuechner SimonBuechner added this to the v1.0.0 milestone Oct 13, 2025
@SimonBuechner SimonBuechner self-assigned this Oct 13, 2025
@SimonBuechner SimonBuechner added enhancement New feature or request question Further information is requested v1.0.0 labels Oct 13, 2025
@SimonBuechner SimonBuechner marked this pull request as draft October 13, 2025 12:48
@SimonBuechner
Copy link
Author

As requested this is the proposed fixture for the parameter tests. A few conceptual problems though:

  • it basically just builds a pyfar.TimeData object from provided energy and samplerate. It also normalizes the energy although, as we talked about this before, this is not neccessary.
  • In that case though, this could be done inline by just calling the TimeData-Constructor – especially because we need the energy values in many cases anyways to calculate the solution.
  • We should think about keeping it anyways for future cases.
  • The whole thing will be restructured anyways because as soon as the _energy_balance (V1 parameter definition #80) base function is done we will need slightly different tests

Before continuing though I'd love some feedback on this.

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.

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?

@github-project-automation github-project-automation bot moved this from Backlog to Require review in Weekly Planning Oct 14, 2025
@SimonBuechner
Copy link
Author

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.

@SimonBuechner SimonBuechner requested a review from ahms5 October 14, 2025 15:24
Copy link
Member

@mberz mberz 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 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.

@SimonBuechner
Copy link
Author

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.

@SimonBuechner SimonBuechner requested a review from mberz October 22, 2025 09:44
Copy link
Member

@mberz mberz 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 updates. It looks much cleaner.
I only have a couple of comments left.

import numpy.testing as npt
import re


Copy link
Member

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)?

Comment on lines 24 to 25
if invalid_energy is None:
pytest.skip("None is allowed and defaults to baseline")
Copy link
Member

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.

Comment on lines 30 to 32
snr = 90 # -90 dBFS
edc = make_edc_from_energy(energy=np.zeros(10), dynamic_range=snr)
assert np.allclose(edc.time, 10 ** (-snr / 10))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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



@pytest.fixture
def make_edc_from_energy():
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

@ahms5 ahms5 deleted the branch develop October 24, 2025 13:36
@ahms5 ahms5 closed this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Require review to Done in Weekly Planning Oct 24, 2025
@ahms5 ahms5 reopened this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Done to Backlog in Weekly Planning Oct 24, 2025
@ahms5 ahms5 changed the base branch from develop_1.0.0 to develop October 24, 2025 13:44
@SimonBuechner SimonBuechner marked this pull request as ready for review October 31, 2025 08:04
@mberz mberz requested review from a team and mberz October 31, 2025 08:17
@mberz mberz merged commit 8c69257 into develop Nov 6, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Weekly Planning Nov 6, 2025
@mberz mberz deleted the v1-make_edc_from_energy-fixture branch November 6, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request question Further information is requested v1.0.0

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants