176 open event failure

This commit is contained in:
Sebastian Wehling-Benatelli 2015-09-04 15:01:59 +02:00
parent cc0b1e0a5b
commit 4eef4d238b
2 changed files with 24 additions and 6 deletions

View File

@ -695,8 +695,22 @@ class MainWindow(QMainWindow):
def convertPicks4PyLoT(self): def convertPicks4PyLoT(self):
evt = self.getData().getEvtData() evt = self.getData().getEvtData()
picks = {}
onsets = {}
for pick in evt.picks: for pick in evt.picks:
station = pick.waveform_id.getSEEDstring() phase = {}
station = pick.waveform_id.station_code
mpp = pick.time
lpp = mpp + pick.time.upper_uncertainty
epp = mpp - pick.time.lower_uncertainty
spe = pick.time.uncertainty
phase['mpp'] = mpp
phase['epp'] = epp
phase['lpp'] = lpp
phase['spe'] = spe
onsets[pick.phase_hint] = phase
picks[station] = onsets
def drawPicks(self, station=None): def drawPicks(self, station=None):
# if picks to draw not specified, draw all picks available # if picks to draw not specified, draw all picks available

View File

@ -33,7 +33,7 @@ class Data(object):
else: else:
self.comp = 'Z' self.comp = 'Z'
self.wfdata = Stream() self.wfdata = Stream()
self.newevent = False self._new = False
if evtdata is not None and isinstance(evtdata, Event): if evtdata is not None and isinstance(evtdata, Event):
self.evtdata = evtdata self.evtdata = evtdata
elif evtdata is not None and not isinstance(evtdata, dict): elif evtdata is not None and not isinstance(evtdata, dict):
@ -41,8 +41,9 @@ class Data(object):
self.evtdata = cat[0] self.evtdata = cat[0]
elif evtdata is not None: elif evtdata is not None:
cat = readPILOTEvent(**evtdata) cat = readPILOTEvent(**evtdata)
self.evtdata = cat[0]
else: # create an empty Event object else: # create an empty Event object
self.newevent = True self._new = True
self.evtdata = Event() self.evtdata = Event()
self.getEvtData().picks = [] self.getEvtData().picks = []
self.wforiginal = None self.wforiginal = None
@ -73,7 +74,7 @@ class Data(object):
:return: :return:
""" """
return self.newevent return self._new
def getCutTimes(self): def getCutTimes(self):
""" """
@ -356,6 +357,9 @@ class Data(object):
""" """
return self.evtdata return self.evtdata
def setEvtData(self, event):
self.evtdata = event
def applyEVTData(self, data, type='pick', authority_id='rub'): def applyEVTData(self, data, type='pick', authority_id='rub'):
""" """
@ -417,8 +421,8 @@ class Data(object):
:param event: :param event:
""" """
if not self.evtdata: if not self.isNew():
self.evtdata = event self.setEvtData(event)
else: else:
raise OverwriteError('Acutal event would be overwritten!') raise OverwriteError('Acutal event would be overwritten!')