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

Improve estimate_noise binning routine #1211

Closed
lsetiawan opened this issue Nov 6, 2023 · 2 comments
Closed

Improve estimate_noise binning routine #1211

lsetiawan opened this issue Nov 6, 2023 · 2 comments
Assignees
Milestone

Comments

@lsetiawan
Copy link
Member

lsetiawan commented Nov 6, 2023

Overview

This issue follows up on Issue #1028. Improvements in 2D binning routines have been implemented for both compute_MVBS and compute_NASC, however it may seem that estimate_noise is still left as mentioned in the issue.

def estimate_noise(self, noise_max=None):
"""Estimate noise from a collected of pings
Parameters
----------
noise_max : Union[int, float]
the upper limit for background noise expected under the operating conditions
"""
power_cal_binned_avg = 10 * np.log10( # binned averages of calibrated power
self.power_cal.coarsen(
ping_time=self.ping_num,
range_sample=self.range_sample_num,
boundary="pad",
).mean()
)
noise = power_cal_binned_avg.min(dim="range_sample", skipna=True)
# align ping_time to first of each ping collection
noise["ping_time"] = self.power_cal["ping_time"][:: self.ping_num]
if noise_max is not None:
noise = noise.where(noise < noise_max, noise_max) # limit max noise level
self.Sv_noise = (
noise.reindex(
{"ping_time": self.power_cal["ping_time"]}, method="ffill"
) # forward fill empty index
+ self.spreading_loss
+ self.absorption_loss
)

An investigation and improvements needs to happen for this method to enhance efficiency, memory usage, and robustness against different types of data.

Original description by @leewujung can be found at #1028 (comment).

@MohamedNasser8
Copy link

Hello @lsetiawan,
As I understand it, ping_time can refer to actual timestamps or simply be a sequence of indices. We need to account for both scenarios: when ping_time represents real-time data and when it represents indices. I am making sure to handle both cases appropriately to ensure accurate results.

@ctuguinay
Copy link
Collaborator

Closing this as coarsen itself is very fast and probably does not need the Flox algorithms to speed up this process.

@github-project-automation github-project-automation bot moved this from Todo to Done in Echopype Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants