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

View File

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