bugfixes + renaming

This commit is contained in:
Marcel Paffrath 2015-12-08 13:49:47 +01:00
parent cb3f9804f9
commit feab50af28

View File

@ -28,8 +28,8 @@ class SeismicShot(object):
self.recCoordlist = None self.recCoordlist = None
self.srcCoordlist = None self.srcCoordlist = None
self.traceIDs = None self.traceIDs = None
self.pick = {} self.picks = {}
self.pickwindow= {} self.pwindow= {}
self.manualpicks= {} self.manualpicks= {}
self.snr = {} self.snr = {}
self.snrthreshold = {} self.snrthreshold = {}
@ -133,24 +133,34 @@ class SeismicShot(object):
def getSourcefile(self): def getSourcefile(self):
return self.paras['sourcefile'] return self.paras['sourcefile']
def getManualPick(self, traceID):
if not self.getManualPickFlag(traceID) == 0:
return self.manualpicks[traceID]['mpp']
def getManualEarliest(self, traceID):
return self.manualpicks[traceID]['epp']
def getManualLatest(self, traceID):
return self.manualpicks[traceID]['lpp']
def getPick(self, traceID, returnRemoved = False): def getPick(self, traceID, returnRemoved = False):
if not self.getFlag(traceID) == 0: if not self.getPickFlag(traceID) == 0:
return self.pick[traceID]['mpp'] return self.picks[traceID]['mpp']
if returnRemoved == True: if returnRemoved == True:
#print('getPick: Returned removed pick for shot %d, traceID %d' %(self.getShotnumber(), traceID)) #print('getPick: Returned removed pick for shot %d, traceID %d' %(self.getShotnumber(), traceID))
return self.pick[traceID]['mpp'] return self.picks[traceID]['mpp']
def getPickIncludeRemoved(self, traceID): def getPickIncludeRemoved(self, traceID):
return self.getPick(traceID, returnRemoved = True) return self.getPick(traceID, returnRemoved = True)
def getEarliest(self, traceID): def getEarliest(self, traceID):
return self.pick[traceID]['epp'] return self.picks[traceID]['epp']
def getLatest(self, traceID): def getLatest(self, traceID):
return self.pick[traceID]['lpp'] return self.picks[traceID]['lpp']
def getSymmetricPickError(self, traceID): def getSymmetricPickError(self, traceID):
pickerror = self.pick[traceID]['spe'] pickerror = self.picks[traceID]['spe']
if np.isnan(pickerror) == True: if np.isnan(pickerror) == True:
print "SPE is NaN for shot %s, traceID %s"%(self.getShotnumber(), traceID) print "SPE is NaN for shot %s, traceID %s"%(self.getShotnumber(), traceID)
return pickerror return pickerror
@ -182,11 +192,11 @@ class SeismicShot(object):
def getPickwindow(self, traceID): def getPickwindow(self, traceID):
try: try:
self.pickwindow[traceID] self.pwindow[traceID]
except KeyError as e: except KeyError as e:
print('no pickwindow for trace %s, set to %s' % (traceID, self.getCut())) print('no pickwindow for trace %s, set to %s' % (traceID, self.getCut()))
self.setPickwindow(traceID, self.getCut()) self.setPickwindow(traceID, self.getCut())
return self.pickwindow[traceID] return self.pwindow[traceID]
def getSNR(self, traceID): def getSNR(self, traceID):
return self.snr[traceID] return self.snr[traceID]
@ -310,19 +320,19 @@ class SeismicShot(object):
tsignal = self.getTsignal() tsignal = self.getTsignal()
tnoise = self.getPickIncludeRemoved(traceID) - tgap tnoise = self.getPickIncludeRemoved(traceID) - tgap
(self.pick[traceID]['epp'], (self.picks[traceID]['epp'],
self.pick[traceID]['lpp'], self.picks[traceID]['lpp'],
self.pick[traceID]['spe']) = earllatepicker(self.getSingleStream(traceID), self.picks[traceID]['spe']) = earllatepicker(self.getSingleStream(traceID),
nfac, (tnoise, tgap, tsignal), nfac, (tnoise, tgap, tsignal),
self.getPickIncludeRemoved(traceID), self.getPickIncludeRemoved(traceID),
stealthMode = True) stealthMode = True)
if self.pick[traceID]['epp'] < 0: if self.picks[traceID]['epp'] < 0:
self.pick[traceID]['epp'] self.picks[traceID]['epp']
#print('setEarllatepick: Set epp to 0 because it was < 0') #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.picks[traceID]['spe'] *= 0.5
# TEST OF 1/2 PICKERROR # TEST OF 1/2 PICKERROR
def threshold(self, hoscf, aiccf, windowsize, pickwindow, folm = 0.6): def threshold(self, hoscf, aiccf, windowsize, pickwindow, folm = 0.6):
@ -488,18 +498,23 @@ class SeismicShot(object):
continue continue
traceID, mpp, epp, lpp = line.split() traceID, mpp, epp, lpp = line.split()
traceID = int(traceID) traceID = int(traceID)
if traceID in self.pick.keys(): if traceID in self.picks.keys():
self.manualpicks[traceID] = {'mpp': float(mpp), self.manualpicks[traceID] = {'mpp': float(mpp),
'epp': float(epp), 'epp': float(epp),
'lpp': float(lpp)} 'lpp': float(lpp)}
if float(mpp) <= 0:
self.setManualPickFlag(traceID, 0)
else:
self.setManualPickFlag(traceID, 1)
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.picks.keys():
self.pick[traceID] = {} self.picks[traceID] = {}
self.pick[traceID]['mpp'] = pick self.picks[traceID]['mpp'] = pick
self.pick[traceID]['flag'] = 1 self.picks[traceID]['flag'] = 1
# ++++++++++++++ Block raus genommen, da Error beim 2ten Mal picken! (Ueberschreiben von erstem Pick!) # ++++++++++++++ Block raus genommen, da Error beim 2ten Mal picken! (Ueberschreiben von erstem Pick!)
# if not self.pick.has_key(traceID): # if not self.picks.has_key(traceID):
# self.getPick(traceID) = picks # self.getPick(traceID) = picks
# else: # else:
# raise KeyError('pick to be set more than once for traceID %s' % traceID) # raise KeyError('pick to be set more than once for traceID %s' % traceID)
@ -508,17 +523,24 @@ class SeismicShot(object):
# parlist = open(parfile,'r').readlines() # parlist = open(parfile,'r').readlines()
def removePick(self, traceID): def removePick(self, traceID):
self.setFlag(traceID, 0) self.setPickFlag(traceID, 0)
def setFlag(self, traceID, flag): def setPickFlag(self, traceID, flag):
'Set flag = 0 if pick is invalid, else flag = 1' 'Set flag = 0 if pick is invalid, else flag = 1'
self.pick[traceID]['flag'] = flag self.picks[traceID]['flag'] = flag
def getFlag(self, traceID): def getPickFlag(self, traceID):
return self.pick[traceID]['flag'] return self.picks[traceID]['flag']
def setManualPickFlag(self, traceID, flag):
'Set flag = 0 if pick is invalid, else flag = 1'
self.manualpicks[traceID]['flag'] = flag
def getManualPickFlag(self, traceID):
return self.manualpicks[traceID]['flag']
def setPickwindow(self, traceID, pickwindow): def setPickwindow(self, traceID, pickwindow):
self.pickwindow[traceID] = pickwindow self.pwindow[traceID] = pickwindow
def setSNR(self, traceID): ########## FORCED HOS PICK ########## def setSNR(self, traceID): ########## FORCED HOS PICK ##########
''' '''
@ -547,7 +569,7 @@ class SeismicShot(object):
''' '''
distancearray = [] distancearray = []
for traceID in self.pick.keys(): for traceID in self.picks.keys():
if self.getRecLoc(traceID) > self.getSrcLoc(traceID): if self.getRecLoc(traceID) > self.getSrcLoc(traceID):
distancearray.append(self.getDistance(traceID)) distancearray.append(self.getDistance(traceID))
elif self.getRecLoc(traceID) < self.getSrcLoc(traceID): elif self.getRecLoc(traceID) < self.getSrcLoc(traceID):
@ -571,7 +593,7 @@ class SeismicShot(object):
# dist_medarray = [] # dist_medarray = []
# i = 1 # i = 1
# for traceID in self.pick.keys(): # for traceID in self.picks.keys():
# aictimearray.append(self.getPick(traceID)) ###### HIER NICHT MEHR aic = [0] oder hos = [1] # aictimearray.append(self.getPick(traceID)) ###### HIER NICHT MEHR aic = [0] oder hos = [1]
# hostimearray.append(self.getPick(traceID)) # hostimearray.append(self.getPick(traceID))
# if dist_med is not 0: dist_medarray.append(dist_med[self.getDistance(traceID)]) # if dist_med is not 0: dist_medarray.append(dist_med[self.getDistance(traceID)])
@ -611,9 +633,9 @@ class SeismicShot(object):
# pickwindowarray_upperb = [] # pickwindowarray_upperb = []
# i = 1 # i = 1
# for traceID in self.pickwindow.keys(): # for traceID in self.pwindow.keys():
# pickwindowarray_lowerb.append(self.pickwindow[traceID][0]) # pickwindowarray_lowerb.append(self.pwindow[traceID][0])
# pickwindowarray_upperb.append(self.pickwindow[traceID][1]) # pickwindowarray_upperb.append(self.pwindow[traceID][1])
# i += 1 # i += 1
# plt.plot(self.getDistArray4ttcPlot(), pickwindowarray_lowerb, ':k') # plt.plot(self.getDistArray4ttcPlot(), pickwindowarray_lowerb, ':k')
@ -775,8 +797,8 @@ class SeismicShot(object):
x = [] x = []
y = [] y = []
z = [] z = []
for traceID in self.pick.keys(): for traceID in self.picks.keys():
if self.getFlag(traceID) != 0: if self.getPickFlag(traceID) != 0:
x.append(self.getRecLoc(traceID)[0]) x.append(self.getRecLoc(traceID)[0])
y.append(self.getRecLoc(traceID)[1]) y.append(self.getRecLoc(traceID)[1])
z.append(self.getPick(traceID)) z.append(self.getPick(traceID))
@ -832,12 +854,12 @@ class SeismicShot(object):
y = []; ycut = [] y = []; ycut = []
z = []; zcut = [] z = []; zcut = []
for traceID in self.pick.keys(): for traceID in self.picks.keys():
if self.getFlag(traceID) != 0: if self.getPickFlag(traceID) != 0:
x.append(self.getRecLoc(traceID)[0]) x.append(self.getRecLoc(traceID)[0])
y.append(self.getRecLoc(traceID)[1]) y.append(self.getRecLoc(traceID)[1])
z.append(self.getPick(traceID)) z.append(self.getPick(traceID))
if self.getFlag(traceID) == 0 and self.getPickIncludeRemoved(traceID) is not None: if self.getPickFlag(traceID) == 0 and self.getPickIncludeRemoved(traceID) is not None:
xcut.append(self.getRecLoc(traceID)[0]) xcut.append(self.getRecLoc(traceID)[0])
ycut.append(self.getRecLoc(traceID)[1]) ycut.append(self.getRecLoc(traceID)[1])
zcut.append(self.getPickIncludeRemoved(traceID)) zcut.append(self.getPickIncludeRemoved(traceID))
@ -878,7 +900,7 @@ class SeismicShot(object):
if annotations == True: if annotations == True:
for traceID in self.getTraceIDlist(): for traceID in self.getTraceIDlist():
if self.getFlag(traceID) is not 0: if self.getPickFlag(traceID) is not 0:
ax.annotate(' %s' %traceID , xy = (self.getRecLoc(traceID)[0], self.getRecLoc(traceID)[1]), ax.annotate(' %s' %traceID , xy = (self.getRecLoc(traceID)[0], self.getRecLoc(traceID)[1]),
fontsize = 'x-small', color = 'k') fontsize = 'x-small', color = 'k')
else: else: