Skip to content

Add unit tests for range computation - #1775

Open
KAMALESWAR06 wants to merge 1 commit into
echostack-org:mainfrom
KAMALESWAR06:test-range-unit-tests
Open

KAMALESWAR06 wants to merge 1 commit into
echostack-org:mainfrom
KAMALESWAR06:test-range-unit-tests

Conversation

@KAMALESWAR06

Copy link
Copy Markdown

This pull request adds unit tests for calibrate/range.py (Issue #548).

The file echopype/tests/calibrate/test_range.py is new and contains eight
tests that check the core range calculations:

• compute_range_EK:
– correct range formula
– correct scaling with sound speed
– NaN backscatter → NaN range
– beam dimension dropped
– both error paths

• range_mod_TVG_EK:
– EX60 correction
– EX80 correction

These tests use small synthetic xarray datasets built in memory, so they do not
depend on downloaded sonar files and run quickly in the normal unit test suite.

This PR is test-only and does not modify library code. It is marked as
“addresses” rather than “closes” Issue #548 because the issue references
echodata.compute_range(), which no longer exists.

@LOCEANlloydizard LOCEANlloydizard linked an issue Sep 2, 2026 that may be closed by this pull request

@LOCEANlloydizard LOCEANlloydizard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thank you @KAMALESWAR06 for picking up those old issues, it's great to see them resolved, and this one is particularly important as well! I think the current tests give good coverage of the EK range calculation!

I have a couple of small remarks before merging:

  • should we add an EK80 case containing both WBT and GPT channels? range_mod_TVG_EK() has specific handling for GPT channels within EK80, while the current tests cover EK80/WBT and EK60/GPT separately
  • could you also remove the old fully commented test_compute_range block from tests/echodata/test_echodata.py, since it targets the retired EchoData.compute_range() API?

Otherwise this looks good to me, cheers!


i'm adding some items more as notes for when I come back to it, and potentially we can open follow-up issues for:

  • it would be good to have mixed WBT/GPT data integration testing (we could benefit from #1663?)
  • we also need to have tests for compute_range_AZFP()
  • it would be nice to compare echo_range against reference exports from other software (e.g. Echoview, pyEcholab...)

@KAMALESWAR06

KAMALESWAR06 commented Sep 6, 2026 via email

Copy link
Copy Markdown
Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade tests for echodata.compute_range()

3 participants