From cb3f9804f95f6b41ccfba2de8b34a511370b0192 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 8 Dec 2015 11:34:55 +0100 Subject: [PATCH] implemented setting manual picks from file --- pylot/core/active/seismicshot.py | 53 +++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/pylot/core/active/seismicshot.py b/pylot/core/active/seismicshot.py index 7306392a..cc8c3cd1 100644 --- a/pylot/core/active/seismicshot.py +++ b/pylot/core/active/seismicshot.py @@ -317,6 +317,10 @@ class SeismicShot(object): self.getPickIncludeRemoved(traceID), 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 # self.pick[traceID]['spe'] *= 0.5 # TEST OF 1/2 PICKERROR @@ -448,26 +452,47 @@ class SeismicShot(object): if len(traceID_list) > 0: return traceID_list - 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. + # 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. - :param: traceID - :type: int + # :param: traceID + # :type: int - :param: picklist, list containing the manual picks (mostlikely, earliest, latest). - :type: list - ''' - picks = picklist[traceID - 1].split() - mostlikely = float(picks[1]) - earliest = float(picks[2]) - latest = float(picks[3]) + # :param: picklist, list containing the manual picks (mostlikely, earliest, latest). + # :type: list + # ''' + # picks = picklist[traceID - 1].split() + # mostlikely = float(picks[1]) + # earliest = float(picks[2]) + # latest = float(picks[3]) - if not self.manualpicks.has_key(traceID): - self.manualpicks[traceID] = (mostlikely, earliest, latest) + # if not self.manualpicks.has_key(traceID): + # self.manualpicks[traceID] = (mostlikely, earliest, latest) #else: # 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 ########## if not traceID in self.pick.keys(): self.pick[traceID] = {}