make waveform filtering work (in progress)

This commit is contained in:
Sebastian Wehling-Benatelli 2015-02-20 08:38:26 +01:00
parent 4344a7c8a6
commit 4184fcffdc
2 changed files with 19 additions and 20 deletions

View File

@ -365,6 +365,7 @@ class MainWindow(QMainWindow):
if not key.startswith('freq'): if not key.startswith('freq'):
return True return True
return False return False
if self.filterAction.isChecked():
kwargs = {} kwargs = {}
freq = self.getFilterOptions().getFreq() freq = self.getFilterOptions().getFreq()
if freq is not None and len(freq) > 1: if freq is not None and len(freq) > 1:
@ -372,13 +373,13 @@ class MainWindow(QMainWindow):
kwargs['freqmax'] = freq[1] kwargs['freqmax'] = freq[1]
elif freq is not None and len(freq) == 1: elif freq is not None and len(freq) == 1:
kwargs['freq'] = freq kwargs['freq'] = freq
if hasfreq(kwargs): if hasfreq(kwargs):
kwargs['type'] = self.getFilterOptions().getFilterType() kwargs['type'] = self.getFilterOptions().getFilterType()
kwargs['corners'] = self.getFilterOptions().getOrder() kwargs['corners'] = self.getFilterOptions().getOrder()
self.getData().filter(kwargs)
self.getData().filterWFData(kwargs) self.getData().filterWFData(kwargs)
else:
self.getData().resetWFData() self.getData().resetWFData()
self.plotWaveformData()
def adjustFilterOptions(self): def adjustFilterOptions(self):
filteroptions = None filteroptions = None
@ -412,6 +413,8 @@ class MainWindow(QMainWindow):
emsg.showMessage('Error: {0}'.format(e)) emsg.showMessage('Error: {0}'.format(e))
else: else:
self.updateStatus('Filter loaded ...') self.updateStatus('Filter loaded ...')
if self.filterAction.isChecked():
self.filterWaveformData()
def getSeismicPhase(self): def getSeismicPhase(self):
return self.seismicPhase return self.seismicPhase

View File

@ -130,18 +130,15 @@ class Data(object):
self.wforiginal = None self.wforiginal = None
if fnames is not None: if fnames is not None:
self.appendWFData(fnames) self.appendWFData(fnames)
self.orig = self.getWFData().copy() self.wforiginal = self.getWFData().copy()
self.dirty = False self.dirty = False
def appendWFData(self, fnames): def appendWFData(self, fnames):
if self.dirty is not False:
self.resetWFData()
assert isinstance(fnames, list), "input parameter 'fnames' is " \ assert isinstance(fnames, list), "input parameter 'fnames' is " \
"supposed to be of type 'list' " \ "supposed to be of type 'list' " \
"but is actually".format(type( "but is actually".format(type(fnames))
fnames)) if self.dirty:
self.resetWFData()
warnmsg = '' warnmsg = ''
for fname in fnames: for fname in fnames:
@ -156,7 +153,6 @@ class Data(object):
warnmsg = 'WARNING: unable to read\n' + warnmsg warnmsg = 'WARNING: unable to read\n' + warnmsg
print warnmsg print warnmsg
def getWFData(self): def getWFData(self):
return self.wfdata return self.wfdata