Skip to content

Commit

Permalink
Add example of using high-pass model
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmacaulay committed Dec 1, 2024
1 parent 4982995 commit f5e397c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/example_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import trimesh

from echosms import MSSModel, PSMSModel, DCMModel, ESModel, PTDWBAModel, KAModel, DWBAModel
from echosms import HPModel
from echosms import BenchmarkData
from echosms import ReferenceModels
from echosms import as_dataframe, as_dataarray
Expand Down Expand Up @@ -272,6 +273,26 @@ def plot_compare_angle(theta1, ts1, label1, theta2, ts2, label2, title):
plt.title('WC12 calibration sphere')
plt.show()

# %% ###############################################################################################
# Try the high-pass model
mod = HPModel()
p = {'boundary_type': 'fixed rigid', 'shape': 'sphere', 'medium_c': 1500, 'a': 0.01,
'f': np.arange(1, 400, 1)*1e3}
fixed_rigid = mod.calculate_ts(p)
p['boundary_type'] = 'elastic'
p |= {'medium_rho': 1024, 'target_c': 1600, 'target_rho': 1600}
elastic = mod.calculate_ts(p)
p['boundary_type'] = 'fluid filled'
p |= {'medium_rho': 1024, 'target_c': 1510, 'target_rho': 1025}
fluid = mod.calculate_ts(p)

plt.semilogx(p['f']/1e3, fixed_rigid, label='fixed rigid')
plt.semilogx(p['f']/1e3, elastic, label='elastic')
plt.semilogx(p['f']/1e3, fluid, label='fluid filled')
plt.legend()
plt.xlabel('Frequency [kHz]')
plt.ylabel('TS re 1m$2$ [dB]')

# %% ###############################################################################################
# Some other ways to run models.

Expand Down

0 comments on commit f5e397c

Please sign in to comment.