Skip to content

Conversation

@jmcvey3
Copy link
Contributor

@jmcvey3 jmcvey3 commented Jan 21, 2026

There are three main changes in this pull request:

  1. Added the option to determine the number of datapoints in each FFT when creating the sound pressure PSDs. This was currently hardcoded to the maximum FFT length, i.e. the total number of datapoints in each window, which might be more resolution and require more storage space than desired
  2. Changed names of bin and windowing related attributes on the PSDs to make them easier to understand
  3. Gain was improperly added - the sign has been corrected

Minor changes are refactoring some of the argument type checks to clean them up.

@jmcvey3
Copy link
Contributor Author

jmcvey3 commented Jan 21, 2026

Looks like some remaining dependency issues related to timestamps

@jmcvey3 jmcvey3 added enhancement New feature or request Clean Up Improve code consistency and readability acoustics Acoustics Module labels Jan 21, 2026
@akeeste akeeste self-assigned this Feb 3, 2026
@akeeste akeeste self-requested a review February 3, 2026 17:11
Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

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

Thanks @jmcvey3! Just two small suggestions on the use of _check_numeric

raise TypeError("'fn' must be a numeric type (int or float).")
if not isinstance(fmax, (int, float, np.ndarray)):
raise TypeError("'fmax' must be a numeric type (int or float).")

Copy link
Contributor

Choose a reason for hiding this comment

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

Add call to _check_numeric in place of the removed error check

Suggested change
_check_numeric(fn, "fn")
_check_numeric(fmax, "fmax")

Comment on lines +519 to +522
if not hasattr(pressure, "sensitivity"):
_check_numeric(pressure.sensitivity, "pressure.sensitivity")
if not hasattr(pressure, "fs"):
_check_numeric(pressure.fs, "pressure.fs")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should only check that the values are numeric if they exist. If the values are given then the type is not checked:

Suggested change
if not hasattr(pressure, "sensitivity"):
_check_numeric(pressure.sensitivity, "pressure.sensitivity")
if not hasattr(pressure, "fs"):
_check_numeric(pressure.fs, "pressure.fs")
if hasattr(pressure, "sensitivity"):
_check_numeric(pressure.sensitivity, "pressure.sensitivity")
else
raise TypeError("'pressure.sensitivity' not provided.")
if hasattr(pressure, "fs"):
_check_numeric(pressure.fs, "pressure.fs")
else
raise TypeError("'pressure.fs' not provided.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acoustics Acoustics Module Clean Up Improve code consistency and readability enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants