Merge branch 'develop' of ariadne.geophysik.rub.de:/data/git/pylot into develop

This commit is contained in:
Ludger Küperkoch
2015-02-23 15:06:22 +01:00
3 changed files with 81 additions and 45 deletions

View File

@@ -95,7 +95,7 @@ class Data(object):
raise KeyError('''{0} export format
not implemented: {1}'''.format(evtformat, e))
def plotData(self, widget):
def plotWFData(self, widget):
wfst = self.getWFData().select(component=self.getComp())
for n, trace in enumerate(wfst):
stime = trace.stats.starttime - self.getCutTimes()[0]
@@ -104,7 +104,7 @@ class Data(object):
nsamp = len(trace.data)
tincr = trace.stats.delta
time_ax = np.arange(stime, nsamp / srate, tincr)
trace.normalize()
trace.normalize(trace.data.max() * 2)
widget.axes.plot(time_ax, trace.data + n, 'k')
xlabel = 'seconds since {0}'.format(self.getCutTimes()[0])
ylabel = ''
@@ -121,7 +121,7 @@ class Data(object):
except:
return 'smi:bug/pylot/1234'
def filter(self, kwargs):
def filterWFData(self, kwargs):
self.getWFData().filter(**kwargs)
self.dirty = True
@@ -130,17 +130,28 @@ 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:
assert isinstance(fnames, list), "input parameter 'fnames' is " \
"supposed to be of type 'list' " \
"but is actually".format(type(fnames))
if self.dirty:
self.resetWFData()
warnmsg = ''
for fname in fnames:
try:
self.wfdata += read(fname)
except TypeError:
self.wfdata += read(fname, format='GSE2')
try:
self.wfdata += read(fname, format='GSE2')
except Exception:
warnmsg += '{0}\n'.format(fname)
if warnmsg:
warnmsg = 'WARNING: unable to read\n' + warnmsg
print warnmsg
def getWFData(self):
return self.wfdata
@@ -351,6 +362,5 @@ class SeiscompDataStructure(object):
self.getFields()['NET'],
self.getFields()['STA'],
fullChan,
'*{0}'.format(self.getFields()['DAY'])
)
'*{0}'.format(self.getFields()['DAY']))
return dataPath

View File

@@ -52,6 +52,7 @@ class MPLWidget(FigureCanvas):
self.figure = Figure()
self.canvas = FigureCanvas(self.figure)
self.axes = self.figure.add_subplot(111)
self.axes.autoscale(tight=True)
self.updateWidget(xlabel, ylabel, title)
@@ -109,8 +110,7 @@ class PropertiesDlg(QDialog):
def accept(self, *args, **kwargs):
self.apply()
self.destroy()
return self.accepted
QDialog.accept(self)
def apply(self):
for widint in range(self.tabWidget.count()):
@@ -307,15 +307,15 @@ class FilterOptionsDialog(QDialog):
self.freqminSpinBox.setRange(5e-7, 1e6)
self.freqminSpinBox.setDecimals(2)
self.freqminSpinBox.setSuffix(' Hz')
self.freqminSpinBox.setValue(self.getFilterOptions().getFreq[0])
self.freqminSpinBox.setValue(self.getFilterOptions().getFreq()[0])
self.freqmaxLabel = QLabel()
self.freqmaxLabel.setText("maximum:")
self.freqmaxSpinBox = QDoubleSpinBox()
self.freqmaxSpinBox.setRange(5e-7, 1e6)
self.freqmaxSpinBox.setDecimals(2)
self.freqmaxSpinBox.setSuffix(' Hz')
if self.filterOptions.filterType in ['bandpass', 'bandstop']:
self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq[1])
if self.getFilterOptions().getFilterType() in ['bandpass', 'bandstop']:
self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq()[1])
typeOptions = ["bandpass", "bandstop", "lowpass", "highpass"]
@@ -369,10 +369,10 @@ class FilterOptionsDialog(QDialog):
self.freqmaxLabel.setEnabled(True)
self.freqmaxSpinBox.setEnabled(True)
self.filterOptions.filterType = self.selectTypeCombo.currentText()
self.getFilterOptions().setFilterType(self.selectTypeCombo.currentText())
freq = []
freq.append(self.freqminSpinBox.value())
if self.filterOptions.filterType in ['bandpass', 'bandstop']:
if self.getFilterOptions().getFilterType() in ['bandpass', 'bandstop']:
if self.freqminSpinBox.value() > self.freqmaxSpinBox.value():
QMessageBox.warning(self, "Value error",
"Maximum frequency must be at least the "
@@ -382,8 +382,8 @@ class FilterOptionsDialog(QDialog):
self.freqmaxSpinBox.setFocus()
return
freq.append(self.freqmaxSpinBox.value())
self.filterOptions.freq = freq
self.filterOptions.order = self.orderSpinBox.value()
self.getFilterOptions().setFreq(freq)
self.getFilterOptions().setOrder(self.orderSpinBox.value())
def getFilterOptions(self):
return self.filterOptions