implemented setting manual picks from file

This commit is contained in:
Marcel Paffrath 2015-12-08 11:34:55 +01:00
parent cdf924e8c2
commit cb3f9804f9

View File

@ -317,6 +317,10 @@ class SeismicShot(object):
self.getPickIncludeRemoved(traceID), self.getPickIncludeRemoved(traceID),
stealthMode = True) stealthMode = True)
if self.pick[traceID]['epp'] < 0:
self.pick[traceID]['epp']
#print('setEarllatepick: Set epp to 0 because it was < 0')
# TEST OF 1/2 PICKERROR # TEST OF 1/2 PICKERROR
# self.pick[traceID]['spe'] *= 0.5 # self.pick[traceID]['spe'] *= 0.5
# TEST OF 1/2 PICKERROR # TEST OF 1/2 PICKERROR
@ -448,26 +452,47 @@ class SeismicShot(object):
if len(traceID_list) > 0: if len(traceID_list) > 0:
return traceID_list return traceID_list
def setManualPicks(self, traceID, picklist): ########## picklist momentan nicht allgemein, nur testweise benutzt ########## # def setManualPicks(self, traceID, picklist): ########## picklist momentan nicht allgemein, nur testweise benutzt ##########
''' # '''
Sets the manual picks for a receiver with the ID == traceID for comparison. # Sets the manual picks for a receiver with the ID == traceID for comparison.
:param: traceID # :param: traceID
:type: int # :type: int
:param: picklist, list containing the manual picks (mostlikely, earliest, latest). # :param: picklist, list containing the manual picks (mostlikely, earliest, latest).
:type: list # :type: list
''' # '''
picks = picklist[traceID - 1].split() # picks = picklist[traceID - 1].split()
mostlikely = float(picks[1]) # mostlikely = float(picks[1])
earliest = float(picks[2]) # earliest = float(picks[2])
latest = float(picks[3]) # latest = float(picks[3])
if not self.manualpicks.has_key(traceID): # if not self.manualpicks.has_key(traceID):
self.manualpicks[traceID] = (mostlikely, earliest, latest) # self.manualpicks[traceID] = (mostlikely, earliest, latest)
#else: #else:
# raise KeyError('MANUAL pick to be set more than once for traceID %s' % traceID) # raise KeyError('MANUAL pick to be set more than once for traceID %s' % traceID)
def setManualPicksFromFile(self, directory = 'picks'):
'''
Read manual picks from *.pck file.
The * must be identical with the shotnumber.
'''
if directory[-1] == '/':
filename = directory + str(self.getShotnumber()) + '.pck'
else:
filename = directory + '/' + str(self.getShotnumber()) + '.pck'
infile = open(filename, 'r')
mpicks = infile.readlines()
for line in mpicks:
if line.split()[0] == []:
continue
traceID, mpp, epp, lpp = line.split()
traceID = int(traceID)
if traceID in self.pick.keys():
self.manualpicks[traceID] = {'mpp': float(mpp),
'epp': float(epp),
'lpp': float(lpp)}
def setPick(self, traceID, pick): ########## siehe Kommentar ########## def setPick(self, traceID, pick): ########## siehe Kommentar ##########
if not traceID in self.pick.keys(): if not traceID in self.pick.keys():
self.pick[traceID] = {} self.pick[traceID] = {}