From 5abd16b3d920f8635ab0e5d391c11222ca769617 Mon Sep 17 00:00:00 2001 From: Gavin Macaulay Date: Tue, 3 Sep 2024 14:00:19 +1200 Subject: [PATCH] Add DWBA and SDWBA classes (don't calculate TS yet) --- docs/api_reference.md | 10 ++++-- src/echosms/__init__.py | 3 ++ src/echosms/dwbamodel.py | 60 ++++++++++++++++++++++++++++++++++ src/echosms/sdwbamodel.py | 69 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 src/echosms/dwbamodel.py create mode 100644 src/echosms/sdwbamodel.py diff --git a/docs/api_reference.md b/docs/api_reference.md index 70fddc9..1d54c3e 100644 --- a/docs/api_reference.md +++ b/docs/api_reference.md @@ -14,11 +14,13 @@ Each type of model is contained in a separate Python class (with name ending in ## DWBA models -There are several models that use the distorted wave Born approximation, documented below: +There are several models that use the distorted-wave Born approximation, documented below: ### DWBA -This is a placeholder for the distorted wave Born approximation model. +::: echosms.DWBAModel + options: + heading_level: 4 ### PT-DWBA @@ -28,7 +30,9 @@ This is a placeholder for the distorted wave Born approximation model. ### SDWBA -This is a placeholder for the stochastic distorted wave Born approximation model. +::: echosms.SDWBAModel + options: + heading_level: 4 ## ESModel diff --git a/src/echosms/__init__.py b/src/echosms/__init__.py index f8a6fba..b43ccda 100644 --- a/src/echosms/__init__.py +++ b/src/echosms/__init__.py @@ -8,8 +8,11 @@ from .psmsmodel import PSMSModel from .dcmmodel import DCMModel from .ptdwbamodel import PTDWBAModel +from .dwbamodel import DWBAModel +from .sdwbamodel import SDWBAModel __all__ = ['ScatterModelBase', 'BenchmarkData', 'ReferenceModels', 'MSSModel', 'PSMSModel', 'DCMModel', 'ESModel', 'PTDWBAModel', + 'DWBAModel', 'SDWBAModel', 'wavenumber', 'eta', 'h1', 'spherical_jnpp', 'as_dataframe', 'as_dataarray'] diff --git a/src/echosms/dwbamodel.py b/src/echosms/dwbamodel.py new file mode 100644 index 0000000..89a3f53 --- /dev/null +++ b/src/echosms/dwbamodel.py @@ -0,0 +1,60 @@ +"""The distorted-wave Born approximation model.""" + +from .scattermodelbase import ScatterModelBase + + +class DWBAModel(ScatterModelBase): + """Distorted-wave Born approximation scattering model.""" + + def __init__(self): + super().__init__() + self.long_name = 'distorted-wave Born approximation' + self.short_name = 'dwba' + self.analytical_type = 'approximate' + self.boundary_types = 'weakly scattering' + self.shapes = ['any'] + self.max_ka = 20 + + def calculate_ts_single(self, theta, phi, f, target_rho, target_c): + """Distorted-wave Born approximation scattering model. + + Implements the distorted-wave Born approximation + model for calculating the acoustic backscatter from weakly scattering bodies. + + Parameters + ---------- + theta : float + Incident wave pitch angle [°]. + + phi : float + Incident wave roll angle [°]. + + f : float + Frequency to run the model at [Hz] + + target_rho : iterable[float] + Densities of each material. Must have at least the same number of entries as unique + integers in `volume` [kg/m³]. + + target_c : iterable[float] + Sound speed of each material. Must have at least the same number of entries as unique + integers in `volume` [m/s]. + + Returns + ------- + : float + The target strength (re 1 m²) [dB] of the target. + + Notes + ----- + This class implements the method presented in Chu et al. (1993). + + References + ---------- + Chu, D., Foote, K. G., & Stanton, T. K. (1993). Further analysis of target strength + measurements of Antarctic krill at 38 and 120 kHz: Comparison with deformed cylinder + model and inference or orientation distribution. The Journal of the Acoustical Society + of America, 93(5), 2985–2988. + + """ + return None diff --git a/src/echosms/sdwbamodel.py b/src/echosms/sdwbamodel.py new file mode 100644 index 0000000..428566d --- /dev/null +++ b/src/echosms/sdwbamodel.py @@ -0,0 +1,69 @@ +"""The stochastic distorted-wave Born approximation model.""" + +from .scattermodelbase import ScatterModelBase + + +class SDWBAModel(ScatterModelBase): + """Stochastic distorted-wave Born approximation scattering model.""" + + def __init__(self): + super().__init__() + self.long_name = "stochastic distorted-wave Born approximation" + self.short_name = "sdwba" + self.analytical_type = "approximate" + self.boundary_types = "weakly scattering" + self.shapes = ["any"] + self.max_ka = 20 + + def calculate_ts_single(self, theta, phi, f, target_rho, target_c): + """Stochastic distorted-wave Born approximation scattering model. + + Implements the stochastic distorted-wave Born approximation + model for calculating the acoustic backscatter from weakly scattering bodies. + + Parameters + ---------- + theta : float + Incident wave pitch angle [°]. + + phi : float + Incident wave roll angle [°]. + + f : float + Frequency to run the model at [Hz] + + target_rho : iterable[float] + Densities of each material. Must have at least the same number of entries as unique + integers in `volume` [kg/m³]. + + target_c : iterable[float] + Sound speed of each material. Must have at least the same number of entries as unique + integers in `volume` [m/s]. + + Returns + ------- + : float + The target strength (re 1 m²) [dB] of the target. + + Notes + ----- + This class implements the method presented in Demer & Conti (2003), Demer & Conti (2004), + and Conti & Demer (2006). + + References + ---------- + Demer, D. A., & Conti, S. G. (2003). Reconciling theoretical versus empirical target + strengths of krill: Effects of phase variability on the distorted-wave Born approximation. + ICES Journal of Marine Science, 60, 429-434. + + + Demer, D. A., & Conti, S. G. (2004). Reconciling theoretical versus empirical + target strengths of krill: Effects of phase variability on the distorted-wave Born + approximation. ICES Journal of Marine Science, 61(1), 157-158. + + + Conti, S. G., & Demer, D. A. (2006). Improved parameterization of the SDWBA for estimating + krill target strength. ICES Journal of Marine Science, 63(5), 928-935. + + """ + return None