From ce705888f198e41c4fb8e6501a8146a3c3b55f6c Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Tue, 19 Jan 2016 10:31:06 +0100 Subject: [PATCH] bugfixes and other not further specified changes --- pylot/core/active/activeSeismoPick.py | 5 +++-- pylot/core/active/seismicArrayPreparation.py | 13 +++++++++---- pylot/core/active/seismicshot.py | 17 ++++++++++++----- pylot/core/active/surveyUtils.py | 10 ++++++++-- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/pylot/core/active/activeSeismoPick.py b/pylot/core/active/activeSeismoPick.py index 5632664f..2e8c4058 100644 --- a/pylot/core/active/activeSeismoPick.py +++ b/pylot/core/active/activeSeismoPick.py @@ -170,9 +170,10 @@ class Survey(object): for traceID in shot.getTraceIDlist(): if shot.getPickFlag(traceID) == 1 and shot.getManualPickFlag(traceID) == 1: diffs.append(self.getDiffsFromManual()[shot][traceID]) - plt.hist(diffs, nbins) + hist = plt.hist(diffs, nbins, histtype = 'step', normed = True, stacked = True) plt.title('Histogram of the differences between automatic and manual pick') plt.xlabel('Difference in time (auto - manual) [s]') + return diffs def pickAllShots(self, windowsize, HosAic = 'hos', vmin = 333, vmax = 5500, folm = 0.6): ''' @@ -421,7 +422,7 @@ class Survey(object): #ax = fig.add_subplot(3,3,i, projection = '3d', title = 'shot:' #+str(shot_dict[shotnumber].getShotnumber()), xlabel = 'X', ylabel = 'Y', zlabel = 'traveltime') #shot_dict[shotnumber].plot3dttc(ax = ax, plotpicks = True) - ax = fig.add_subplot(3, 4, index) + ax = fig.add_subplot(rows, columns, index) if mode == '3d': self.getShot(shotnumber).matshow(ax = ax, colorbar = False, annotations = True, legend = False) elif mode == '2d': diff --git a/pylot/core/active/seismicArrayPreparation.py b/pylot/core/active/seismicArrayPreparation.py index 607d904f..22cd8486 100644 --- a/pylot/core/active/seismicArrayPreparation.py +++ b/pylot/core/active/seismicArrayPreparation.py @@ -747,6 +747,9 @@ class SeisArray(object): return surface def exportAll(self, filename = 'interpolated_receivers.out'): + ''' + Exports all receivers to an input file for ActiveSeismoPick3D. + ''' recfile_out = open(filename, 'w') count = 0 for traceID in self.getReceiverCoordinates().keys(): @@ -803,7 +806,7 @@ class SeisArray(object): xrc, yrc, zrc = self.getReceiverLists() xsc, ysc, zsc = self.getSourceLocsLists() - plt.title('3D plot of seismic array %s'%self.recfile) + plt.title('3D plot of seismic array.') if len(xmt) > 0: ax.plot(xmt, ymt, zmt, 'b.', markersize = 10, label = 'measured topo points') if len(xrc) > 0: @@ -812,7 +815,7 @@ class SeisArray(object): ax.plot(xmr, ymr, zmr, 'ro', label = 'measured receivers') if len(xsc) > 0: ax.plot(xsc, ysc, zsc, 'b*', label = 'shot locations') - ax.set_xlabel('X'); ax.set_ylabel('Y'); ax.set_zlabel('elevation') + ax.set_xlabel('X [m]'); ax.set_ylabel('Y [m]'); ax.set_zlabel('Z [m]') ax.legend() return ax @@ -842,13 +845,15 @@ class SeisArray(object): zgrid = griddata((x, y), z, (xgrid, ygrid), method = method) - ax.plot_surface(xgrid, ygrid, zgrid, linewidth = 0, cmap = cm.jet, vmin = min(z), vmax = max(z)) + surf = ax.plot_surface(xgrid, ygrid, zgrid, linewidth = 0, cmap = cm.jet, vmin = min(z), vmax = max(z)) + cbar = plt.colorbar(surf) + cbar.set_label('Elevation [m]') if exag == False: ax.set_zlim(-(max(x) - min(x)/2),(max(x) - min(x)/2)) ax.set_aspect('equal') - ax.set_xlabel('X'); ax.set_ylabel('Y'); ax.set_zlabel('elevation') + ax.set_xlabel('X [m]'); ax.set_ylabel('Y [m]'); ax.set_zlabel('Z [m]') ax.legend() return ax diff --git a/pylot/core/active/seismicshot.py b/pylot/core/active/seismicshot.py index 0bed77d4..8fbdbfb8 100644 --- a/pylot/core/active/seismicshot.py +++ b/pylot/core/active/seismicshot.py @@ -365,7 +365,11 @@ class SeismicShot(object): leftb = int(pickwindow[0] / self.getCut()[1] * len(hoscflist)) rightb = int(pickwindow[1] / self.getCut()[1] * len(hoscflist)) - threshold = folm * max(hoscflist[leftb : rightb]) # combination of local maximum and threshold + #threshold = folm * max(hoscflist[leftb : rightb]) # combination of local maximum and threshold + + ### TEST TEST + threshold = folm * (max(hoscflist[leftb : rightb]) - min(hoscflist[leftb : rightb])) + min(hoscflist[leftb : rightb]) # combination of local maximum and threshold + ### TEST TEST m = leftb @@ -376,7 +380,10 @@ class SeismicShot(object): lb = max(0, m - windowsize[0]) # if window exceeds t = 0 aiccfcut = list(aiccf.getCF())[lb : m + windowsize[1]] - n = aiccfcut.index(min(aiccfcut)) + if len(aiccfcut) > 0: + n = aiccfcut.index(min(aiccfcut)) + else: + n = 0 m = lb + n @@ -814,8 +821,8 @@ class SeismicShot(object): y.append(self.getRecLoc(traceID)[1]) z.append(self.getPick(traceID)) - xaxis = np.arange(min(x), max(x), step) - yaxis = np.arange(min(y), max(y), step) + xaxis = np.arange(min(x) + step, max(x), step) + yaxis = np.arange(min(y) + step, max(y), step) xgrid, ygrid = np.meshgrid(xaxis, yaxis) zgrid = griddata((x, y), z, (xgrid, ygrid), method = method) @@ -892,9 +899,9 @@ class SeismicShot(object): ax.text(0.5, 0.95, 'shot: %s' %self.getShotnumber(), transform = ax.transAxes , horizontalalignment = 'center') sc = ax.scatter(x, y, c = z, s = 30, label = 'picked shots', vmin = tmin, vmax = tmax, cmap = cmap, linewidths = 1.5) + label = None for xyz in zip(xcut, ycut, zcut): x, y, z = xyz - label = None if z > tmax: count += 1 z = 'w' diff --git a/pylot/core/active/surveyUtils.py b/pylot/core/active/surveyUtils.py index a3081517..c4180e10 100644 --- a/pylot/core/active/surveyUtils.py +++ b/pylot/core/active/surveyUtils.py @@ -54,7 +54,7 @@ def plotFittedSNR(dists, snrthresholds, snrs, snrBestFit): plt.ylabel('SNR') plt.legend() -def setFittedSNR(shot_dict, shiftdist = 30, shiftSNR = 100, p1 = 0.004, p2 = -0.0007): +def setDynamicFittedSNR(shot_dict, shiftdist = 30, shiftSNR = 100, p1 = 0.004, p2 = -0.0007): import numpy as np minSNR = 2.5 #fit_fn = fitSNR4dist(shot_dict) @@ -69,8 +69,14 @@ def setFittedSNR(shot_dict, shiftdist = 30, shiftSNR = 100, p1 = 0.004, p2 = -0. shot.setSNRthreshold(traceID, minSNR) else: shot.setSNRthreshold(traceID, snrthreshold) - print "setFittedSNR: Finished setting of fitted SNR-threshold" + print "setDynamicFittedSNR: Finished setting of fitted SNR-threshold" +def setConstantSNR(shot_dict, snrthreshold = 2.5): + import numpy as np + for shot in shot_dict.values(): + for traceID in shot.getTraceIDlist(): + shot.setSNRthreshold(traceID, snrthreshold) + print "setConstantSNR: Finished setting of SNR threshold to a constant value of %s"%snrthreshold def findTracesInRanges(shot_dict, distancebin, pickbin): '''