Skip to content
Snippets Groups Projects
Commit 2c57c0bb authored by Marcus Herrmann's avatar Marcus Herrmann
Browse files

Improving pseudo-highpass filtering

(only used in post-precessing for determining max. amplitudes)
parent e0e3d616
No related branches found
No related tags found
No related merge requests found
......@@ -532,22 +532,33 @@ def _waveform_processing_trace(trace, resampling, procType='bandpass', freqMax=N
# We filter first, and then re/downsample;
# This costs more performance (more to filter), but the data will be represented "better"
trace.filter("bandpass", freqmin=config.filtConf[0],
freqmax=config.filtConf[1], corners=config.filtConf[2])
if procType == 'bandpass' and config.FFT_filt is False:
corners = config.filtConf[2]
zerophase = False
if zerophase:
corners = corners//2
trace.filter("bandpass", freqmin=config.filtConf[0], freqmax=config.filtConf[1],
corners=corners, zerophase=zerophase)
elif procType == 'highpass':
trace.filter("highpass", freq=1.0)
# If maximum freq specified, apply also a low-pass filter
# (to remove too-high frequencies that disturb the amplitude comparison)
if freqMax:
if not freqMax:
trace.filter("highpass", freq=1.0) # 4th order
else:
# If maximum freq specified, apply a bandpass filter
# (to remove too-high frequencies that disturb the amplitude comparison)
# Determine lowest senseful frequency
# (at max, only up to Nyquist of original signal, or
# if signal will be resampled below/equal Nyquist freq, take the new sampling rate)
freqmax = min(resampling if resampling else float('Inf'), # New sampling freq
trace.stats.sampling_rate//2, # Nyguist freq
trace.stats.sampling_rate//2, # Nyguist freq
freqMax) # Specified max. freq
trace.filter("lowpass", freq=freqmax)
trace.filter("bandpass", freqmin=1.0, freqmax=freqmax) # 4th order
# Apply 50Hz bandSTOP filter if configured
if config.stop50Hz and config.FFT_filt is False:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment