Closed beatfactor closed 1 month ago
Merging #1142 (ec60163) into dev (6b734eb) will decrease coverage by
9.89%
. Report is 49 commits behind head on dev. The diff coverage is77.77%
.
@@ Coverage Diff @@
## dev #1142 +/- ##
==========================================
- Coverage 80.71% 70.82% -9.89%
==========================================
Files 67 10 -57
Lines 6056 1042 -5014
==========================================
- Hits 4888 738 -4150
+ Misses 1168 304 -864
Flag | Coverage Δ | |
---|---|---|
unittests | 70.82% <77.77%> (-9.89%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Files Changed | Coverage Δ | |
---|---|---|
echopype/utils/mask_transformation.py | 62.99% <62.99%> (ø) |
|
echopype/mask/mask_transient_noise.py | 90.00% <90.00%> (ø) |
|
echopype/mask/mask_impulse_noise.py | 99.12% <99.12%> (ø) |
|
echopype/mask/__init__.py | 100.00% <100.00%> (ø) |
... and 66 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Codecov Report
@mihaiboldeanu Looks like we could do a with a few more tests.
Hey folks, thanks for the PR!
I did a high-level review of the function/module organization and have the following suggestions. @emiliom also contributed to the discussion.
tests/mask/test_mask.py
? These changes are due to formatting, and even though the current one is not optimal, this would cause conflicts for the ongoing other PR #1106 . clean
subpackage. It is true that the functions you added here are generating masks, but noise assessment is a pretty central task for data processing that having its own subpackage is logical. So, could you move them? In the comment below I'll use clean
to avoid confusion, but let me know if it is confusing!test_mask_transient.py
and test_mask_impulse_noise.py
, and put them in tests/clean/conftest.py
so that they can be reused in the test modules. Also suggest renaming:
test_mask_transient.py
to test_clean_transient_noise.py
test_mask_impulse_noise.py
to test_clean_transient_noise.py
get_impulse_noise_mask.py
:
get_impulse_noise_mask
to within echopype/clean/api.py
ryan
, ryan_iterable
, wang
, etc) to a separate module echopype/clean/impulse_noise.py
, and add _
to the beginning of the function call so it is clear they are private functionsget_transient_noise_mask.py
:
get_transient_noise_mask
to within echopype/clean/api.py
_get_transient_noise_mask_ryan
and _get_transient_noise_mask_fielding
to a separate module echopype/clean/transient_noise.py
, and rename them to just _ryan
and _fielding
For the last 2 points, our convention has been to keep the main API call under a subpackage in subpackage/api.py
, and put supporting functions into separate modules (.py files) with filenames indicating which api function they are used in.
In addition, in clean
we currently only have one function with a generic name (remove_noise
), even though that function implements a specific algorithm that aims to estimate the time-varying background noise. With your addition of new noise removal functions (once masked), we need to change this function name and figuring out the API pattern for noise-related functions that generate masks (like these added here) and functions that suppress some noise (the current remove_noise
). But all that would be a separate PR.
One suggestion, in that case: let's move the test setup part to the base tests folder, since some of our non-noise-detection tests (shoal detection, seabed detection etc) will also use it. So tests/conftest.py rather than tests/clean/conftest.py. What do you think?
One suggestion, in that case: let's move the test setup part to the base tests folder, since some of our non-noise-detection tests (shoal detection, seabed detection etc) will also use it. So tests/conftest.py rather than tests/clean/conftest.py. What do you think?
Ah I see. Yes in that case, moving the setup to tests/conftest.py
sounds great. Thanks!
Hello @leewujung
I've rewritten this PR (both the already-reviewed impulse noise algorithms and the transient noise and signal attenuation ones) to use xarray functionality rather than numpy.
Please let me know if there are any other improvements I should make!
Closing this since the Echopy functions were added in #1316 and #1326
Overview
This PR introduces two new functions,
get_impulse_noise_mask
andget_transient_noise_mask
that provide masks for impulsive noise (noise sources shorter than 1 ping) and transient noise (short, but still multi-ping noise sources). These are ported from the echopy library: mask_impulse.py mask_transient.pyMethodologies
The methodology employed uses both previously published methods defined:
ryan
as mask generation method)wang
, for impulse noise only - unlike in echopy, this has been modified to provide a mask rather than a modified Sv array).fielding
as mask-generation method, for transient noise only).Key Features
Key Considerations
In order to ensure compatibility between the
echopy
andechopype
libraries, several important factors were taken into account while adapting theechopy
code – responsible for noise masking:echopy
, two separate masks are typically generated: one indicating the locations of noise (represented astrue
) and another showing where the method applied may not have been suitable for certain samples. In contrast, echopype usually delivers a single mask marking samples that are free of noise.For each noise type, specific decisions were made to combine and adapt the masks appropriately within the echopype environment.
Function Signatures
Usage
The functions can be utilised to create masks for
Sv
data based on identified single-ping or short multi-ping noise sources.