diff --git a/pylot/core/active/seismicshot.py b/pylot/core/active/seismicshot.py index 2f6595f9..0bed77d4 100644 --- a/pylot/core/active/seismicshot.py +++ b/pylot/core/active/seismicshot.py @@ -37,6 +37,7 @@ class SeismicShot(object): self.traces4plot = {} self.paras = {} self.paras['shotname'] = obsfile + self.folm = None def removeEmptyTraces(self): traceIDs = [] @@ -279,7 +280,7 @@ class SeismicShot(object): #raise ValueError('ambigious or empty traceID: %s' % traceID) - def pickTraces(self, traceID, windowsize, folm = 0.6, HosAic = 'hos'): ########## input variables ########## + def pickTraces(self, traceID, windowsize, folm, HosAic = 'hos'): ########## input variables ########## # LOCALMAX NOT IMPLEMENTED! ''' Intitiate picking for a trace. @@ -299,7 +300,7 @@ class SeismicShot(object): :param: windowsize, window around the returned HOS picktime, to search for the AIC minumum :type: 'tuple' - :param: folm, fraction of local maximumm (default = 0.6) + :param: folm, fraction of local maximumm :type: 'real' :param: HosAic, get hos or aic pick (can be 'hos'(default) or 'aic') @@ -308,6 +309,8 @@ class SeismicShot(object): hoscf = self.getHOScf(traceID) ### determination of both, HOS and AIC (need to change threshold-picker) ### aiccf = self.getAICcf(traceID) + self.folm = folm + self.timeArray[traceID] = hoscf.getTimeArray() aiccftime, hoscftime = self.threshold(hoscf, aiccf, windowsize, self.getPickwindow(traceID), folm) setHosAic = {'hos': hoscftime, @@ -335,7 +338,7 @@ class SeismicShot(object): # self.picks[traceID]['spe'] *= 0.5 # TEST OF 1/2 PICKERROR - def threshold(self, hoscf, aiccf, windowsize, pickwindow, folm = 0.6): + def threshold(self, hoscf, aiccf, windowsize, pickwindow, folm): ''' Threshold picker, using the local maximum in a pickwindow to find the time at which a fraction of the local maximum is reached for the first time. @@ -355,7 +358,7 @@ class SeismicShot(object): :param: cutwindow [seconds], cut a part of the trace as in Characteristic Function :type: 'tuple' - :param: folm, fraction of local maximum (default = 0.6) + :param: folm, fraction of local maximum :type: 'real' ''' hoscflist = list(hoscf.getCF()) @@ -663,7 +666,7 @@ class SeismicShot(object): ax.legend() ax.text(0.05, 0.9, 'SNR: %s' %snr, transform = ax.transAxes) - def plot_traces(self, traceID, folm = 0.6): ########## 2D, muss noch mehr verbessert werden ########## + def plot_traces(self, traceID): ########## 2D, muss noch mehr verbessert werden ########## from matplotlib.widgets import Button def onclick(event): @@ -688,6 +691,8 @@ class SeismicShot(object): def cleanup(event): self.traces4plot[traceID] = {} + folm = self.folm + fig = plt.figure() ax1 = fig.add_subplot(2,1,1) ax2 = fig.add_subplot(2,1,2, sharex = ax1) @@ -745,7 +750,7 @@ class SeismicShot(object): ax.legend() return ax - def _drawCFs(self, traceID, folm, refresh = False): + def _drawCFs(self, traceID, folm = None, refresh = False): hoscf = self.getHOScf(traceID) aiccf = self.getAICcf(traceID) ax = self.traces4plot[traceID]['ax2'] @@ -773,9 +778,10 @@ class SeismicShot(object): [ax.get_ylim()[0], ax.get_ylim()[1]], 'b:', label = 'latest') - ax.plot([0, self.getPick(traceID)], - [folm * max(hoscf.getCF()), folm * max(hoscf.getCF())], - 'm:', label = 'folm = %s' %folm) + if folm is not None: + ax.plot([0, self.getPick(traceID)], + [folm * max(hoscf.getCF()), folm * max(hoscf.getCF())], + 'm:', label = 'folm = %s' %folm) ax.set_xlabel('Time [s]') ax.legend() @@ -834,7 +840,7 @@ class SeismicShot(object): plotmethod[method](*args) - def matshow(self, ax = None, step = 0.5, method = 'linear', plotRec = True, annotations = True, colorbar = True): + def matshow(self, ax = None, step = 0.5, method = 'linear', plotRec = True, annotations = True, colorbar = True, legend = True): ''' Plots a 2D matrix of the interpolated traveltimes. This needs less performance than plot3dttc @@ -899,7 +905,8 @@ class SeismicShot(object): cbar = plt.colorbar(sc) cbar.set_label('Time [s]') - ax.legend() + if legend == True: + ax.legend() ax.set_xlabel('X') ax.set_ylabel('Y') ax.plot(self.getSrcLoc()[0], self.getSrcLoc()[1],'*k', markersize = 15) # plot source location