Skip to content

Update Acoustics Module#447

Open
jmcvey3 wants to merge 20 commits into
MHKiT-Software:developfrom
jmcvey3:millidecades
Open

Update Acoustics Module#447
jmcvey3 wants to merge 20 commits into
MHKiT-Software:developfrom
jmcvey3:millidecades

Conversation

@jmcvey3

@jmcvey3 jmcvey3 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Enhancements:

  • Adds ability to convert sound spectral densities to millidecade format (https://doi.org/10.1121/10.0003324)
  • Adds reader for WISPR (Wideband Intelligent Signal Processing and Recording) system for hydrophones
  • Updates the export_audio function to input voltage timeseries and allow resampling to speed up recordings

Bugfixes

  • Refactors band-averaging for spectral density levels and sound pressure levels. This refactor avoids losing information at frequencies located at band boundaries, and conducts all of the band-averaging immediately after the PSD calculation.

The jupyter notebook has been updated with these changes as well.

@jmcvey3 jmcvey3 added bug Something isn't working enhancement New feature or request acoustics Acoustics Module labels Jun 16, 2026
@simmsa

simmsa commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@jmcvey3 there is a test failure on python 3.10. Any ideas on a fix there? I don't know why python 3.10 would have a different numerical result for one calculation?

The other test failures don't seem to be caused by any of your changes.

https://github.com/MHKiT-Software/MHKiT-Python/actions/runs/27647812694/job/81902073822#step:8:419

=========================== short test summary info ============================
FAILED .github/workflows/mhkit/tests/acoustics/test_metrics.py::TestMetrics::test_spl - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-06

Mismatched elements: 2 / 25 (8%)
Max absolute difference among violations: 9.94873047e-06
Max relative difference among violations: 1.20091383e-07
 ACTUAL: array([[82.13845 , 80.43939 , 81.25442 , 83.51936 , 80.834045],
       [83.07329 , 81.89704 , 81.74825 , 83.87166 , 81.16063 ],
       [82.84301 , 81.24031 , 81.632744, 83.92746 , 81.09888 ],...
 DESIRED: array([[82.13845 , 80.43939 , 81.25442 , 83.51936 , 80.834045],
       [83.07329 , 81.89704 , 81.748245, 83.87166 , 81.16063 ],
       [82.843   , 81.24031 , 81.632744, 83.92745 , 81.09888 ],...
=========== 1 failed, 343 passed, 218 warnings in 627.76s (0:10:27) ============

@jmcvey3

jmcvey3 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@jmcvey3 there is a test failure on python 3.10. Any ideas on a fix there? I don't know why python 3.10 would have a different numerical result for one calculation?

The other test failures don't seem to be caused by any of your changes.

https://github.com/MHKiT-Software/MHKiT-Python/actions/runs/27647812694/job/81902073822#step:8:419

=========================== short test summary info ============================
FAILED .github/workflows/mhkit/tests/acoustics/test_metrics.py::TestMetrics::test_spl - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-06

Mismatched elements: 2 / 25 (8%)
Max absolute difference among violations: 9.94873047e-06
Max relative difference among violations: 1.20091383e-07
 ACTUAL: array([[82.13845 , 80.43939 , 81.25442 , 83.51936 , 80.834045],
       [83.07329 , 81.89704 , 81.74825 , 83.87166 , 81.16063 ],
       [82.84301 , 81.24031 , 81.632744, 83.92746 , 81.09888 ],...
 DESIRED: array([[82.13845 , 80.43939 , 81.25442 , 83.51936 , 80.834045],
       [83.07329 , 81.89704 , 81.748245, 83.87166 , 81.16063 ],
       [82.843   , 81.24031 , 81.632744, 83.92745 , 81.09888 ],...
=========== 1 failed, 343 passed, 218 warnings in 627.76s (0:10:27) ============

Thanks for looking so quick. Looks like a machine precision error, since it's saying 9.94873047e-06 < 1e-7. I'll set the relative tolerance to 1e-6.

@simmsa simmsa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jmcvey3 I think the code looks good here, but am deferring specific acoustic knowledge to you and your team.

I found 1 minor typo, everything else looks good here.

Comment thread mhkit/acoustics/spsdl.py
method_name : str
The validated method name in lowercase.
method_arg : float, int, or None
The argument associated with the method, if applicableotherwise, None.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo here in applicable

@jmcvey3

jmcvey3 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks Andrew for hopping on this! We're going to do a data comparison from work up in Igiugig with the UW research group soonish, so I'd like to wait to merge until we've started that.

@simmsa

simmsa commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Thanks Andrew for hopping on this! We're going to do a data comparison from work up in Igiugig with the UW research group soonish, so I'd like to wait to merge until we've started that.

Sounds good, happy to wait.

We are planning a 1.1 release by the end of this quarter (Jun 30). Do you think this your planned work for this work will fall outside of that timeline? That is fine IMO, just wondering if we should try to include this in the next release and if we need to adjust the release timeline accordingly.

@jmcvey3

jmcvey3 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks Andrew for hopping on this! We're going to do a data comparison from work up in Igiugig with the UW research group soonish, so I'd like to wait to merge until we've started that.

Sounds good, happy to wait.

We are planning a 1.1 release by the end of this quarter (Jun 30). Do you think this your planned work for this work will fall outside of that timeline? That is fine IMO, just wondering if we should try to include this in the next release and if we need to adjust the release timeline accordingly.

I'll try to have it done by then, yes, because I'd like to have this in the next release.

@jmcvey3

jmcvey3 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@simmsa Is this notebook error a new error from pandas 3.0?

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

Labels

acoustics Acoustics Module bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants