Testing new compactness fitness function.

这个提交包含在:
Craig Warren
2016-04-01 16:54:50 +01:00
父节点 7a8e0b9aa5
当前提交 9a148ff5a1

查看文件

@@ -211,17 +211,20 @@ def compactness(filename, args):
thresholdpeak = 1e-3
peaks = [peak for peak in peaks if np.abs(outputdata[peak]) > thresholdpeak]
# Percentage of maximum value to measure compactness of signal
durationthreshold = 2
# Check if there is a peak/trough smaller than threshold
durationthresholdexist = np.where(np.abs(outputdata[peaks]) < (peak * (durationthreshold / 100)))[0]
if durationthresholdexist.size == 0:
compactness = time[peaks[-1]]
else:
time2threshold = time[peaks[durationthresholdexist[0]]]
compactness = time2threshold - time[min(peaks)]
# Amplitude ratio of the 1st to 3rd peak - hopefully be a measure of a compact envelope
compactness = np.abs(outputdata[peaks[0]]) / np.abs(outputdata[peaks[2]])
# # Percentage of maximum value to measure compactness of signal
# durationthreshold = 2
# # Check if there is a peak/trough smaller than threshold
# durationthresholdexist = np.where(np.abs(outputdata[peaks]) < (peak * (durationthreshold / 100)))[0]
# if durationthresholdexist.size == 0:
# compactness = time[peaks[-1]]
# else:
# time2threshold = time[peaks[durationthresholdexist[0]]]
# compactness = time2threshold - time[min(peaks)]
return (1 / compactness)
return compactness