-
Notifications
You must be signed in to change notification settings - Fork 5
Description
In reviewing code to calculate the scattering by a weakly-scattering prolate spheroid found in:
https://github.com/CRIMAC-WP4-Machine-learning/Prol_Spheroid,
I compared their results to those in echoSMs and to the benchmark.
The results and parameters are in the attached file, WkProlateSpheroid.ods.
The Prol_Spheroid results matched the benchmark quite well, with some errors at the nulls. Their code bombed when I got to 258 kHz (for a prolate spheroid with a=0.07 m and b=0.01 m), which is why there are no values beyond this frequency.
However, the echoSMS PSMS model did not fare as well. I ran this on a google cloud workstation, linux-base e2-standard-8.
Here is my code:
from echosms import PSMSModel, BenchmarkData, ReferenceModels
from sys import exit
import numpy as np
rm = ReferenceModels()
# help(rm)
# dir(rm)
rm_type = 'weakly scattering prolate spheroid'
print('Reference model selected: {0}'.format(rm_type))
# select the model
model = PSMSModel()
# the reference model target type information
rm_spec = rm.specification(rm_type)
# get the parameters for that reference model target type
rm_par = rm.parameters(rm_type)
bmd = BenchmarkData()
bmd_pd = bmd.freq_dataset # this is a Pandas DataFrame
# benchmark data column names
bmd_colnames = bmd_pd.columns
# map the reference model to the benchmark data column
rmbmd_map = {}
for i in range(len(bmd_colnames)-1):
rmbmd_map[rm.names()[i]] = bmd_colnames[i+1]
# benchmark target selection
# match the benchmark data to the reference model
if (rm_type not in rmbmd_map.keys()):
print('Reference Model: {0} does not have benchmark data. Exiting'.format(rm_type))
exit()
bmd_type = rmbmd_map[rm_type]
# use the same frequencies as the benchmark, convert to Hz
rm_par['f'] = bmd_pd['frequency (kHz)']*1e3
rm_par['theta'] = 90
TS = model.calculate_ts(rm_par)
# comparison to the benchmark data
jech_index = np.mean(np.abs(TS - bmd_pd[bmd_type]))
I did find the echoSMs PSMS model calculated for the full range of f and was considerably faster (but I didn't do any time trials).