你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Updated sum of differences function to handle multiple receiver outputs.
这个提交包含在:
@@ -114,14 +114,14 @@ def fitness_xcorr(filename, args):
|
|||||||
|
|
||||||
|
|
||||||
def fitness_diffs(filename, args):
|
def fitness_diffs(filename, args):
|
||||||
"""Sum of the differences (in dB) between a response and a reference response.
|
"""Sum of the differences (in dB) between responses and a reference response.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filename (str): Name of output file
|
filename (str): Name of output file
|
||||||
args (dict): 'refresp' key with path & filename of reference response; 'outputs' key with a list of names (IDs) of outputs (rxs) from input file
|
args (dict): 'refresp' key with path & filename of reference response; 'outputs' key with a list of names (IDs) of outputs (rxs) from input file
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
diffdB (float): Sum of the differences (in dB) between a response and a reference response
|
diffdB (float): Sum of the differences (in dB) between responses and a reference response
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Load (from gprMax output file) the reference response
|
# Load (from gprMax output file) the reference response
|
||||||
@@ -134,15 +134,15 @@ def fitness_diffs(filename, args):
|
|||||||
f = h5py.File(filename, 'r')
|
f = h5py.File(filename, 'r')
|
||||||
nrx = f.attrs['nrx']
|
nrx = f.attrs['nrx']
|
||||||
|
|
||||||
|
diffdB = 0
|
||||||
for rx in range(1, nrx + 1):
|
for rx in range(1, nrx + 1):
|
||||||
tmp = f['/rxs/rx' + str(rx) + '/']
|
tmp = f['/rxs/rx' + str(rx) + '/']
|
||||||
if tmp.attrs['Name'] in args['outputs']:
|
if tmp.attrs['Name'] in args['outputs']:
|
||||||
fieldname = list(tmp.keys())[0]
|
fieldname = list(tmp.keys())[0]
|
||||||
modelresp = np.array(tmp[fieldname])
|
modelresp = np.array(tmp[fieldname])
|
||||||
|
# Calculate sum of differences
|
||||||
# Calculate sum of differences
|
tmp = 20 * np.log10(np.abs(modelresp - refresp) / np.amax(np.abs(refresp)))
|
||||||
diffdB = 20 * np.log10(np.abs(modelresp - refresp) / np.amax(np.abs(refresp)))
|
tmp = np.abs(np.sum(tmp[-np.isneginf(tmp)])) / len(tmp[-np.isneginf(tmp)])
|
||||||
diffdB = np.abs(np.sum(diffdB[-np.isneginf(diffdB)])) / len(diffdB[-np.isneginf(diffdB)])
|
|
||||||
|
|
||||||
return diffdB
|
return diffdB
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户