Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Index Aggregation Option for Cleaning Mask Functions #1326

Merged
merged 34 commits into from
Jul 13, 2024

Conversation

ctuguinay
Copy link
Collaborator

Addresses #1321

@ctuguinay ctuguinay added the enhancement This makes echopype better label May 31, 2024
@ctuguinay ctuguinay added this to the v0.9.0 milestone May 31, 2024
@ctuguinay ctuguinay self-assigned this May 31, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2024

Codecov Report

Attention: Patch coverage is 95.60440% with 4 lines in your changes missing coverage. Please review.

Project coverage is 97.96%. Comparing base (9f56124) to head (d084aab).
Report is 122 commits behind head on main.

Files Patch % Lines
echopype/clean/api.py 90.24% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1326       +/-   ##
===========================================
+ Coverage   83.52%   97.96%   +14.44%     
===========================================
  Files          64        3       -61     
  Lines        5686      197     -5489     
===========================================
- Hits         4749      193     -4556     
+ Misses        937        4      -933     
Flag Coverage Δ
unittests 97.96% <95.60%> (+14.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ctuguinay
Copy link
Collaborator Author

ctuguinay commented Jun 5, 2024

I wasn't sure if the transient noise bins indicated in the Ryan 2015 paper were radius or diameter values, but I couldn't run some examples if my assumption was radius (memory leakage problem since bins were so big) so I modified my assumption to diameter, and that is reflected in the default values of the transient noise mask function.

@ctuguinay ctuguinay marked this pull request as ready for review June 5, 2024 05:33
@ctuguinay
Copy link
Collaborator Author

@leewujung This PR is at a good spot for review

@ctuguinay ctuguinay requested a review from leewujung June 5, 2024 05:34
echopype/clean/api.py Outdated Show resolved Hide resolved
echopype/clean/api.py Outdated Show resolved Hide resolved
echopype/clean/api.py Outdated Show resolved Hide resolved
echopype/clean/api.py Outdated Show resolved Hide resolved
echopype/clean/api.py Outdated Show resolved Hide resolved
echopype/clean/utils.py Outdated Show resolved Hide resolved
@ctuguinay ctuguinay marked this pull request as ready for review July 8, 2024 18:33
@ctuguinay ctuguinay marked this pull request as draft July 8, 2024 18:33
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ctuguinay ctuguinay marked this pull request as ready for review July 10, 2024 20:37
@ctuguinay
Copy link
Collaborator Author

@leewujung This should be ready to review again. I added this reflect logic we talked about previously

Comment on lines 281 to 287
upper_limit_sl : str, default `400m`
Upper limit of deep scattering layer line (m).
lower_limit_sl : Union[int, float], default `500`m
lower_limit_sl : str, default `500m`
Lower limit of deep scattering layer line (m).
num_side_pings : int, default `15`
Number of preceding & subsequent pings defining the block.
attenuation_signal_threshold : Union[int, float], default `8.0`dB
attenuation_signal_threshold : str, default `8.0dB`
Copy link
Member

@leewujung leewujung Jul 12, 2024

Choose a reason for hiding this comment

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

Could you change ` here to ", and also elsewhere? It's just that people need to put in quotes and not backticks as input arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made this change 👍

"Decibal input must be a string formatted as `NUMdB` or `NUMdb."
f"Cannot be of type `{type(dB_str)}`."
)
pattern = r"^[-+]?\d+\.?\d*(?:dB|db)$" # Ensures exact match with format
Copy link
Member

Choose a reason for hiding this comment

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

do you want to add an optional whitespace before dB/db so that inputs could be NUMdB or NUM dB?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't like having this space here. Maybe we just keep it NUMdB without space? This way it's also simpler and the user only has 2 accepted ways to write it, NUMdB and NUMdb, instead of 4 ways to write it

Copy link
Member

Choose a reason for hiding this comment

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

i think this is fine. I just remembered that we also only allow "10m".

Comment on lines 138 to 141
logger.warning(
"Consider using `func=nanmean`. `func=nanmedian` is an incredibly slow operation due "
"to the overhead sorting."
)
Copy link
Member

Choose a reason for hiding this comment

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

I agree with the statement, but the original method used nanmedian right? I feel that we should not recommend the change, but we can warn people that it is SLOW. We can also point them to the issue for the Fielding filter and the echopy code for that in the warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added this. Good idea! 👍

Comment on lines 46 to 47
func: str, default "nanmean"
Pooling function used in the pooled Sv aggregation.
Copy link
Member

Choose a reason for hiding this comment

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

I feel we should default to "nanmedian" since that is what the original method said.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made this change

leewujung
leewujung previously approved these changes Jul 12, 2024
Copy link
Member

@leewujung leewujung left a comment

Choose a reason for hiding this comment

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

@ctuguinay : Thanks for the changes. I had pretty minor comments, and think we can merge this afterwards. This is such an entrenched issue, and probably something the AA SI folks can enhance further later.

@ctuguinay
Copy link
Collaborator Author

@leewujung Thanks for the review! This should be ready for a short review again

@ctuguinay ctuguinay requested a review from leewujung July 12, 2024 21:29
echopype/clean/api.py Outdated Show resolved Hide resolved
leewujung
leewujung previously approved these changes Jul 12, 2024
Copy link
Member

@leewujung leewujung left a comment

Choose a reason for hiding this comment

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

Looks good! I think we are ready to merge now!

ctuguinay and others added 2 commits July 12, 2024 16:07
Co-authored-by: Wu-Jung Lee <[email protected]>
Co-authored-by: Wu-Jung Lee <[email protected]>
@ctuguinay
Copy link
Collaborator Author

@leewujung oh could you approve this again. i think committing your suggestions need further approval

@leewujung leewujung self-requested a review July 13, 2024 01:20
@ctuguinay ctuguinay merged commit f065cab into OSOceanAcoustics:main Jul 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This makes echopype better
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Use Simple Indexing for Noise and Attenuation Function Aggregations/Comparisons
3 participants