Add prototype API for FM EK80#1664
Open
LOCEANlloydizard wants to merge 2 commits into
Open
Conversation
- Add public `compute_Sv_f()` and `compute_TS_f()` for the API - Add `_cal_complex_samples_f()` prototype - Expose `frequency_resolution` and `range_step` parameters for future spectral calibration - Return prototype `Sv_f` xarray output structure: `(channel, ping_time, svf_range, frequency)`
Use lazy method getattr in calibration dispatcher to avoid access to unsupported compute_Sv_f / compute_TS_f methods on non-FM calibrators
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1664 +/- ##
==========================================
- Coverage 85.58% 85.56% -0.02%
==========================================
Files 79 78 -1
Lines 6998 7074 +76
==========================================
+ Hits 5989 6053 +64
- Misses 1009 1021 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Hey @LOCEANlloydizard, I thought of a few other params after our discussion the other day so thought I'd lay them out and see what you think. Feel free to ping for more discussions! def compute_Sv_spectrum(
self,
NFFT: int,
range_step: float = 0.5,
window: str = "hann", # TODO: should this be default to None?
frequency_resolution: Optional[float] = None,
) -> xr.Dataset:
"""Compute broadband EK80 Sv spectrum, or Sv(f).
Parameters
----------
NFFT : int
Number of points in the FFT window for computing spectrum.
range_step : float, default 0.5
Range spacing in meters for the output Sv(f) window centres.
window : str, default "hann"
Type of window function to apply to each FFT segment.
Options include "hann", "hamming", etc.
frequency_resolution : optional[float], default None
Frequency spacing in Hz for the output spectral grid.
When this is provided, the output Sv(f) will be interpolated to this frequency grid.
If None, the output Sv(f) will be on the original FFT frequency grid.
Returns
-------
xr.Dataset
A Dataset containing frequency-dependent volume backscattering strength.
"""
def compute_TS_spectrum(
self,
point_locations: xr.DataSet,
NFFT: int,
split_front: float = 0.25,
window: str = "hann",
frequency_resolution: Optional[float] = None,
) -> xr.Dataset:
"""Compute broadband EK80 Sv spectrum, or Sv(f).
Parameters
----------
point_locations : xr.DataSet
Locations of the points for which to compute the spectrum.
This is required to be an xarray.DataSet with dimensions ("target_id") and
data variables "ping_time" and "depth" for each ``target_id``.
NFFT : int
Number of points in the FFT window for computing spectrum.
split_front : float, default 0.25
Each echo spectrum is computed from a segment of the complex echo signal.
This parameter specifies how to identify the segment around the specified point location.
For example, if split_front=0.25, then 25% the NFFT length will be before the point location,
and the remaining 75% will be after the point location.
window : str, default "hann"
Type of window function to apply to each FFT segment.
Options include "hann", "hamming", etc.
frequency_resolution : optional[float], default None
Frequency spacing in Hz for the output spectral grid.
When this is provided, the output Sv(f) will be interpolated to this frequency grid.
If None, the output Sv(f) will be on the original FFT frequency grid.
Returns
-------
xr.Dataset
A Dataset containing frequency-dependent point backscattering strength.
""" |
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.
compute_Sv_f()andcompute_TS_f()for the API_cal_complex_samples_f()prototypefrequency_resolutionandrange_stepparameters for spectral calibrationSv_fxarray output structure:(channel, ping_time, svf_range, frequency)Refs: #1034