[closes #182]
noiselevel now determined as the maximum of the absolute values of the noisewindow (holds also for signallevel); now the SNR and noiselevel is determined from the filtered waveform
This commit is contained in:
parent
848d11270b
commit
6108519acb
@ -1 +1 @@
|
|||||||
a31e-dirty
|
848d-dirty
|
||||||
|
@ -362,8 +362,12 @@ def getSNR(X, TSNR, t1, tracenum=0):
|
|||||||
x = x - np.mean(x[inoise])
|
x = x - np.mean(x[inoise])
|
||||||
|
|
||||||
# calculate ratios
|
# calculate ratios
|
||||||
noiselevel = np.sqrt(np.mean(np.square(x[inoise])))
|
# noiselevel = np.sqrt(np.mean(np.square(x[inoise])))
|
||||||
signallevel = np.sqrt(np.mean(np.square(x[isignal])))
|
# signallevel = np.sqrt(np.mean(np.square(x[isignal])))
|
||||||
|
|
||||||
|
noiselevel = np.abs(x[inoise]).max()
|
||||||
|
signallevel = np.abs(x[isignal]).max()
|
||||||
|
|
||||||
SNR = signallevel / noiselevel
|
SNR = signallevel / noiselevel
|
||||||
SNRdB = 10 * np.log10(SNR)
|
SNRdB = 10 * np.log10(SNR)
|
||||||
|
|
||||||
|
@ -516,31 +516,34 @@ class PickDlg(QDialog):
|
|||||||
gap_win = settings.value('picking/gap_win_P', .2)
|
gap_win = settings.value('picking/gap_win_P', .2)
|
||||||
signal_win = settings.value('picking/signal_win_P', 3.)
|
signal_win = settings.value('picking/signal_win_P', 3.)
|
||||||
|
|
||||||
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick)
|
# copy data for plotting
|
||||||
|
|
||||||
snr = result[0]
|
|
||||||
noiselevel = result[2] * nfac
|
|
||||||
|
|
||||||
data = self.getWFData().copy()
|
data = self.getWFData().copy()
|
||||||
|
|
||||||
|
# filter data and trace on which is picked prior to determination of SNR
|
||||||
phase = self.selectPhase.currentText()
|
phase = self.selectPhase.currentText()
|
||||||
filteroptions = self.getFilterOptions(phase).parseFilterOptions()
|
filteroptions = self.getFilterOptions(phase).parseFilterOptions()
|
||||||
data.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
|
wfdata.filter(**filteroptions)
|
||||||
|
|
||||||
|
# determine SNR and noiselevel
|
||||||
|
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick)
|
||||||
|
snr = result[0]
|
||||||
|
noiselevel = result[2] * nfac
|
||||||
|
|
||||||
|
# prepare plotting of data
|
||||||
for trace in data:
|
for trace in data:
|
||||||
t = prepTimeAxis(trace.stats.starttime - self.getStartTime(), trace)
|
t = prepTimeAxis(trace.stats.starttime - self.getStartTime(), trace)
|
||||||
inoise = getnoisewin(t, ini_pick, noise_win, gap_win)
|
inoise = getnoisewin(t, ini_pick, noise_win, gap_win)
|
||||||
trace = demeanTrace(trace, inoise)
|
trace = demeanTrace(trace, inoise)
|
||||||
|
|
||||||
|
# account for non-oriented horizontal waveforms
|
||||||
try:
|
try:
|
||||||
horiz_comp = ('n', 'e')
|
horiz_comp = ('n', 'e')
|
||||||
data = scaleWFData(data, noiselevel * 2.5, horiz_comp)
|
data = scaleWFData(data, noiselevel * 2.5, horiz_comp)
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
print('warning: {0}'.format(e))
|
print('warning: {0}'.format(e))
|
||||||
horiz_comp = ('1', '2')
|
horiz_comp = ('1', '2')
|
||||||
|
data = scaleWFData(data, noiselevel * 2.5, horiz_comp)
|
||||||
data = scaleWFData(data, noiselevel * 2.5, horiz_comp)
|
|
||||||
|
|
||||||
|
|
||||||
x_res = getResolutionWindow(snr)
|
x_res = getResolutionWindow(snr)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user