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

Differences in KRM implementations #30

Open
gavinmacaulay opened this issue Dec 18, 2024 · 0 comments
Open

Differences in KRM implementations #30

gavinmacaulay opened this issue Dec 18, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@gavinmacaulay
Copy link
Collaborator

The Clay & Horne (1994) paper, in the line immediately after equation 13, says

and $k_b \approx k$ at low contrast.

Setting $k_b$ to $k$ gives TS results that differ by around 1 dB compared to not setting $k_b$ to be $k$ for some example datasets. It is not clear why this approximation is necessary (it doesn't simplify the calculations at all) and it perhaps leads to less accurate TS results. Some other implementations of the KRM that echoSMs has been compared against set $k_b$ to $k$, so echoSMs currently does the same.

To allow for testing and comparison of other KRM implementations, the fish shapes from the online KRM TS calculator (https://www.fisheries.noaa.gov/data-tools/krm-model) have been included in echoSMs in a toml-formatted file (or use the KRMorganism Python class for easy access).

The TS for the sardine shape from there can be calculated and compared to the online results with:

from echosms import KRMModel, KRMdata
import matplotlib.pyplot as plt
import numpy as np

mod = KRMModel()

fish = KRMdata().model('Sardine')

p = {'medium_c': 1490, 'medium_rho': 1030, 'organism': fish, 'theta': 90,
     'f': np.arange(12, 121, 1)*1e3}

krm_ts = mod.calculate_ts(p)

noaa_ts = KRMdata.ts('Sardine')

d = np.mean(np.abs(np.array(krm_ts) - np.array(noaa_ts[' TS (dB).1'])))
print(f'Mean difference in results is {d:.2f} dB')

plt.plot(fish.body.x, fish.body.z_U, fish.body.x, fish.body.z_L, c='black')
for s in fish.inclusions:
    plt.plot(s.x, s.z_U, s.x, s.z_L, c='C0' if s.boundary == 'fluid' else 'C1')
plt.gca().set_aspect('equal')
plt.show()
@gavinmacaulay gavinmacaulay added the help wanted Extra attention is needed label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant