def flatten(): clip = 0.85 # f = readImage(ffile) # sigma = 8.0 f, g, s1, s2, r1, r2 = FakeData.seismicAndShifts2d2011A(n1, n2, 45) f = g d = getDeterminantsFromShifts([r1, r2]) plot(f, cmin=-clip, cmax=clip) # plot(r1,jet) # plot(r2,jet) # plot(d,jet,cmin=0.65,cmax=1.35) sigma, pmax = 1.0, 10.0 lsf = LocalSlopeFinder(sigma, pmax) p2 = zerofloat(n1, n2) el = zerofloat(n1, n2) lsf.findSlopes(f, p2, el) el = pow(el, 6) sigma1, sigma2 = 6.0, 6.0 fl = FlattenerS(sigma1, sigma2) # plot(el,gray) # plot(p2,gray,-1,1) for rotate in [0.0]: s = fl.findShifts(rotate, p2, el) g = fl.applyShifts(s, f) plot(g, cmin=-clip, cmax=clip) s1, s2 = s[0], s[1] plot(s1, jet) plot(s2, jet) d = getDeterminantsFromShifts(s) plot(d, jet, cmin=0.65, cmax=1.35) print "average s1 =", sum(s1) / n1 / n2, "samples" print "average s2 =", sum(s2) / n1 / n2, "samples"
def flatten(): clip = 0.85 #f = readImage(ffile) #sigma = 8.0 f, g, s1, s2, r1, r2 = FakeData.seismicAndShifts2d2011A(n1, n2, 45) f = g d = getDeterminantsFromShifts([r1, r2]) plot(f, cmin=-clip, cmax=clip) #plot(r1,jet) #plot(r2,jet) #plot(d,jet,cmin=0.65,cmax=1.35) sigma, pmax = 1.0, 10.0 lsf = LocalSlopeFinder(sigma, pmax) p2 = zerofloat(n1, n2) el = zerofloat(n1, n2) lsf.findSlopes(f, p2, el) el = pow(el, 6) sigma1, sigma2 = 6.0, 6.0 fl = FlattenerS(sigma1, sigma2) #plot(el,gray) #plot(p2,gray,-1,1) for rotate in [0.0]: s = fl.findShifts(rotate, p2, el) g = fl.applyShifts(s, f) plot(g, cmin=-clip, cmax=clip) s1, s2 = s[0], s[1] plot(s1, jet) plot(s2, jet) d = getDeterminantsFromShifts(s) plot(d, jet, cmin=0.65, cmax=1.35) print "average s1 =", sum(s1) / n1 / n2, "samples" print "average s2 =", sum(s2) / n1 / n2, "samples"
def makeFakeImages(smax,nrms): f = FakeData.seismic3d2010A(n1,n2,n3,20.0,10.0,30.0,0.5,0.0); w = Warp3.sinusoid(0.5*smax,0.0,0.0,0.5*smax,0.0,0.0,n1,n2,n3) #w = Warp3.constant(smax,0.0,0.0,n1,n2,n3) g = w.warp1(f) f = addNoise(nrms,f,seed=10*seed+1) g = addNoise(nrms,g,seed=10*seed+2) s = w.u1x() return f,g,s
def makeFakeImages(smax, nrms): f = FakeData.seismic3d2010A(n1, n2, n3, 20.0, 10.0, 30.0, 0.5, 0.0) w = Displacement3.sinusoid(0.5 * smax, 0.0, 0.0, n1, n2, n3) #w = Warp3.constant(smax,0.0,0.0,n1,n2,n3) g = w.warp(f) f = addNoise(nrms, f, seed=10 * seed + 1) g = addNoise(nrms, g, seed=10 * seed + 2) s = w.u1x() return f, g, s
def sergey(): for nrms in [0.0,0.5,1.0]: f,p = FakeData.seismicAndSlopes2d2014A(nrms) plot(f,cmin=fmin,cmax=fmax,title="input image") plot(p,cmin=pmin,cmax=pmax,title="known slopes") fname = "f"+str(int(nrms*10)) pname = "p" writeImage(fname,f) writeImage(pname,p)
def slopesPwd(): f, p = FakeData.seismicAndSlopes2d2014A(nrms) pmax = max(abs(min(p)), abs(max(p))) pwd = PlaneWaveDestructor(pmin, pmax) pwd.setSmoothness(1.5, 0.5) pwd.setLateralBias(0.0) # 0.0 is the default pwd.setOuterIterations(10) # 5 is the default q = pwd.findSlopes(f) g = pwd.applyFilter(q, f) plot(f, cmin=fmin, cmax=fmax, title="input image") plot(g, cmin=emin, cmax=emax, title="output image") plot(p, cmin=pmin, cmax=pmax, cmap=jet, title="slopes: pwd")
def slopesPwd(): f,p = FakeData.seismicAndSlopes2d2014A(nrms) pmax = max(abs(min(p)),abs(max(p))) pwd = PlaneWaveDestructor(pmin,pmax) pwd.setSmoothness(1.5,0.5) pwd.setLateralBias(0.0) # 0.0 is the default pwd.setOuterIterations(10) # 5 is the default q = pwd.findSlopes(f) g = pwd.applyFilter(q,f) plot(f,cmin=fmin,cmax=fmax,title="input image") plot(g,cmin=emin,cmax=emax,title="output image") plot(p,cmin=pmin,cmax=pmax,cmap=jet,title="slopes: pwd")
def showFake(): clip = 0.85 f, g, s1, s2, r1, r2 = FakeData.seismicAndShifts2d2011A(n1, n2, 45) plot(f, cmin=-clip, cmax=clip) plot(g, cmin=-clip, cmax=clip) plot(r1, jet) plot(r2, jet) d = getDeterminantsFromShifts([r1, r2]) plot(d, jet) a = getAFromShifts([r1, r2]) plot(a, jet, cmin=-1, cmax=2) a = applyInverseShiftsL([s1, s2], a) plot(a, jet, cmin=-1, cmax=2)
def showFake(): clip = 0.85 f,g,s1,s2,r1,r2 = FakeData.seismicAndShifts2d2011A(n1,n2,45) plot(f,cmin=-clip,cmax=clip) plot(g,cmin=-clip,cmax=clip) plot(r1,jet) plot(r2,jet) d = getDeterminantsFromShifts([r1,r2]) plot(d,jet) a = getAFromShifts([r1,r2]) plot(a,jet,cmin=-1,cmax=2) a = applyInverseShiftsL([s1,s2],a) plot(a,jet,cmin=-1,cmax=2)
def makeTestImages(): dip = 30.0 shift = 16 n1,n2 = 501,501; f = FakeData.seismic2d2011A(n1,n2,dip) #n1,n2 = 462,951; f = readImage("/data/seis/f3d/f3d75.dat",n1,n2) f = sub(f,sum(f)/n1/n2) #w = Warp2.constant(shift,0.0,n1,n2) w = Warp2.sinusoid(shift,0.0,n1,n2) g = w.warp(f) f = addNoise(nrms,f,seed=10*seed+1) g = addNoise(nrms,g,seed=10*seed+2) s = zerofloat(n1,n2) for i2 in range(n2): for i1 in range(n1): s[i2][i1] = w.u1x(i1,i2) return f,g,s
def flatten(): #f = readImage(ffile) f = FakeData.seismic2d2011A(n1,n2,45) plot(f) #sigma = 8.0 sigma = 1.0 pmax = 10.0 lsf = LocalSlopeFinder(sigma,pmax) sigma1 = 6.0 sigma2 = 12.0 for fl in [FlattenerCg(sigma1,sigma2)]: p2 = zerofloat(n1,n2) el = zerofloat(n1,n2) lsf.findSlopes(f,p2,el) el = pow(el,6) #plot(el,gray) #plot(p2,gray,-1,1) s = fl.findShifts(p2,el) g = fl.applyShifts(f,s) plot(g) plot(s,jet) print "average shift =",sum(s)/(n1*n2),"samples"
def flatten(): #f = readImage(ffile) f = FakeData.seismic2d2011A(n1, n2, 45) plot(f) #sigma = 8.0 sigma = 1.0 pmax = 10.0 lsf = LocalSlopeFinder(sigma, pmax) sigma1 = 6.0 sigma2 = 12.0 for fl in [FlattenerCg(sigma1, sigma2)]: p2 = zerofloat(n1, n2) el = zerofloat(n1, n2) lsf.findSlopes(f, p2, el) el = pow(el, 6) #plot(el,gray) #plot(p2,gray,-1,1) s = fl.findShifts(p2, el) g = fl.applyShifts(f, s) plot(g) plot(s, jet) print "average shift =", sum(s) / (n1 * n2), "samples"
def compare(): sigma1, sigma2 = 12, 2 eps1, eps2 = 2.0, 0.5 nrms = 0.50 f, p = FakeData.seismicAndSlopes2d2014A(nrms) pwd = PlaneWaveDestructor(-8, 8) pwd.setOuterIterations(10) # 5 is the default pwd.setSmoothness(eps1, eps2) pa = pwd.findSlopes(f) ea = sub(pa, p) ga = pwd.applyFilter(pa, f) lsf = LocalSlopeFinder(sigma1, sigma2, 8) pb = zerofloat(n1, n2) lsf.findSlopes(f, pb, None) eb = sub(pb, p) gb = pwd.applyFilter(pb, f) plot(p, cmin=pmin, cmax=pmax, cmap=jet, title="slopes: syn") plot(pa, cmin=pmin, cmax=pmax, cmap=jet, title="slopes: pwd") plot(pb, cmin=pmin, cmax=pmax, cmap=jet, title="slopes: lsf") plot(ea, cmin=0.5 * pmin, cmax=0.5 * pmax, cmap=jet, title="errors: pwd") plot(eb, cmin=0.5 * pmin, cmax=0.5 * pmax, cmap=jet, title="errors: lsf") plot(ga, cmin=emin, cmax=emax, title="output image: pwd") plot(gb, cmin=emin, cmax=emax, title="output image: lsf") plot(f, cmin=fmin, cmax=fmax, title="input image")
def compare(): sigma1,sigma2 = 12,2 eps1,eps2 = 2.0,0.5 nrms = 0.50 f,p = FakeData.seismicAndSlopes2d2014A(nrms) pwd = PlaneWaveDestructor(-8,8) pwd.setOuterIterations(10) # 5 is the default pwd.setSmoothness(eps1,eps2) pa = pwd.findSlopes(f) ea = sub(pa,p) ga = pwd.applyFilter(pa,f) lsf = LocalSlopeFinder(sigma1,sigma2,8) pb = zerofloat(n1,n2) lsf.findSlopes(f,pb,None) eb = sub(pb,p) gb = pwd.applyFilter(pb,f) plot(p ,cmin=pmin,cmax=pmax,cmap=jet,title="slopes: syn") plot(pa,cmin=pmin,cmax=pmax,cmap=jet,title="slopes: pwd") plot(pb,cmin=pmin,cmax=pmax,cmap=jet,title="slopes: lsf") plot(ea,cmin=0.5*pmin,cmax=0.5*pmax,cmap=jet,title="errors: pwd") plot(eb,cmin=0.5*pmin,cmax=0.5*pmax,cmap=jet,title="errors: lsf") plot(ga,cmin=emin,cmax=emax,title="output image: pwd") plot(gb,cmin=emin,cmax=emax,title="output image: lsf") plot(f,cmin=fmin,cmax=fmax,title="input image")