Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop
This commit is contained in:
commit
48c889129a
9 files changed
+323
-219
No files matched your search
+17
-10
@@ -386,8 +386,8 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
raise DatastructureError('not specified')
|
raise DatastructureError('not specified')
|
||||||
return self.fnames
|
return self.fnames
|
||||||
except DatastructureError, e:
|
except DatastructureError as e:
|
||||||
print e
|
print(e)
|
||||||
props = PropertiesDlg(self)
|
props = PropertiesDlg(self)
|
||||||
if props.exec_() == QDialog.Accepted:
|
if props.exec_() == QDialog.Accepted:
|
||||||
return self.getWFFnames()
|
return self.getWFFnames()
|
||||||
@@ -410,7 +410,7 @@ class MainWindow(QMainWindow):
|
|||||||
def saveData(self):
|
def saveData(self):
|
||||||
|
|
||||||
def getSavePath(e):
|
def getSavePath(e):
|
||||||
print 'warning: {0}'.format(e)
|
print('warning: {0}'.format(e))
|
||||||
directory = os.path.join(self.getRoot(), self.getEventFileName())
|
directory = os.path.join(self.getRoot(), self.getEventFileName())
|
||||||
file_filter = "QuakeML file (*.xml);;VELEST observation file format (*.cnv);;NonLinLoc observation file (*.obs)"
|
file_filter = "QuakeML file (*.xml);;VELEST observation file format (*.cnv);;NonLinLoc observation file (*.obs)"
|
||||||
fname = QFileDialog.getSaveFileName(self, 'Save event data ...',
|
fname = QFileDialog.getSaveFileName(self, 'Save event data ...',
|
||||||
@@ -513,7 +513,7 @@ class MainWindow(QMainWindow):
|
|||||||
def plotWaveformData(self):
|
def plotWaveformData(self):
|
||||||
zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'}
|
zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'}
|
||||||
comp = self.getComponent()
|
comp = self.getComponent()
|
||||||
title = 'overview: {0} components'.format(zne_text[comp])
|
title = 'section: {0} components'.format(zne_text[comp])
|
||||||
wfst = self.getData().getWFData().select(component=comp)
|
wfst = self.getData().getWFData().select(component=comp)
|
||||||
self.getPlotWidget().plotWFData(wfdata=wfst, title=title)
|
self.getPlotWidget().plotWFData(wfdata=wfst, title=title)
|
||||||
self.draw()
|
self.draw()
|
||||||
@@ -574,8 +574,8 @@ class MainWindow(QMainWindow):
|
|||||||
def getFilterOptions(self):
|
def getFilterOptions(self):
|
||||||
try:
|
try:
|
||||||
return self.filteroptions[self.getSeismicPhase()]
|
return self.filteroptions[self.getSeismicPhase()]
|
||||||
except AttributeError, e:
|
except AttributeError as e:
|
||||||
print e
|
print(e)
|
||||||
return FilterOptions(None, None, None)
|
return FilterOptions(None, None, None)
|
||||||
|
|
||||||
def getFilters(self):
|
def getFilters(self):
|
||||||
@@ -592,12 +592,12 @@ class MainWindow(QMainWindow):
|
|||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
if settings.value("filterdefaults",
|
if settings.value("filterdefaults",
|
||||||
None) is None and not self.getFilters():
|
None) is None and not self.getFilters():
|
||||||
for key, value in FILTERDEFAULTS.iteritems():
|
for key, value in FILTERDEFAULTS.items():
|
||||||
self.setFilterOptions(FilterOptions(**value), key)
|
self.setFilterOptions(FilterOptions(**value), key)
|
||||||
elif settings.value("filterdefaults", None) is not None:
|
elif settings.value("filterdefaults", None) is not None:
|
||||||
for key, value in settings.value("filterdefaults"):
|
for key, value in settings.value("filterdefaults"):
|
||||||
self.setFilterOptions(FilterOptions(**value), key)
|
self.setFilterOptions(FilterOptions(**value), key)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self.updateStatus('Error ...')
|
self.updateStatus('Error ...')
|
||||||
emsg = QErrorMessage(self)
|
emsg = QErrorMessage(self)
|
||||||
emsg.showMessage('Error: {0}'.format(e))
|
emsg.showMessage('Error: {0}'.format(e))
|
||||||
@@ -636,8 +636,12 @@ class MainWindow(QMainWindow):
|
|||||||
if pickDlg.exec_():
|
if pickDlg.exec_():
|
||||||
self.setDirty(True)
|
self.setDirty(True)
|
||||||
self.updateStatus('picks accepted ({0})'.format(station))
|
self.updateStatus('picks accepted ({0})'.format(station))
|
||||||
self.addPicks(station, pickDlg.getPicks())
|
replot = self.addPicks(station, pickDlg.getPicks())
|
||||||
self.drawPicks(station)
|
if replot:
|
||||||
|
self.plotWaveformData()
|
||||||
|
self.drawPicks()
|
||||||
|
else:
|
||||||
|
self.drawPicks(station)
|
||||||
else:
|
else:
|
||||||
self.updateStatus('picks discarded ({0})'.format(station))
|
self.updateStatus('picks discarded ({0})'.format(station))
|
||||||
|
|
||||||
@@ -667,6 +671,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def addPicks(self, station, picks):
|
def addPicks(self, station, picks):
|
||||||
stat_picks = self.getPicksOnStation(station)
|
stat_picks = self.getPicksOnStation(station)
|
||||||
|
rval = False
|
||||||
if not stat_picks:
|
if not stat_picks:
|
||||||
stat_picks = picks
|
stat_picks = picks
|
||||||
else:
|
else:
|
||||||
@@ -684,11 +689,13 @@ class MainWindow(QMainWindow):
|
|||||||
ret = msgBox.exec_()
|
ret = msgBox.exec_()
|
||||||
if ret == QMessageBox.Save:
|
if ret == QMessageBox.Save:
|
||||||
stat_picks = picks
|
stat_picks = picks
|
||||||
|
rval = True
|
||||||
elif ret == QMessageBox.Cancel:
|
elif ret == QMessageBox.Cancel:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise Exception('FATAL: Should never occur!')
|
raise Exception('FATAL: Should never occur!')
|
||||||
self.getPicks()[station] = stat_picks
|
self.getPicks()[station] = stat_picks
|
||||||
|
return rval
|
||||||
|
|
||||||
def updatePicks(self):
|
def updatePicks(self):
|
||||||
evt = self.getData().getEvtData()
|
evt = self.getData().getEvtData()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<file>icons/pylot.ico</file>
|
<file>icons/pylot.ico</file>
|
||||||
<file>icons/pylot.png</file>
|
<file>icons/pylot.png</file>
|
||||||
<file>icons/printer.png</file>
|
<file>icons/printer.png</file>
|
||||||
|
<file>icons/delete.png</file>
|
||||||
<file>icons/key_E.png</file>
|
<file>icons/key_E.png</file>
|
||||||
<file>icons/key_N.png</file>
|
<file>icons/key_N.png</file>
|
||||||
<file>icons/key_P.png</file>
|
<file>icons/key_P.png</file>
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
+4
-4
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
# Resource object code
|
# Resource object code
|
||||||
#
|
#
|
||||||
# Created: Di. Juli 21 07:58:08 2015
|
# Created: Fr. Sep. 25 09:00:19 2015
|
||||||
# by: The Resource Compiler for PySide (Qt v4.8.6)
|
# by: The Resource Compiler for PySide (Qt v4.8.6)
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PySide import QtCore
|
from PySide import QtCore
|
||||||
|
|
||||||
qt_resource_data = "\x00\x00\x9e\x04\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02\x80\x00\x00\x01\x00\x08\x06\x00\x00\x00#\x95\xc7f\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\x09pHYs\x00\x00\x17\x12\x00\x00\x17\x12\x01g\x9f\xd2R\x00\x00\x00\x07tIME\x07\xdf\x07\x07\x090\x11\xbal\xcd}\x00\x00 \x00IDATx\xda\xec}w\x94\x5c\xe5y\xfe3w\xee\xf4\x99\x9d\xb2\xb3;\xdb\x9bV\xbb*+\xd1-\x0c\xa2\x83\xb0\x0d\x1cSbL\xe28v0v|lp\x0eq\x09\x04\x88c\x1cl\x9c\xe08\x80K\x82c\xe3\xb8!sL\x5c\xe4P\x02\x18\x04\x085TWm{/\xb3\xd3{\xbf\xf3\xfbC\xbf\xf7\xf3\x9d\xbb\xb3\xb3\xbb\xd2\xae\xb4\xda\xfd\x9est\xa4\x1d\xcd\xcc\xce|\xed}\xbe\xe7m\xaa|>\x9f\x07\x07\x07\x07\x07\x07\xc79\x8c|>\x8fT*\x85\xed\xdb\xb7#\x95J!\x97\xcb\xe1\xb6\xdbn\x83$I\x10\x04\x81\x0f\x10\x07\x87\x02|Wppppp\x9c\xf3P\xa9T\xc8\xe7\xf3\xc8\xe7\xf3P\xa9T\xc8\xe5r|P888\x01\xe4\xe0\xe0\xe0\xe0X\xee\xe0\x0e-\x0e\x0eN\x009888888888\x01\xe4\xe0\xe0\xe0\xe0X\xee\xe0* \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x9c\xfcqppp\x02\xc8\xc1\xc1\xc1\xc1\xc1I \x07\x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x9c\xfcqpp\x02\xc8\xc1\xc1\xc1\xc1\xc1\xc1\x09 \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x9c\x00rppppp,%P!h\x0e\x0e\x0eN\x009888888888\x01\xe4\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\x04\x90\x83\x83\x83\x83\x83\xe3\x9c\x07w\x01spp\x02\xc8\xc1\xc1\xc1\xc1\xc1\x01\x95J\xc5\x07\x81\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\xe5\x0aI\x92\xb8\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7J\x05W\xfe888\x01\xe4\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\x04\x90\x83\x83\x83\x83c\xb9A\xe9\xfe\x95$\x89\x0f\x0a\x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\xcb\x9d\x00\xcaI\x1f\x8f\x07\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x05\x10@\xe5\xcf<\x16\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15D\x02\xb9\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7\x0a \x7fr\xc5\x8f\x13@\x0e\x0eN\x0098888V\x08\x09\xe4\x04\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15D\xfe\xe4\xa4\x8fg\x01spp\x02\xc8\xc1\xc1\xc1\xc1\xb1\x02\x08 A\xa5Rq\x05\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x95F\x029\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x05\x91?N\x00988\x01\xe4\xe0\xe0\xe0\xe0X!\x04\x90\xc7\x00rpp\x02\xc8\xc1\xc1\xc1\xc1\xb1\x02\x09 \x95\x82\xe1\x0a \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c+\x0cR\x9e+\x80\x1c\x1c\x9c\x00rpppp\xac(p\x05\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15F\xfc\xf2\x12'\x80\x1c\x1c\x9c\x00rpppp\xacH\x22\xc8\xc1\xc1\xc1\x09 \x07\x07\x07\x07\x07'\x80\x1c\x1c\x9c\x00\xf2!\xe0\xe0\xe0\xe0\xe0Xn\xe0\x9d@888\x01\xe4\xe0\xe0\xe0\xe0X\x81\xe0\x04\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15\x86\x5c.\xc7\x07\x81\x83\x83\x13@\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0eN\x0098888\x96-x+8\x0e\x0eN\x0098888V\x18x\x0c \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c+\x0c\x5c\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x85\x81+\x80\x1c\x1c\x9c\x00rpppp\xac \xf0:\x80\x1c\x1c\x9c\x00rpppp\xac@p\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7\x0a\x03\x8f\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83\x83\x13@\x0e\x0e\x0eN\x0098888\x963\xb8\x0b\x98\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15\x04\x95J\x85L&\xc3\x07\x82\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x95\x04\xde\x0b\x98\x83cf\x88\x8b\xf5\xc6$\xbds\x09~\xf1o\xb9\xf2\xbf\xf3\xf9<\xfb7\x07\xc7b\xedm\xf9:+\xb5\xc7\xe9y\xf4\xb7r\xbdrpp\xfc\x09\x14\xb3\xc8K\xd8,\xdf\xb3S~n\xe6\xf3y\xa8\xd5\xeai\xf6\xfc\x9c$\x80\xf9|\x1e\xd9l\x16*\x95\x0a\x92$A\x92\xa4i\xc6\x82c\xe1\x17\x92\xdc\xb0\x0a\x82P\xf0X\xb1\xe7pp\x9c*\xe9\xa3}M\xc6\xaa\xd4\xfe\xce\xe7\xf3\xc8\xe5r\x10\x04\x81\xad?A\x10\xa0V\xab\xa1R\xa9\x0a\x0e>\x0e\x8e\x85\x14\x1e\x94\x84j\xa9\x93>I\x92\x98ZI{\x8a\xdb\xcd\xe5\xb76%I\x82J\xa5*8\x17\xe9L\x14\x04\x81\xfd9\xe7\x08`6\x9bE6\x9b\x85$I\xc8d2H\xa5R\xecg2\x14\x1c\x0b\x07Z<D\xeeh\xe1\xd0BR\xfeM7\x0d\x95J\x05Q\x14\xcf\xcam\x83\xe3\xdc>\xb8$IB:\x9d\x86$Il\x7fg\xb3Y\xf6\xff\xc5@\x97\xc1|>\x0f\xadV\x0b\xbd^\x0f\xbd^\x0f\xadV\x0b\x00\x9c\x04r,\x0a\x01\xa4\xbf\x97\xba\x0b8\x9b\xcd\x02\x002\x99\x0c\xb2\xd9,2\x99\x0c\xd2\xe94r\xb9\x5c\xc1e\x8bcy\x81\xe6W\xa3\xd1@\x14E\x98\xcdfh\xb5Zh\xb5\xda3J\xfc\xc5\x85\xfa2\xf4'\x1e\x8f#\x1c\x0e#\x1c\x0e#\x16\x8b!\x99L\x22\x97\xcbq\x02\xb8\xc0 \x05EN\xfch1i\xb5Zh4\x1ah4\x1ah\xb5Z\xf6\x98(\x8aP\xab\xd5\x10E\x11*\x95\x0a\x1a\x8d\xa6@1\xe4\xe0(\xa5R\xa4\xd3i\xa4\xd3i\xb6\xbf#\x91\x08\x92\xc9$\xbb\xe8\x15\x83Z\xadfF\xd8h4\xc2n\xb7\xa3\xbc\xbc\x1cv\xbb\x1d\x1a\x8d\x86\x0f,\xc7\xa2\x13\xac\x5c.\xb7\xa4/\x1a\x99L\x06\x89D\x02\x89D\x02\xa1P\x08\xe1p\x18\x89D\x02\x99L\x86\x13\xc0eL\x00\xb3\xd9,DQ\x84\xd5jEyy9\x9cN',\x16\x0b4\x1a\xcd\x19[\xaf\xe2B~\xa1X,\x86`0\x88\xee\xeenx\xbd^\xf6E\xe4j\x15\xc7\xc2\x19\xe4h4\xca\x16\x92\x5ce\x15E\x11\x06\x83\x01&\x93\x09v\xbb\x1dF\xa3\x11F\xa3\x11z\xbd\x1e:\x9d\x0ez\xbd\x9e\x91C\xadV\x0bA\x10\x18)\xe4\xf3\xc4QLU\xc9\xe5rH\xa7\xd3\x08\x06\x83\xe8\xeb\xeb\xc3\xe8\xe8(\xbbP\x90\xb2\x5c\x0c\xf1x\x1c{\xf7\xeeE,\x16Css3\xd6\xaf_\x8f\x96\x96\x16\x08\x82\x00\xbb\xdd^\xf2\xb5\x1c\x1c\xa7z9\x96\x9f\x93K\x95\x00\x92r\x9eN\xa7\x11\x8dF1>>\x8e\xae\xae.\xe6\xa5!\xdb\xc9\xb1\xfc\xce\xd2\xfd\xfb\xf7cxx\x18v\xbb\x1d\xabW\xaf\xc6\xfa\xf5\xeb!\x08\x02\x13e\xce\x19\x02H_(\x9b\xcd\x22\x16\x8badd\x04\x95\x95\x95\xb8\xfa\xea\xab\x0bT*\x8e\x85_Hr\xfLine truncated
|
qt_resource_data = "\x00\x00\x9e\x04\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\x00\x02\x80\x00\x00\x01\x00\x08\x06\x00\x00\x00#\x95\xc7f\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\x09pHYs\x00\x00\x17\x12\x00\x00\x17\x12\x01g\x9f\xd2R\x00\x00\x00\x07tIME\x07\xdf\x07\x07\x090\x11\xbal\xcd}\x00\x00 \x00IDATx\xda\xec}w\x94\x5c\xe5y\xfe3w\xee\xf4\x99\x9d\xb2\xb3;\xdb\x9bV\xbb*+\xd1-\x0c\xa2\x83\xb0\x0d\x1cSbL\xe28v0v|lp\x0eq\x09\x04\x88c\x1cl\x9c\xe08\x80K\x82c\xe3\xb8!sL\x5c\xe4P\x02\x18\x04\x085TWm{/\xb3\xd3{\xbf\xf3\xfbC\xbf\xf7\xf3\x9d\xbb\xb3\xb3\xbb\xd2\xae\xb4\xda\xfd\x9est\xa4\x1d\xcd\xcc\xce|\xed}\xbe\xe7m\xaa|>\x9f\x07\x07\x07\x07\x07\x07\xc79\x8c|>\x8fT*\x85\xed\xdb\xb7#\x95J!\x97\xcb\xe1\xb6\xdbn\x83$I\x10\x04\x81\x0f\x10\x07\x87\x02|Wppppp\x9c\xf3P\xa9T\xc8\xe7\xf3\xc8\xe7\xf3P\xa9T\xc8\xe5r|P888\x01\xe4\xe0\xe0\xe0\xe0X\xee\xe0\x0e-\x0e\x0eN\x009888888888\x01\xe4\xe0\xe0\xe0\xe0X\xee\xe0* \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x9c\xfcqppp\x02\xc8\xc1\xc1\xc1\xc1\xc1I \x07\x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x9c\xfcqpp\x02\xc8\xc1\xc1\xc1\xc1\xc1\xc1\x09 \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x1c\x9c\x00rppppp,%P!h\x0e\x0e\x0eN\x009888888888\x01\xe4\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\x04\x90\x83\x83\x83\x83\x83\xe3\x9c\x07w\x01spp\x02\xc8\xc1\xc1\xc1\xc1\xc1\x01\x95J\xc5\x07\x81\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\xe5\x0aI\x92\xb8\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7J\x05W\xfe888\x01\xe4\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\xe0\x04\x90\x83\x83\x83\x83c\xb9A\xe9\xfe\x95$\x89\x0f\x0a\x07\x07'\x80\x1c\x1c\x1c\x1c\x1c\xcb\x9d\x00\xcaI\x1f\x8f\x07\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x05\x10@\xe5\xcf<\x16\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15D\x02\xb9\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7\x0a \x7fr\xc5\x8f\x13@\x0e\x0eN\x0098888V\x08\x09\xe4\x04\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15D\xfe\xe4\xa4\x8fg\x01spp\x02\xc8\xc1\xc1\xc1\xc1\xb1\x02\x08 A\xa5Rq\x05\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x95F\x029\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x05\x91?N\x00988\x01\xe4\xe0\xe0\xe0\xe0X!\x04\x90\xc7\x00rpp\x02\xc8\xc1\xc1\xc1\xc1\xb1\x02\x09 \x95\x82\xe1\x0a \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c+\x0cR\x9e+\x80\x1c\x1c\x9c\x00rpppp\xac(p\x05\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15F\xfc\xf2\x12'\x80\x1c\x1c\x9c\x00rpppp\xacH\x22\xc8\xc1\xc1\xc1\x09 \x07\x07\x07\x07\x07'\x80\x1c\x1c\x9c\x00\xf2!\xe0\xe0\xe0\xe0\xe0Xn\xe0\x9d@888\x01\xe4\xe0\xe0\xe0\xe0X\x81\xe0\x04\x90\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15\x86\x5c.\xc7\x07\x81\x83\x83\x13@\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0eN\x0098888\x96-x+8\x0e\x0eN\x0098888V\x18x\x0c \x07\x07'\x80\x1c\x1c\x1c\x1c\x1c+\x0c\x5c\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83c\x85\x81+\x80\x1c\x1c\x9c\x00rpppp\xac \xf0:\x80\x1c\x1c\x9c\x00rpppp\xac@p\x02\xc8\xc1\xc1\x09 \x07\x07\x07\x07\xc7\x0a\x03\x8f\x01\xe4\xe0\xe0\x04\x90\x83\x83\x83\x83\x83\x13@\x0e\x0e\x0eN\x0098888\x963\xb8\x0b\x98\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x15\x04\x95J\x85L&\xc3\x07\x82\x83\x83\x13@\x0e\x0e\x0e\x0e\x8e\x95\x04\xde\x0b\x98\x83cf\x88\x8b\xf5\xc6$\xbds\x09~\xf1o\xb9\xf2\xbf\xf3\xf9<\xfb7\x07\xc7b\xedm\xf9:+\xb5\xc7\xe9y\xf4\xb7r\xbdrpp\xfc\x09\x14\xb3\xc8K\xd8,\xdf\xb3S~n\xe6\xf3y\xa8\xd5\xeai\xf6\xfc\x9c$\x80\xf9|\x1e\xd9l\x16*\x95\x0a\x92$A\x92\xa4i\xc6\x82c\xe1\x17\x92\xdc\xb0\x0a\x82P\xf0X\xb1\xe7pp\x9c*\xe9\xa3}M\xc6\xaa\xd4\xfe\xce\xe7\xf3\xc8\xe5r\x10\x04\x81\xad?A\x10\xa0V\xab\xa1R\xa9\x0a\x0e>\x0e\x8e\x85\x14\x1e\x94\x84j\xa9\x93>I\x92\x98ZI{\x8a\xdb\xcd\xe5\xb76%I\x82J\xa5*8\x17\xe9L\x14\x04\x81\xfd9\xe7\x08`6\x9bE6\x9b\x85$I\xc8d2H\xa5R\xecg2\x14\x1c\x0b\x07Z<D\xeeh\xe1\xd0BR\xfeM7\x0d\x95J\x05Q\x14\xcf\xcam\x83\xe3\xdc>\xb8$IB:\x9d\x86$Il\x7fg\xb3Y\xf6\xff\xc5@\x97\xc1|>\x0f\xadV\x0b\xbd^\x0f\xbd^\x0f\xadV\x0b\x00\x9c\x04r,\x0a\x01\xa4\xbf\x97\xba\x0b8\x9b\xcd\x02\x002\x99\x0c\xb2\xd9,2\x99\x0c\xd2\xe94r\xb9\x5c\xc1e\x8bcy\x81\xe6W\xa3\xd1@\x14E\x98\xcdfh\xb5Zh\xb5\xda3J\xfc\xc5\x85\xfa2\xf4'\x1e\x8f#\x1c\x0e#\x1c\x0e#\x16\x8b!\x99L\x22\x97\xcbq\x02\xb8\xc0 \x05EN\xfch1i\xb5Zh4\x1ah4\x1ah\xb5Z\xf6\x98(\x8aP\xab\xd5\x10E\x11*\x95\x0a\x1a\x8d\xa6@1\xe4\xe0(\xa5R\xa4\xd3i\xa4\xd3i\xb6\xbf#\x91\x08\x92\xc9$\xbb\xe8\x15\x83Z\xadfF\xd8h4\xc2n\xb7\xa3\xbc\xbc\x1cv\xbb\x1d\x1a\x8d\x86\x0f,\xc7\xa2\x13\xac\x5c.\xb7\xa4/\x1a\x99L\x06\x89D\x02\x89D\x02\xa1P\x08\xe1p\x18\x89D\x02\x99L\x86\x13\xc0eL\x00\xb3\xd9,DQ\x84\xd5jEyy9\x9cN',\x16\x0b4\x1a\xcd\x19[\xaf\xe2B~\xa1X,\x86`0\x88\xee\xeenx\xbd^\xf6E\xe4j\x15\xc7\xc2\x19\xe4h4\xca\x16\x92\x5ce\x15E\x11\x06\x83\x01&\x93\x09v\xbb\x1dF\xa3\x11F\xa3\x11z\xbd\x1e:\x9d\x0ez\xbd\x9e\x91C\xadV\x0bA\x10\x18)\xe4\xf3\xc4QLU\xc9\xe5rH\xa7\xd3\x08\x06\x83\xe8\xeb\xeb\xc3\xe8\xe8(\xbbP\x90\xb2\x5c\x0c\xf1x\x1c{\xf7\xeeE,\x16Css3\xd6\xaf_\x8f\x96\x96\x16\x08\x82\x00\xbb\xdd^\xf2\xb5\x1c\x1c\xa7z9\x96\x9f\x93K\x95\x00\x92r\x9eN\xa7\x11\x8dF1>>\x8e\xae\xae.\xe6\xa5!\xdb\xc9\xb1\xfc\xce\xd2\xfd\xfb\xf7cxx\x18v\xbb\x1d\xabW\xaf\xc6\xfa\xf5\xeb!\x08\x02\x13e\xce\x19\x02H_(\x9b\xcd\x22\x16\x8badd\x04\x95\x95\x95\xb8\xfa\xea\xab\x0bT*\x8e\x85_Hr\xfLine truncated
|
||||||
qt_resource_name = "\x00\x04\x00\x06\xec0\x00h\x00e\x00l\x00p\x00\x05\x00o\xa6S\x00i\x00c\x00o\x00n\x00s\x00\x06\x07\xa7(\x98\x00s\x00p\x00l\x00a\x00s\x00h\x00\x0a\x08\x94\x19\x07\x00s\x00p\x00l\x00a\x00s\x00h\x00.\x00p\x00n\x00g\x00\x09\x0fG\xb4\xc7\x00k\x00e\x00y\x00_\x00T\x00.\x00p\x00n\x00g\x00\x09\x0fC\xb4\xc7\x00k\x00e\x00y\x00_\x00P\x00.\x00p\x00n\x00g\x00\x09\x03g\xa7G\x00p\x00y\x00l\x00o\x00t\x00.\x00p\x00n\x00g\x00\x09\x0fH\xb4\xc7\x00k\x00e\x00y\x00_\x00U\x00.\x00p\x00n\x00g\x00\x09\x0fD\xb4\xc7\x00k\x00e\x00y\x00_\x00Q\x00.\x00p\x00n\x00g\x00\x0a\x0a\xc8\xf7'\x00f\x00i\x00l\x00t\x00e\x00r\x00.\x00p\x00n\x00g\x00\x09\x0f8\xb4\xc7\x00k\x00e\x00y\x00_\x00E\x00.\x00p\x00n\x00g\x00\x0b\x0a*w\xe7\x00p\x00r\x00i\x00n\x00t\x00e\x00r\x00.\x00p\x00n\x00g\x00\x0c\x06\xeb\x91\xa7\x00z\x00o\x00o\x00m\x00_\x00o\x00u\x00t\x00.\x00p\x00n\x00g\x00\x09\x0fM\xb4\xc7\x00k\x00e\x00y\x00_\x00Z\x00.\x00p\x00n\x00g\x00\x0b\x05\x03\x9b'\x00z\x00o\x00o\x00m\x00_\x00i\x00n\x00.\x00p\x00n\x00g\x00\x09\x0fI\xb4\xc7\x00k\x00e\x00y\x00_\x00V\x00.\x00p\x00n\x00g\x00\x09\x0fE\xb4\xc7\x00k\x00e\x00y\x00_\x00R\x00.\x00p\x00n\x00g\x00\x09\x0fA\xb4\xc7\x00k\x00e\x00y\x00_\x00N\x00.\x00p\x00n\x00g\x00\x09\x03g\xbf\x9f\x00p\x00y\x00l\x00o\x00t\x00.\x00i\x00c\x00o\x00\x09\x0fJ\xb4\xc7\x00k\x00e\x00y\x00_\x00W\x00.\x00p\x00n\x00g\x00\x09\x0fF\xb4\xc7\x00k\x00e\x00y\x00_\x00S\x00.\x00p\x00n\x00g\x00\x0a\x033{\x87\x00z\x00o\x00o\x00m\x00_\x000\x00.\x00p\x00n\x00g\x00\x08\x00FX'\x00s\x00y\x00n\x00c\x00.\x00p\x00n\x00g\x00\x0a\x0c\xba\xf2|\x00i\x00n\x00d\x00e\x00x\x00.\x00h\x00t\x00m\x00l"
|
qt_resource_name = "\x00\x04\x00\x06\xec0\x00h\x00e\x00l\x00p\x00\x05\x00o\xa6S\x00i\x00c\x00o\x00n\x00s\x00\x06\x07\xa7(\x98\x00s\x00p\x00l\x00a\x00s\x00h\x00\x0a\x08\x94\x19\x07\x00s\x00p\x00l\x00a\x00s\x00h\x00.\x00p\x00n\x00g\x00\x09\x0fG\xb4\xc7\x00k\x00e\x00y\x00_\x00T\x00.\x00p\x00n\x00g\x00\x09\x0fC\xb4\xc7\x00k\x00e\x00y\x00_\x00P\x00.\x00p\x00n\x00g\x00\x09\x03g\xa7G\x00p\x00y\x00l\x00o\x00t\x00.\x00p\x00n\x00g\x00\x0a\x0c\xad\x0f\x07\x00d\x00e\x00l\x00e\x00t\x00e\x00.\x00p\x00n\x00g\x00\x09\x0fH\xb4\xc7\x00k\x00e\x00y\x00_\x00U\x00.\x00p\x00n\x00g\x00\x09\x0fD\xb4\xc7\x00k\x00e\x00y\x00_\x00Q\x00.\x00p\x00n\x00g\x00\x0a\x0a\xc8\xf7'\x00f\x00i\x00l\x00t\x00e\x00r\x00.\x00p\x00n\x00g\x00\x09\x0f8\xb4\xc7\x00k\x00e\x00y\x00_\x00E\x00.\x00p\x00n\x00g\x00\x0b\x0a*w\xe7\x00p\x00r\x00i\x00n\x00t\x00e\x00r\x00.\x00p\x00n\x00g\x00\x0c\x06\xeb\x91\xa7\x00z\x00o\x00o\x00m\x00_\x00o\x00u\x00t\x00.\x00p\x00n\x00g\x00\x09\x0fM\xb4\xc7\x00k\x00e\x00y\x00_\x00Z\x00.\x00p\x00n\x00g\x00\x0b\x05\x03\x9b'\x00z\x00o\x00o\x00m\x00_\x00i\x00n\x00.\x00p\x00n\x00g\x00\x09\x0fI\xb4\xc7\x00k\x00e\x00y\x00_\x00V\x00.\x00p\x00n\x00g\x00\x09\x0fE\xb4\xc7\x00k\x00e\x00y\x00_\x00R\x00.\x00p\x00n\x00g\x00\x09\x0fA\xb4\xc7\x00k\x00e\x00y\x00_\x00N\x00.\x00p\x00n\x00g\x00\x09\x03g\xbf\x9f\x00p\x00y\x00l\x00o\x00t\x00.\x00i\x00c\x00o\x00\x09\x0fJ\xb4\xc7\x00k\x00e\x00y\x00_\x00W\x00.\x00p\x00n\x00g\x00\x09\x0fF\xb4\xc7\x00k\x00e\x00y\x00_\x00S\x00.\x00p\x00n\x00g\x00\x0a\x033{\x87\x00z\x00o\x00o\x00m\x00_\x000\x00.\x00p\x00n\x00g\x00\x08\x00FX'\x00s\x00y\x00n\x00c\x00.\x00p\x00n\x00g\x00\x0a\x0c\xba\xf2|\x00i\x00n\x00d\x00e\x00x\x00.\x00h\x00t\x00m\x00l"
|
||||||
qt_resource_struct = "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x18\x00\x00\x00\x0e\x00\x02\x00\x00\x00\x13\x00\x00\x00\x05\x00\x00\x00\x1e\x00\x02\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x000\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x02\x0c\x00\x00\x00\x00\x00\x01\x00\x02-\xf0\x00\x00\x01\xf2\x00\x00\x00\x00\x00\x01\x00\x02\x12C\x00\x00\x00z\x00\x00\x00\x00\x00\x01\x00\x00\xbc\xce\x00\x00\x01\xaa\x00\x00\x00\x00\x00\x01\x00\x01\xe9\x0a\x00\x00\x01F\x00\x00\x00\x00\x00\x01\x00\x01\x9dy\x00\x00\x01\x10\x00\x00\x00\x00\x00\x01\x00\x01r\x07\x00\x00\x00\xf4\x00\x00\x00\x00\x00\x01\x00\x01W\xe8\x00\x00\x00\xc2\x00\x00\x00\x00\x00\x01\x00\x016\x0e\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x01\x00\x01Hn\x00\x00\x01\x92\x00\x00\x00\x00\x00\x01\x00\x01\xd90\x00\x00\x00b\x00\x00\x00\x00\x00\x01\x00\x00\xad&\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x01\x00\x01%\xb3\x00\x00\x01z\x00\x00\x00\x00\x00\x01\x00\x01\xc9J\x00\x00\x01\xda\x00\x00\x00\x00\x00\x01\x00\x02\x02a\x00\x00\x00J\x00\x00\x00\x00\x00\x01\x00\x00\x9e\x08\x00\x00\x00\x92\x00\x00\x00\x00\x00\x01\x00\x01\x16\x10\x00\x00\x01b\x00\x00\x00\x00\x00\x01\x00\x01\xb9Y\x00\x00\x01\xc2\x00\x00\x00\x00\x00\x01\x00\x01\xf1\xcc\x00\x00\x01.\x00\x00\x00\x00\x00\x01\x00\x01\x8d\xb6\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x19\x00\x00\x02\x22\x00\x00\x00\x00\x00\x01\x00\x02>\x9e"
|
qt_resource_struct = "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x19\x00\x00\x00\x0e\x00\x02\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00\x1e\x00\x02\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x000\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x02&\x00\x00\x00\x00\x00\x01\x00\x02A\xd3\x00\x00\x02\x0c\x00\x00\x00\x00\x00\x01\x00\x02&&\x00\x00\x00z\x00\x00\x00\x00\x00\x01\x00\x00\xbc\xce\x00\x00\x01\xc4\x00\x00\x00\x00\x00\x01\x00\x01\xfc\xed\x00\x00\x01`\x00\x00\x00\x00\x00\x01\x00\x01\xb1\x5c\x00\x00\x01*\x00\x00\x00\x00\x00\x01\x00\x01\x85\xea\x00\x00\x01\x0e\x00\x00\x00\x00\x00\x01\x00\x01k\xcb\x00\x00\x00\xdc\x00\x00\x00\x00\x00\x01\x00\x01I\xf1\x00\x00\x00\x92\x00\x00\x00\x00\x00\x01\x00\x01\x16\x10\x00\x00\x00\xf6\x00\x00\x00\x00\x00\x01\x00\x01\x5cQ\x00\x00\x01\xac\x00\x00\x00\x00\x00\x01\x00\x01\xed\x13\x00\x00\x00b\x00\x00\x00\x00\x00\x01\x00\x00\xad&\x00\x00\x00\xc4\x00\x00\x00\x00\x00\x01\x00\x019\x96\x00\x00\x01\x94\x00\x00\x00\x00\x00\x01\x00\x01\xdd-\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x01\x00\x02\x16D\x00\x00\x00J\x00\x00\x00\x00\x00\x01\x00\x00\x9e\x08\x00\x00\x00\xac\x00\x00\x00\x00\x00\x01\x00\x01)\xf3\x00\x00\x01|\x00\x00\x00\x00\x00\x01\x00\x01\xcd<\x00\x00\x01\xdc\x00\x00\x00\x00\x00\x01\x00\x02\x05\xaf\x00\x00\x01H\x00\x00\x00\x00\x00\x01\x00\x01\xa1\x99\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x02<\x00\x00\x00\x00\x00\x01\x00\x02R\x81"
|
||||||
def qInitResources():
|
def qInitResources():
|
||||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class Magnitude(object):
|
|||||||
:type: float
|
:type: float
|
||||||
|
|
||||||
:param: pwin, pick window [To To+pwin] to get maximum
|
:param: pwin, pick window [To To+pwin] to get maximum
|
||||||
peak-to-peak amplitude
|
peak-to-peak amplitude (WApp) or to calculate
|
||||||
|
source spectrum (DCfc)
|
||||||
:type: float
|
:type: float
|
||||||
|
|
||||||
:param: iplot, no. of figure window for plotting interims results
|
:param: iplot, no. of figure window for plotting interims results
|
||||||
@@ -40,6 +41,7 @@ class Magnitude(object):
|
|||||||
self.setpwin(pwin)
|
self.setpwin(pwin)
|
||||||
self.setiplot(iplot)
|
self.setiplot(iplot)
|
||||||
self.calcwapp()
|
self.calcwapp()
|
||||||
|
self.calcsourcespec()
|
||||||
|
|
||||||
|
|
||||||
def getwfstream(self):
|
def getwfstream(self):
|
||||||
@@ -68,18 +70,23 @@ class Magnitude(object):
|
|||||||
|
|
||||||
def getwapp(self):
|
def getwapp(self):
|
||||||
return self.wapp
|
return self.wapp
|
||||||
|
|
||||||
|
def getw0(self):
|
||||||
|
return self.w0
|
||||||
|
|
||||||
|
def getfc(self):
|
||||||
|
return self.fc
|
||||||
|
|
||||||
def calcwapp(self):
|
def calcwapp(self):
|
||||||
self.wapp = None
|
self.wapp = None
|
||||||
|
|
||||||
|
|
||||||
def calcsourcespec(self):
|
def calcsourcespec(self):
|
||||||
self.sourcespek = None
|
self.sourcespek = None
|
||||||
|
|
||||||
class WApp(Magnitude):
|
class WApp(Magnitude):
|
||||||
'''
|
'''
|
||||||
Method to derive peak-to-peak amplitude as seen on a Wood-Anderson-
|
Method to derive peak-to-peak amplitude as seen on a Wood-Anderson-
|
||||||
seismograph. Has to be derived from corrected traces!
|
seismograph. Has to be derived from instrument corrected traces!
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def calcwapp(self):
|
def calcwapp(self):
|
||||||
@@ -110,6 +117,7 @@ class WApp(Magnitude):
|
|||||||
iwin = getsignalwin(th, self.getTo(), self.getpwin())
|
iwin = getsignalwin(th, self.getTo(), self.getpwin())
|
||||||
self.wapp = np.max(sqH[iwin])
|
self.wapp = np.max(sqH[iwin])
|
||||||
print ("Determined Wood-Anderson peak-to-peak amplitude: %f mm") % self.wapp
|
print ("Determined Wood-Anderson peak-to-peak amplitude: %f mm") % self.wapp
|
||||||
|
|
||||||
if self.getiplot() > 1:
|
if self.getiplot() > 1:
|
||||||
stream.plot()
|
stream.plot()
|
||||||
f = plt.figure(2)
|
f = plt.figure(2)
|
||||||
@@ -128,10 +136,50 @@ class WApp(Magnitude):
|
|||||||
class DCfc(Magnitude):
|
class DCfc(Magnitude):
|
||||||
'''
|
'''
|
||||||
Method to calculate the source spectrum and to derive from that the plateau
|
Method to calculate the source spectrum and to derive from that the plateau
|
||||||
(the so-called DC-value) and the corner frequency assuming Aki's omega-square
|
(so-called DC-value) and the corner frequency assuming Aki's omega-square
|
||||||
source model. Has to be derived from corrected traces!
|
source model. Has to be derived from instrument corrected displacement traces!
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def calcsourcespec(self):
|
def calcsourcespec(self):
|
||||||
print ("Calculating source spectrum ....")
|
print ("Calculating source spectrum ....")
|
||||||
|
|
||||||
|
self.w0 = None # DC-value
|
||||||
|
self.fc = None # corner frequency
|
||||||
|
|
||||||
|
stream = self.getwfstream()
|
||||||
|
tr = stream[0]
|
||||||
|
|
||||||
|
# get time array
|
||||||
|
t = np.arange(0, len(tr) * tr.stats.delta, tr.stats.delta)
|
||||||
|
iwin = getsignalwin(t, self.getTo(), self.getpwin())
|
||||||
|
xdat = tr.data[iwin]
|
||||||
|
|
||||||
|
# fft
|
||||||
|
fny = tr.stats.sampling_rate / 2
|
||||||
|
l = len(xdat) / tr.stats.sampling_rate
|
||||||
|
n = tr.stats.sampling_rate * l # number of fft bins after Bath
|
||||||
|
# find next power of 2 of data length
|
||||||
|
m = pow(2, np.ceil(np.log(len(xdat)) / np.log(2)))
|
||||||
|
N = int(np.power(m, 2))
|
||||||
|
y = tr.stats.delta * np.fft.fft(xdat, N)
|
||||||
|
Y = abs(y[: N/2])
|
||||||
|
L = (N - 1) / tr.stats.sampling_rate
|
||||||
|
f = np.arange(0, fny, 1/L)
|
||||||
|
|
||||||
|
if self.getiplot() > 1:
|
||||||
|
f1 = plt.figure(1)
|
||||||
|
plt.subplot(2,1,1)
|
||||||
|
plt.plot(t, np.multiply(tr, 1000), 'k') # show displacement in mm
|
||||||
|
plt.plot(t[iwin], np.multiply(xdat, 1000), 'g') # show displacement in mm
|
||||||
|
plt.title('Seismogram and P pulse, station %s' % tr.stats.station)
|
||||||
|
plt.xlabel('Time since %s' % tr.stats.starttime)
|
||||||
|
plt.ylabel('Displacement [mm]')
|
||||||
|
|
||||||
|
plt.subplot(2,1,2)
|
||||||
|
plt.semilogy(f, Y.real)
|
||||||
|
plt.title('Source Spectrum from P Pulse')
|
||||||
|
plt.xlabel('Frequency [Hz]')
|
||||||
|
plt.ylabel('Amplitude [m/Hz]')
|
||||||
|
plt.show()
|
||||||
|
raw_input()
|
||||||
|
plt.close(f1)
|
||||||
+183
-183
@@ -147,7 +147,7 @@ class AICPicker(AutoPicking):
|
|||||||
|
|
||||||
def calcPick(self):
|
def calcPick(self):
|
||||||
|
|
||||||
print 'AICPicker: Get initial onset time (pick) from AIC-CF ...'
|
print('AICPicker: Get initial onset time (pick) from AIC-CF ...')
|
||||||
|
|
||||||
self.Pick = None
|
self.Pick = None
|
||||||
self.slope = None
|
self.slope = None
|
||||||
@@ -155,7 +155,7 @@ class AICPicker(AutoPicking):
|
|||||||
#find NaN's
|
#find NaN's
|
||||||
nn = np.isnan(self.cf)
|
nn = np.isnan(self.cf)
|
||||||
if len(nn) > 1:
|
if len(nn) > 1:
|
||||||
self.cf[nn] = 0
|
self.cf[nn] = 0
|
||||||
#taper AIC-CF to get rid off side maxima
|
#taper AIC-CF to get rid off side maxima
|
||||||
tap = np.hanning(len(self.cf))
|
tap = np.hanning(len(self.cf))
|
||||||
aic = tap * self.cf + max(abs(self.cf))
|
aic = tap * self.cf + max(abs(self.cf))
|
||||||
@@ -163,15 +163,15 @@ class AICPicker(AutoPicking):
|
|||||||
ismooth = int(round(self.Tsmooth / self.dt))
|
ismooth = int(round(self.Tsmooth / self.dt))
|
||||||
aicsmooth = np.zeros(len(aic))
|
aicsmooth = np.zeros(len(aic))
|
||||||
if len(aic) < ismooth:
|
if len(aic) < ismooth:
|
||||||
print 'AICPicker: Tsmooth larger than CF!'
|
print('AICPicker: Tsmooth larger than CF!')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
for i in range(1, len(aic)):
|
for i in range(1, len(aic)):
|
||||||
if i > ismooth:
|
if i > ismooth:
|
||||||
ii1 = i - ismooth
|
ii1 = i - ismooth
|
||||||
aicsmooth[i] = aicsmooth[i - 1] + (aic[i] - aic[ii1]) / ismooth
|
aicsmooth[i] = aicsmooth[i - 1] + (aic[i] - aic[ii1]) / ismooth
|
||||||
else:
|
else:
|
||||||
aicsmooth[i] = np.mean(aic[1 : i])
|
aicsmooth[i] = np.mean(aic[1 : i])
|
||||||
#remove offset
|
#remove offset
|
||||||
offset = abs(min(aic) - min(aicsmooth))
|
offset = abs(min(aic) - min(aicsmooth))
|
||||||
aicsmooth = aicsmooth - offset
|
aicsmooth = aicsmooth - offset
|
||||||
@@ -180,7 +180,7 @@ class AICPicker(AutoPicking):
|
|||||||
#find NaN's
|
#find NaN's
|
||||||
nn = np.isnan(diffcf)
|
nn = np.isnan(diffcf)
|
||||||
if len(nn) > 1:
|
if len(nn) > 1:
|
||||||
diffcf[nn] = 0
|
diffcf[nn] = 0
|
||||||
#taper CF to get rid off side maxima
|
#taper CF to get rid off side maxima
|
||||||
tap = np.hanning(len(diffcf))
|
tap = np.hanning(len(diffcf))
|
||||||
diffcf = tap * diffcf * max(abs(aicsmooth))
|
diffcf = tap * diffcf * max(abs(aicsmooth))
|
||||||
@@ -189,104 +189,104 @@ class AICPicker(AutoPicking):
|
|||||||
#find minimum in AIC-CF front of maximum
|
#find minimum in AIC-CF front of maximum
|
||||||
lpickwindow = int(round(self.PickWindow / self.dt))
|
lpickwindow = int(round(self.PickWindow / self.dt))
|
||||||
for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1):
|
for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1):
|
||||||
if aicsmooth[i - 1] >= aicsmooth[i]:
|
if aicsmooth[i - 1] >= aicsmooth[i]:
|
||||||
self.Pick = self.Tcf[i]
|
self.Pick = self.Tcf[i]
|
||||||
break
|
break
|
||||||
#if no minimum could be found:
|
#if no minimum could be found:
|
||||||
#search in 1st derivative of AIC-CF
|
#search in 1st derivative of AIC-CF
|
||||||
if self.Pick is None:
|
if self.Pick is None:
|
||||||
for i in range(icfmax -1, max([icfmax -lpickwindow, 2]), -1):
|
for i in range(icfmax -1, max([icfmax -lpickwindow, 2]), -1):
|
||||||
if diffcf[i -1] >= diffcf[i]:
|
if diffcf[i -1] >= diffcf[i]:
|
||||||
self.Pick = self.Tcf[i]
|
self.Pick = self.Tcf[i]
|
||||||
break
|
break
|
||||||
|
|
||||||
# quality assessment using SNR and slope from CF
|
# quality assessment using SNR and slope from CF
|
||||||
if self.Pick is not None:
|
if self.Pick is not None:
|
||||||
# get noise window
|
# get noise window
|
||||||
inoise = getnoisewin(self.Tcf, self.Pick, self.TSNR[0], self.TSNR[1])
|
inoise = getnoisewin(self.Tcf, self.Pick, self.TSNR[0], self.TSNR[1])
|
||||||
# check, if these are counts or m/s, important for slope estimation!
|
# check, if these are counts or m/s, important for slope estimation!
|
||||||
# this is quick and dirty, better solution?
|
# this is quick and dirty, better solution?
|
||||||
if max(self.Data[0].data < 1e-3):
|
if max(self.Data[0].data < 1e-3):
|
||||||
self.Data[0].data = self.Data[0].data * 1000000
|
self.Data[0].data = self.Data[0].data * 1000000
|
||||||
# get signal window
|
# get signal window
|
||||||
isignal = getsignalwin(self.Tcf, self.Pick, self.TSNR[2])
|
isignal = getsignalwin(self.Tcf, self.Pick, self.TSNR[2])
|
||||||
# calculate SNR from CF
|
# calculate SNR from CF
|
||||||
self.SNR = max(abs(aic[isignal] - np.mean(aic[isignal]))) / max(abs(aic[inoise] \
|
self.SNR = max(abs(aic[isignal] - np.mean(aic[isignal]))) / \
|
||||||
- np.mean(aic[inoise])))
|
max(abs(aic[inoise] - np.mean(aic[inoise])))
|
||||||
# calculate slope from CF after initial pick
|
# calculate slope from CF after initial pick
|
||||||
# get slope window
|
# get slope window
|
||||||
tslope = self.TSNR[3] #slope determination window
|
tslope = self.TSNR[3] #slope determination window
|
||||||
islope = np.where((self.Tcf <= min([self.Pick + tslope, len(self.Data[0].data)])) \
|
islope = np.where((self.Tcf <= min([self.Pick + tslope, len(self.Data[0].data)])) \
|
||||||
& (self.Tcf >= self.Pick))
|
& (self.Tcf >= self.Pick))
|
||||||
# find maximum within slope determination window
|
# find maximum within slope determination window
|
||||||
# 'cause slope should be calculated up to first local minimum only!
|
# 'cause slope should be calculated up to first local minimum only!
|
||||||
imax = np.argmax(self.Data[0].data[islope])
|
imax = np.argmax(self.Data[0].data[islope])
|
||||||
if imax == 0:
|
if imax == 0:
|
||||||
print 'AICPicker: Maximum for slope determination right at the beginning of the window!'
|
print('AICPicker: Maximum for slope determination right at the beginning of the window!')
|
||||||
print 'Choose longer slope determination window!'
|
print('Choose longer slope determination window!')
|
||||||
if self.iplot > 1:
|
if self.iplot > 1:
|
||||||
p = plt.figure(self.iplot)
|
p = plt.figure(self.iplot)
|
||||||
x = self.Data[0].data
|
x = self.Data[0].data
|
||||||
p1, = plt.plot(self.Tcf, x / max(x), 'k')
|
p1, = plt.plot(self.Tcf, x / max(x), 'k')
|
||||||
p2, = plt.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r')
|
p2, = plt.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r')
|
||||||
plt.legend([p1, p2], ['(HOS-/AR-) Data', 'Smoothed AIC-CF'])
|
plt.legend([p1, p2], ['(HOS-/AR-) Data', 'Smoothed AIC-CF'])
|
||||||
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
plt.title(self.Data[0].stats.station)
|
plt.title(self.Data[0].stats.station)
|
||||||
plt.show()
|
plt.show()
|
||||||
raw_input()
|
raw_input()
|
||||||
plt.close(p)
|
plt.close(p)
|
||||||
return
|
return
|
||||||
islope = islope[0][0 :imax]
|
islope = islope[0][0 :imax]
|
||||||
dataslope = self.Data[0].data[islope]
|
dataslope = self.Data[0].data[islope]
|
||||||
# calculate slope as polynomal fit of order 1
|
# calculate slope as polynomal fit of order 1
|
||||||
xslope = np.arange(0, len(dataslope), 1)
|
xslope = np.arange(0, len(dataslope), 1)
|
||||||
P = np.polyfit(xslope, dataslope, 1)
|
P = np.polyfit(xslope, dataslope, 1)
|
||||||
datafit = np.polyval(P, xslope)
|
datafit = np.polyval(P, xslope)
|
||||||
if datafit[0] >= datafit[len(datafit) - 1]:
|
if datafit[0] >= datafit[len(datafit) - 1]:
|
||||||
print 'AICPicker: Negative slope, bad onset skipped!'
|
print('AICPicker: Negative slope, bad onset skipped!')
|
||||||
return
|
return
|
||||||
self.slope = 1 / tslope * (datafit[len(dataslope) - 1] - datafit[0])
|
self.slope = 1 / tslope * (datafit[len(dataslope) - 1] - datafit[0])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.SNR = None
|
self.SNR = None
|
||||||
self.slope = None
|
self.slope = None
|
||||||
|
|
||||||
if self.iplot > 1:
|
if self.iplot > 1:
|
||||||
p = plt.figure(self.iplot)
|
p = plt.figure(self.iplot)
|
||||||
x = self.Data[0].data
|
x = self.Data[0].data
|
||||||
p1, = plt.plot(self.Tcf, x / max(x), 'k')
|
p1, = plt.plot(self.Tcf, x / max(x), 'k')
|
||||||
p2, = plt.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r')
|
p2, = plt.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r')
|
||||||
if self.Pick is not None:
|
if self.Pick is not None:
|
||||||
p3, = plt.plot([self.Pick, self.Pick], [-0.1 , 0.5], 'b', linewidth=2)
|
p3, = plt.plot([self.Pick, self.Pick], [-0.1 , 0.5], 'b', linewidth=2)
|
||||||
plt.legend([p1, p2, p3], ['(HOS-/AR-) Data', 'Smoothed AIC-CF', 'AIC-Pick'])
|
plt.legend([p1, p2, p3], ['(HOS-/AR-) Data', 'Smoothed AIC-CF', 'AIC-Pick'])
|
||||||
else:
|
else:
|
||||||
plt.legend([p1, p2], ['(HOS-/AR-) Data', 'Smoothed AIC-CF'])
|
plt.legend([p1, p2], ['(HOS-/AR-) Data', 'Smoothed AIC-CF'])
|
||||||
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
plt.title(self.Data[0].stats.station)
|
plt.title(self.Data[0].stats.station)
|
||||||
|
|
||||||
if self.Pick is not None:
|
if self.Pick is not None:
|
||||||
plt.figure(self.iplot + 1)
|
plt.figure(self.iplot + 1)
|
||||||
p11, = plt.plot(self.Tcf, x, 'k')
|
p11, = plt.plot(self.Tcf, x, 'k')
|
||||||
p12, = plt.plot(self.Tcf[inoise], self.Data[0].data[inoise])
|
p12, = plt.plot(self.Tcf[inoise], self.Data[0].data[inoise])
|
||||||
p13, = plt.plot(self.Tcf[isignal], self.Data[0].data[isignal], 'r')
|
p13, = plt.plot(self.Tcf[isignal], self.Data[0].data[isignal], 'r')
|
||||||
p14, = plt.plot(self.Tcf[islope], dataslope, 'g--')
|
p14, = plt.plot(self.Tcf[islope], dataslope, 'g--')
|
||||||
p15, = plt.plot(self.Tcf[islope], datafit, 'g', linewidth=2)
|
p15, = plt.plot(self.Tcf[islope], datafit, 'g', linewidth=2)
|
||||||
plt.legend([p11, p12, p13, p14, p15], ['Data', 'Noise Window', 'Signal Window', 'Slope Window', 'Slope'], \
|
plt.legend([p11, p12, p13, p14, p15], ['Data', 'Noise Window', 'Signal Window', 'Slope Window', 'Slope'],
|
||||||
loc='best')
|
loc='best')
|
||||||
plt.title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station, \
|
plt.title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station,
|
||||||
self.SNR, self.slope))
|
self.SNR, self.slope))
|
||||||
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
||||||
plt.ylabel('Counts')
|
plt.ylabel('Counts')
|
||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
raw_input()
|
raw_input()
|
||||||
plt.close(p)
|
plt.close(p)
|
||||||
|
|
||||||
if self.Pick == None:
|
if self.Pick == None:
|
||||||
print 'AICPicker: Could not find minimum, picking window too short?'
|
print('AICPicker: Could not find minimum, picking window too short?')
|
||||||
|
|
||||||
|
|
||||||
class PragPicker(AutoPicking):
|
class PragPicker(AutoPicking):
|
||||||
@@ -297,102 +297,102 @@ class PragPicker(AutoPicking):
|
|||||||
def calcPick(self):
|
def calcPick(self):
|
||||||
|
|
||||||
if self.getpick1() is not None:
|
if self.getpick1() is not None:
|
||||||
print 'PragPicker: Get most likely pick from HOS- or AR-CF using pragmatic picking algorithm ...'
|
print('PragPicker: Get most likely pick from HOS- or AR-CF using pragmatic picking algorithm ...')
|
||||||
|
|
||||||
self.Pick = None
|
self.Pick = None
|
||||||
self.SNR = None
|
self.SNR = None
|
||||||
self.slope = None
|
self.slope = None
|
||||||
pickflag = 0
|
pickflag = 0
|
||||||
#smooth CF
|
#smooth CF
|
||||||
ismooth = int(round(self.Tsmooth / self.dt))
|
ismooth = int(round(self.Tsmooth / self.dt))
|
||||||
cfsmooth = np.zeros(len(self.cf))
|
cfsmooth = np.zeros(len(self.cf))
|
||||||
if len(self.cf) < ismooth:
|
if len(self.cf) < ismooth:
|
||||||
print 'PragPicker: Tsmooth larger than CF!'
|
print('PragPicker: Tsmooth larger than CF!')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
for i in range(1, len(self.cf)):
|
for i in range(1, len(self.cf)):
|
||||||
if i > ismooth:
|
if i > ismooth:
|
||||||
ii1 = i - ismooth;
|
ii1 = i - ismooth;
|
||||||
cfsmooth[i] = cfsmooth[i - 1] + (self.cf[i] - self.cf[ii1]) / ismooth
|
cfsmooth[i] = cfsmooth[i - 1] + (self.cf[i] - self.cf[ii1]) / ismooth
|
||||||
else:
|
else:
|
||||||
cfsmooth[i] = np.mean(self.cf[1 : i])
|
cfsmooth[i] = np.mean(self.cf[1 : i])
|
||||||
|
|
||||||
#select picking window
|
#select picking window
|
||||||
#which is centered around tpick1
|
#which is centered around tpick1
|
||||||
ipick = np.where((self.Tcf >= self.getpick1() - self.PickWindow / 2) \
|
ipick = np.where((self.Tcf >= self.getpick1() - self.PickWindow / 2) \
|
||||||
& (self.Tcf <= self.getpick1() + self.PickWindow / 2))
|
& (self.Tcf <= self.getpick1() + self.PickWindow / 2))
|
||||||
cfipick = self.cf[ipick] - np.mean(self.cf[ipick])
|
cfipick = self.cf[ipick] - np.mean(self.cf[ipick])
|
||||||
Tcfpick = self.Tcf[ipick]
|
Tcfpick = self.Tcf[ipick]
|
||||||
cfsmoothipick = cfsmooth[ipick]- np.mean(self.cf[ipick])
|
cfsmoothipick = cfsmooth[ipick]- np.mean(self.cf[ipick])
|
||||||
ipick1 = np.argmin(abs(self.Tcf - self.getpick1()))
|
ipick1 = np.argmin(abs(self.Tcf - self.getpick1()))
|
||||||
cfpick1 = 2 * self.cf[ipick1]
|
cfpick1 = 2 * self.cf[ipick1]
|
||||||
|
|
||||||
#check trend of CF, i.e. differences of CF and adjust aus regarding this trend
|
#check trend of CF, i.e. differences of CF and adjust aus regarding this trend
|
||||||
#prominent trend: decrease aus
|
#prominent trend: decrease aus
|
||||||
#flat: use given aus
|
#flat: use given aus
|
||||||
cfdiff = np.diff(cfipick);
|
cfdiff = np.diff(cfipick)
|
||||||
i0diff = np.where(cfdiff > 0)
|
i0diff = np.where(cfdiff > 0)
|
||||||
cfdiff = cfdiff[i0diff]
|
cfdiff = cfdiff[i0diff]
|
||||||
minaus = min(cfdiff * (1 + self.aus));
|
minaus = min(cfdiff * (1 + self.aus))
|
||||||
aus1 = max([minaus, self.aus]);
|
aus1 = max([minaus, self.aus])
|
||||||
|
|
||||||
#at first we look to the right until the end of the pick window is reached
|
#at first we look to the right until the end of the pick window is reached
|
||||||
flagpick_r = 0
|
flagpick_r = 0
|
||||||
flagpick_l = 0
|
flagpick_l = 0
|
||||||
cfpick_r = 0
|
cfpick_r = 0
|
||||||
cfpick_l = 0
|
cfpick_l = 0
|
||||||
lpickwindow = int(round(self.PickWindow / self.dt))
|
lpickwindow = int(round(self.PickWindow / self.dt))
|
||||||
for i in range(max(np.insert(ipick, 0, 2)), min([ipick1 + lpickwindow + 1, len(self.cf) - 1])):
|
for i in range(max(np.insert(ipick, 0, 2)), min([ipick1 + lpickwindow + 1, len(self.cf) - 1])):
|
||||||
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
||||||
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
||||||
if cfpick1 >= self.cf[i]:
|
if cfpick1 >= self.cf[i]:
|
||||||
pick_r = self.Tcf[i]
|
pick_r = self.Tcf[i]
|
||||||
self.Pick = pick_r
|
self.Pick = pick_r
|
||||||
flagpick_l = 1
|
flagpick_l = 1
|
||||||
cfpick_r = self.cf[i]
|
cfpick_r = self.cf[i]
|
||||||
break
|
break
|
||||||
|
|
||||||
# now we look to the left
|
# now we look to the left
|
||||||
for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1):
|
for i in range(ipick1, max([ipick1 - lpickwindow + 1, 2]), -1):
|
||||||
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
if self.cf[i + 1] > self.cf[i] and self.cf[i - 1] >= self.cf[i]:
|
||||||
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
if cfsmooth[i - 1] * (1 + aus1) >= cfsmooth[i]:
|
||||||
if cfpick1 >= self.cf[i]:
|
if cfpick1 >= self.cf[i]:
|
||||||
pick_l = self.Tcf[i]
|
pick_l = self.Tcf[i]
|
||||||
self.Pick = pick_l
|
self.Pick = pick_l
|
||||||
flagpick_r = 1
|
flagpick_r = 1
|
||||||
cfpick_l = self.cf[i]
|
cfpick_l = self.cf[i]
|
||||||
break
|
break
|
||||||
|
|
||||||
# now decide which pick: left or right?
|
# now decide which pick: left or right?
|
||||||
if flagpick_l > 0 and flagpick_r > 0 and cfpick_l <= cfpick_r:
|
if flagpick_l > 0 and flagpick_r > 0 and cfpick_l <= cfpick_r:
|
||||||
self.Pick = pick_l
|
|
||||||
pickflag = 1
|
|
||||||
elif flagpick_l > 0 and flagpick_r > 0 and cfpick_l >= cfpick_r:
|
|
||||||
self.Pick = pick_r
|
|
||||||
pickflag = 1
|
|
||||||
elif flagpick_l == 0 and flagpick_r > 0 and cfpick_l >= cfpick_r:
|
|
||||||
self.Pick = pick_l
|
self.Pick = pick_l
|
||||||
pickflag = 1
|
pickflag = 1
|
||||||
else:
|
elif flagpick_l > 0 and flagpick_r > 0 and cfpick_l >= cfpick_r:
|
||||||
print 'PragPicker: Could not find reliable onset!'
|
self.Pick = pick_r
|
||||||
self.Pick = None
|
pickflag = 1
|
||||||
pickflag = 0
|
elif flagpick_l == 0 and flagpick_r > 0 and cfpick_l >= cfpick_r:
|
||||||
|
self.Pick = pick_l
|
||||||
|
pickflag = 1
|
||||||
|
else:
|
||||||
|
print('PragPicker: Could not find reliable onset!')
|
||||||
|
self.Pick = None
|
||||||
|
pickflag = 0
|
||||||
|
|
||||||
if self.getiplot() > 1:
|
if self.getiplot() > 1:
|
||||||
p = plt.figure(self.getiplot())
|
p = plt.figure(self.getiplot())
|
||||||
p1, = plt.plot(Tcfpick,cfipick, 'k')
|
p1, = plt.plot(Tcfpick,cfipick, 'k')
|
||||||
p2, = plt.plot(Tcfpick,cfsmoothipick, 'r')
|
p2, = plt.plot(Tcfpick,cfsmoothipick, 'r')
|
||||||
if pickflag > 0:
|
if pickflag > 0:
|
||||||
p3, = plt.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], 'b', linewidth=2)
|
p3, = plt.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], 'b', linewidth=2)
|
||||||
plt.legend([p1, p2, p3], ['CF', 'Smoothed CF', 'Pick'])
|
plt.legend([p1, p2, p3], ['CF', 'Smoothed CF', 'Pick'])
|
||||||
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
plt.xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
|
||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
plt.title(self.Data[0].stats.station)
|
plt.title(self.Data[0].stats.station)
|
||||||
plt.show()
|
plt.show()
|
||||||
raw_input()
|
raw_input()
|
||||||
plt.close(p)
|
plt.close(p)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print 'PragPicker: No initial onset time given! Check input!'
|
print('PragPicker: No initial onset time given! Check input!')
|
||||||
self.Pick = None
|
self.Pick = None
|
||||||
return
|
return
|
||||||
@@ -11,12 +11,13 @@ function conglomerate utils.
|
|||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from scipy import integrate
|
||||||
from pylot.core.pick.Picker import AICPicker, PragPicker
|
from pylot.core.pick.Picker import AICPicker, PragPicker
|
||||||
from pylot.core.pick.CharFuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
|
from pylot.core.pick.CharFuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
|
||||||
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker,\
|
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker,\
|
||||||
getSNR, fmpicker, checkPonsets, wadaticheck
|
getSNR, fmpicker, checkPonsets, wadaticheck, crossings_nonzero_all
|
||||||
from pylot.core.read.data import Data
|
from pylot.core.read.data import Data
|
||||||
from pylot.core.analysis.magnitude import WApp
|
from pylot.core.analysis.magnitude import WApp, DCfc
|
||||||
|
|
||||||
def autopickevent(data, param):
|
def autopickevent(data, param):
|
||||||
stations = []
|
stations = []
|
||||||
@@ -309,6 +310,26 @@ def autopickstation(wfstream, pickparam):
|
|||||||
else:
|
else:
|
||||||
FM = 'N'
|
FM = 'N'
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
# get DC value (w0) and corner frequency (fc) of source spectrum
|
||||||
|
# from P pulse
|
||||||
|
# restitute streams
|
||||||
|
# initialize Data object
|
||||||
|
data = Data()
|
||||||
|
[corzdat, restflag] = data.restituteWFData(invdir, zdat)
|
||||||
|
if restflag == 1:
|
||||||
|
# integrate to displacement
|
||||||
|
corintzdat = integrate.cumtrapz(corzdat[0], None, corzdat[0].stats.delta)
|
||||||
|
# class needs stream object => build it
|
||||||
|
z_copy = zdat.copy()
|
||||||
|
z_copy[0].data = corintzdat
|
||||||
|
# calculate source spectrum and get w0 and fc
|
||||||
|
calcwin = 1 / bpz2[0] # largest detectable period == window length
|
||||||
|
# around P pulse for calculating source spectrum
|
||||||
|
specpara = DCfc(z_copy, mpickP, calcwin, iplot)
|
||||||
|
w0 = specpara.getw0()
|
||||||
|
fc = specpara.getfc()
|
||||||
|
|
||||||
print 'autopickstation: P-weight: %d, SNR: %f, SNR[dB]: %f, ' \
|
print 'autopickstation: P-weight: %d, SNR: %f, SNR[dB]: %f, ' \
|
||||||
'Polarity: %s' % (Pweight, SNRP, SNRPdB, FM)
|
'Polarity: %s' % (Pweight, SNRP, SNRPdB, FM)
|
||||||
Sflag = 1
|
Sflag = 1
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class AutoPickParameter(object):
|
|||||||
self.__filename = fnin
|
self.__filename = fnin
|
||||||
parFileCont = {}
|
parFileCont = {}
|
||||||
# read from parsed arguments alternatively
|
# read from parsed arguments alternatively
|
||||||
for key, val in kwargs.iteritems():
|
for key, val in kwargs.items():
|
||||||
parFileCont[key] = val
|
parFileCont[key] = val
|
||||||
|
|
||||||
if self.__filename is not None:
|
if self.__filename is not None:
|
||||||
@@ -57,7 +57,7 @@ class AutoPickParameter(object):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
parspl = line.split('\t')[:2]
|
parspl = line.split('\t')[:2]
|
||||||
parFileCont[parspl[0].strip()] = parspl[1]
|
parFileCont[parspl[0].strip()] = parspl[1]
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
inputFile.seek(0)
|
inputFile.seek(0)
|
||||||
lines = inputFile.readlines()
|
lines = inputFile.readlines()
|
||||||
@@ -65,7 +65,7 @@ class AutoPickParameter(object):
|
|||||||
if not line.startswith(('#', '%', '\n', ' ')):
|
if not line.startswith(('#', '%', '\n', ' ')):
|
||||||
parspl = line.split('#')[:2]
|
parspl = line.split('#')[:2]
|
||||||
parFileCont[parspl[1].strip()] = parspl[0].strip()
|
parFileCont[parspl[1].strip()] = parspl[0].strip()
|
||||||
for key, value in parFileCont.iteritems():
|
for key, value in parFileCont.items():
|
||||||
try:
|
try:
|
||||||
val = int(value)
|
val = int(value)
|
||||||
except:
|
except:
|
||||||
@@ -121,7 +121,7 @@ class AutoPickParameter(object):
|
|||||||
return len(self.__parameter.keys())
|
return len(self.__parameter.keys())
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
for key, value in self.__parameter.iteritems():
|
for key, value in self.__parameter.items():
|
||||||
yield key, value
|
yield key, value
|
||||||
|
|
||||||
def hasParam(self, parameter):
|
def hasParam(self, parameter):
|
||||||
@@ -134,22 +134,22 @@ class AutoPickParameter(object):
|
|||||||
for param in args:
|
for param in args:
|
||||||
try:
|
try:
|
||||||
return self.__getitem__(param)
|
return self.__getitem__(param)
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
try:
|
try:
|
||||||
return self.__getitem__(args)
|
return self.__getitem__(args)
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
self._printParameterError(e)
|
self._printParameterError(e)
|
||||||
|
|
||||||
def setParam(self, **kwargs):
|
def setParam(self, **kwargs):
|
||||||
for param, value in kwargs.iteritems():
|
for param, value in kwargs.items():
|
||||||
self.__setitem__(param, value)
|
self.__setitem__(param, value)
|
||||||
print self
|
print(self)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _printParameterError(errmsg):
|
def _printParameterError(errmsg):
|
||||||
print 'ParameterError:\n non-existent parameter %s' % errmsg
|
print('ParameterError:\n non-existent parameter %s' % errmsg)
|
||||||
|
|
||||||
def export2File(self, fnout):
|
def export2File(self, fnout):
|
||||||
fid_out = open(fnout, 'w')
|
fid_out = open(fnout, 'w')
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class PickDlg(QDialog):
|
|||||||
try:
|
try:
|
||||||
data = parent.getData().getWFData().copy()
|
data = parent.getData().getWFData().copy()
|
||||||
self.data = data.select(station=station)
|
self.data = data.select(station=station)
|
||||||
except AttributeError, e:
|
except AttributeError as e:
|
||||||
errmsg = 'You either have to put in a data or an appropriate ' \
|
errmsg = 'You either have to put in a data or an appropriate ' \
|
||||||
'parent (PyLoT MainWindow) object: {0}'.format(e)
|
'parent (PyLoT MainWindow) object: {0}'.format(e)
|
||||||
raise Exception(errmsg)
|
raise Exception(errmsg)
|
||||||
@@ -239,6 +239,8 @@ class PickDlg(QDialog):
|
|||||||
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
||||||
home_icon = QIcon()
|
home_icon = QIcon()
|
||||||
home_icon.addPixmap(QPixmap(':/icons/zoom_0.png'))
|
home_icon.addPixmap(QPixmap(':/icons/zoom_0.png'))
|
||||||
|
del_icon = QIcon()
|
||||||
|
del_icon.addPixmap(QPixmap(':/icons/delete.png'))
|
||||||
|
|
||||||
# create actions
|
# create actions
|
||||||
self.filterAction = createAction(parent=self, text='Filter',
|
self.filterAction = createAction(parent=self, text='Filter',
|
||||||
@@ -251,9 +253,12 @@ class PickDlg(QDialog):
|
|||||||
slot=self.zoom, icon=zoom_icon,
|
slot=self.zoom, icon=zoom_icon,
|
||||||
tip='Zoom into waveform',
|
tip='Zoom into waveform',
|
||||||
checkable=True)
|
checkable=True)
|
||||||
self.resetAction = createAction(parent=self, text='Home',
|
self.resetZoomAction = createAction(parent=self, text='Home',
|
||||||
slot=self.resetZoom, icon=home_icon,
|
slot=self.resetZoom, icon=home_icon,
|
||||||
tip='Reset zoom to original limits')
|
tip='Reset zoom to original limits')
|
||||||
|
self.resetPicksAction = createAction(parent=self, text='Delete Picks',
|
||||||
|
slot=self.delPicks, icon=del_icon,
|
||||||
|
tip='Delete current picks.')
|
||||||
|
|
||||||
# create other widget elements
|
# create other widget elements
|
||||||
self.selectPhase = QComboBox()
|
self.selectPhase = QComboBox()
|
||||||
@@ -269,7 +274,9 @@ class PickDlg(QDialog):
|
|||||||
_dialtoolbar.addWidget(self.selectPhase)
|
_dialtoolbar.addWidget(self.selectPhase)
|
||||||
_dialtoolbar.addAction(self.zoomAction)
|
_dialtoolbar.addAction(self.zoomAction)
|
||||||
_dialtoolbar.addSeparator()
|
_dialtoolbar.addSeparator()
|
||||||
_dialtoolbar.addAction(self.resetAction)
|
_dialtoolbar.addAction(self.resetZoomAction)
|
||||||
|
_dialtoolbar.addSeparator()
|
||||||
|
_dialtoolbar.addAction(self.resetPicksAction)
|
||||||
|
|
||||||
# layout the innermost widget
|
# layout the innermost widget
|
||||||
_innerlayout = QVBoxLayout()
|
_innerlayout = QVBoxLayout()
|
||||||
@@ -371,7 +378,7 @@ class PickDlg(QDialog):
|
|||||||
traceIDs = []
|
traceIDs = []
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
channel = channel.upper()
|
channel = channel.upper()
|
||||||
for traceID, channelID in plotDict.iteritems():
|
for traceID, channelID in plotDict.items():
|
||||||
if channelID[1].upper().endswith(channel):
|
if channelID[1].upper().endswith(channel):
|
||||||
traceIDs.append(traceID)
|
traceIDs.append(traceID)
|
||||||
return traceIDs
|
return traceIDs
|
||||||
@@ -422,6 +429,13 @@ class PickDlg(QDialog):
|
|||||||
def getPicks(self):
|
def getPicks(self):
|
||||||
return self.picks
|
return self.picks
|
||||||
|
|
||||||
|
def resetPicks(self):
|
||||||
|
self.picks = {}
|
||||||
|
|
||||||
|
def delPicks(self):
|
||||||
|
self.resetPicks()
|
||||||
|
self.resetPlot()
|
||||||
|
|
||||||
def setIniPick(self, gui_event):
|
def setIniPick(self, gui_event):
|
||||||
|
|
||||||
trace_number = round(gui_event.ydata)
|
trace_number = round(gui_event.ydata)
|
||||||
@@ -672,8 +686,21 @@ class PickDlg(QDialog):
|
|||||||
zoomx=self.getXLims(),
|
zoomx=self.getXLims(),
|
||||||
zoomy=self.getYLims())
|
zoomy=self.getYLims())
|
||||||
self.setPlotLabels()
|
self.setPlotLabels()
|
||||||
|
self.drawPicks()
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
|
def resetPlot(self):
|
||||||
|
self.updateCurrentLimits()
|
||||||
|
data = self.getWFData().copy()
|
||||||
|
title = self.getPlotWidget().getAxes().get_title()
|
||||||
|
self.getPlotWidget().plotWFData(wfdata=data, title=title,
|
||||||
|
zoomx=self.getXLims(),
|
||||||
|
zoomy=self.getYLims())
|
||||||
|
self.setPlotLabels()
|
||||||
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
|
|
||||||
|
|
||||||
def setPlotLabels(self):
|
def setPlotLabels(self):
|
||||||
|
|
||||||
# get channel labels
|
# get channel labels
|
||||||
@@ -711,7 +738,7 @@ class PickDlg(QDialog):
|
|||||||
else:
|
else:
|
||||||
# deal with something that should never happen
|
# deal with something that should never happen
|
||||||
scale_factor = 1
|
scale_factor = 1
|
||||||
print gui_event.button
|
print(gui_event.button)
|
||||||
|
|
||||||
new_xlim = gui_event.xdata - \
|
new_xlim = gui_event.xdata - \
|
||||||
scale_factor * (gui_event.xdata - self.getXLims())
|
scale_factor * (gui_event.xdata - self.getXLims())
|
||||||
@@ -742,7 +769,7 @@ class PickDlg(QDialog):
|
|||||||
def apply(self):
|
def apply(self):
|
||||||
picks = self.getPicks()
|
picks = self.getPicks()
|
||||||
for pick in picks:
|
for pick in picks:
|
||||||
print pick, picks[pick]
|
print(pick, picks[pick])
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.apply()
|
self.apply()
|
||||||
|
|||||||
Reference in new issue
Block a user