Add unit tests for range computation - #1775
Open
KAMALESWAR06 wants to merge 1 commit into
Open
KAMALESWAR06 wants to merge 1 commit into
KAMALESWAR06 wants to merge 1 commit into
Conversation
LOCEANlloydizard
requested changes
Sep 2, 2026
LOCEANlloydizard
left a comment
Collaborator
There was a problem hiding this comment.
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
force-pushed
the
test-range-unit-tests
branch
from
September 6, 2026 20:10
9ef9b44 to
4eb2f90
Compare
KAMALESWAR06
force-pushed
the
test-range-unit-tests
branch
from
September 6, 2026 20:37
4eb2f90 to
6a809d6
Compare
Author
|
Helloo Lloyd Izard,
Thanks for the review!
I have just pushed the updates:
1. Added mixed hardware coverage: Added test_range_mod_TVG_EK_ex80_mixed_wbt_gpt, which covers an EK80 case with one GPT and one WBT channel in the same file.
2. Cleaned up dead code: Removed the commented-out test_compute_rangeblock in tests/echodata/test_echodata.py. I also removed the compute_range_samplesfixture above it since it was only used by that block, but I'm happy to put it back if you would rather keep it around.
One important note on the math: Writing the mixed case made it visible that GPT channels currently end up with both corrections subtracted. This happens because mod_Ex60()it is applied to a range that has already been mod_Ex80()removed.
For now, I have asserted the current behavior so the test passes. However, if this is a bug and it should actually be the Ex60 correction only , just let me know, I can easily update both the range_mod_TVG_EK function and the test to fix it. 😊
…________________________________
From: Lloyd Izard ***@***.***>
Sent: Thursday, September 3, 2026 12:42 AM
To: echostack-org/echopype ***@***.***>
Cc: Kamaleswar Urranki ***@***.***>; Mention ***@***.***>
Subject: Re: [echostack-org/echopype] Add unit tests for range computation (PR #1775)
You don't often get email from ***@***.*** Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
@LOCEANlloydizard requested changes on this pull request.
thank you @KAMALESWAR06<https://github.com/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<#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...)
—
Reply to this email directly, view it on GitHub<#1775?email_source=notifications&email_token=BDROXG6P4KIQYPSKIMXP4LT5NCO5ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBZGU4TEMZUGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-5095923444>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BDROXG5UWZ4DYA2S375BU635NCO5ZAVCNFSNUABFKJSXA33TNF2G64TZHMYTINRRGQYDMMZTHNEXG43VMU5TKMZQGIZTMNBRGQ32C5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/BDROXGYPLWETRD625476MLD5NCO5ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBZGU4TEMZUGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y> and Android<https://github.com/notifications/mobile/android/BDROXGYOP6NIMKIQB62HL235NCO5ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMBZGU4TEMZUGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>. Download it today!
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds unit tests for
calibrate/range.py(Issue #548).The file
echopype/tests/calibrate/test_range.pyis new and contains eighttests 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.