Skip to content

Conversation

@SimonBuechner
Copy link

Changes proposed in this pull request:

  • implements definition parameter based on clarity template
  • adds test for said function.

@SimonBuechner SimonBuechner added this to the v1.0.0 milestone Sep 29, 2025
@SimonBuechner SimonBuechner requested a review from a team September 29, 2025 14:02
@SimonBuechner SimonBuechner self-assigned this Sep 29, 2025
@SimonBuechner SimonBuechner added the enhancement New feature or request label Sep 29, 2025
@SimonBuechner SimonBuechner moved this from Backlog to Require review in Weekly Planning Sep 29, 2025
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. Looking good already. Only small suggestions and a structural question for discussion.

Comment on lines +172 to +176
# Check input type
if not isinstance(energy_decay_curve, pf.TimeData):
raise TypeError("Input must be a pyfar.TimeData object.")
if not isinstance(early_time_limit, (int, float)):
raise TypeError('early_time_limit must be a number.')
Copy link
Member

Choose a reason for hiding this comment

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

If these checks and the one checking for real-valued data are in most parameter functions, we could move them to a separate private function to reduce redundancy. Could be done in a separate pull, once more parameters are implemented

Copy link
Author

Choose a reason for hiding this comment

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

agree.

Comment on lines +187 to +191
if energy_decay_curve.complex:
raise ValueError(
"Complex-valued input detected. Definition is"
"only defined for real TimeData.",
)
Copy link
Member

Choose a reason for hiding this comment

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

see note above on redundancy

import re


def make_edc_from_energy(energy, sampling_rate=1000):
Copy link
Member

Choose a reason for hiding this comment

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

A copy of this function is already in the clarity pull. Lets discuss during the weekly how we want to handle this. In pyfar we have pyfar.testing, maybe we can do this here as well.

Copy link
Author

Choose a reason for hiding this comment

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

That also applies to a few of the tests. Maybe a generalized approach would slim down the tests overall.

Copy link
Member

Choose a reason for hiding this comment

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

If that is the case, we could think about joining the tests in test_parameters.py instead of having a separate file for each parameter. In this case the helper function could maybe also stay there.

Copy link
Member

Choose a reason for hiding this comment

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

I opened an issue to keep track of this and would suggest to not fix it here or discuss in the weekly before fixing: #81

SimonBuechner and others added 2 commits October 1, 2025 07:27
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
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.

I have not fully reviewed the code, but have fundamental comment. Please see the comment and refer to #39.
Sorry I did not think about this earlier.

Comment on lines +203 to +204
definition = 1 - vals_energy_decay_curve / start_vals_energy_decay_curve
definition_db = 10 * np.log10(definition)
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should maybe rethink the implementation here a bit. Some of the energy based parameters can be calculated from others, see for example for definition from clarity here:
https://i-simpa-wiki.readthedocs.io/fr/latest/room_acoustics_parameters.html#definition

I would propose to take a step back and implement a general energy ratio calculation function first, as proposed by @HenningSchaar in #39 which could then be used in this function and the clarity calculation for example.
This function could also jointly take care of interval validity checking etc., so these do not need to be implemented in each function individually.

Copy link
Author

Choose a reason for hiding this comment

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

Okay I like that idea of having this one unified energy-parameter function. At the same time calculating parameters from each other doesn't make that much sense if we have function as proposed in #39, right?

Copy link
Author

Choose a reason for hiding this comment

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

While doing this might also partly solve #81.

Copy link
Member

Choose a reason for hiding this comment

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

+1 for a general energy ratio calculation function

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants