def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 kernel = xl.getGaussian(xs - 4, ys - 4, zs - 4) inlFactor = xa.SI['zstep'] / xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep'] / xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() g = xa.Input['Input'] # # Compute gradients gx = xl.farid5(g, axis=0) gy = xl.farid5(g, axis=1) gz = xl.farid5(g, axis=2) # # Inner product of gradients gx2 = gx[2:xs - 2, 2:ys - 2, :] * gx[2:xs - 2, 2:ys - 2, :] gy2 = gy[2:xs - 2, 2:ys - 2, :] * gy[2:xs - 2, 2:ys - 2, :] gz2 = gz[2:xs - 2, 2:ys - 2, :] * gz[2:xs - 2, 2:ys - 2, :] gxgy = gx[2:xs - 2, 2:ys - 2, :] * gy[2:xs - 2, 2:ys - 2, :] gxgz = gx[2:xs - 2, 2:ys - 2, :] * gz[2:xs - 2, 2:ys - 2, :] gygz = gy[2:xs - 2, 2:ys - 2, :] * gz[2:xs - 2, 2:ys - 2, :] # # Outer gaussian smoothing rgx2 = xl.sconvolve(gx2, kernel) rgy2 = xl.sconvolve(gy2, kernel) rgz2 = xl.sconvolve(gz2, kernel) rgxgy = xl.sconvolve(gxgy, kernel) rgxgz = xl.sconvolve(gxgz, kernel) rgygz = xl.sconvolve(gygz, kernel) # # Form the structure tensor T = np.rollaxis( np.array([[rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evecs = evecs[np.arange(0, T.shape[0], 1), :, ndx[:, 2]] e1 = evals[np.arange(0, T.shape[0], 1), ndx[:, 2]] e2 = evals[np.arange(0, T.shape[0], 1), ndx[:, 1]] xa.Output['Crl_dip'] = -evecs[:, 1] / evecs[:, 2] * crlFactor xa.Output['Inl_dip'] = -evecs[:, 0] / evecs[:, 2] * inlFactor xa.Output['True Dip'] = np.sqrt( xa.Output['Crl_dip'] * xa.Output['Crl_dip'] + xa.Output['Inl_dip'] * xa.Output['Inl_dip']) xa.Output['Dip Azimuth'] = np.degrees( np.arctan2(xa.Output['Inl_dip'], xa.Output['Crl_dip'])) coh = (e1 - e2) / (e1 + e2) xa.Output['Coherency'] = coh * coh xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = xl.getGaussian(xs, ys, zs) while True: xa.doInput() gx = xa.Input['In-line gradient'] gy = xa.Input['Cross-line gradient'] gz = xa.Input['Z gradient'] # # Inner product of gradients gx2 = gx * gx gy2 = gy * gy gz2 = gz * gz gxgy = gx * gy gxgz = gx * gz gygz = gy * gz # # Outer gaussian smoothing rgx2 = xl.sconvolve(gx2, kernel) rgy2 = xl.sconvolve(gy2, kernel) rgz2 = xl.sconvolve(gz2, kernel) rgxgy = xl.sconvolve(gxgy, kernel) rgxgz = xl.sconvolve(gxgz, kernel) rgygz = xl.sconvolve(gygz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([ [rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2 ]]), 2) # # Get the eigenvalues w = np.linalg.eigvalsh(T) v = np.rollaxis(np.sort(w),1) e1 = v[2,:] e2 = v[1,:] e3 = v[0,:] # # Calculate the attributes e1me2 = e1-e2 e1me3 = e1-e3 e2me3 = e2-e3 e1pe3 = e1+e3 xa.Output['Cline'] = e2me3/(e2+e3) xa.Output['Cplane'] = e1me2/(e1+e2) xa.Output['Cfault'] = xa.Output['Cline']*(1.0 - xa.Output['Cplane']) xa.Output['Cchaos'] = 4.0 * e1 * e3 * (e1 + e2 + e3)/(e1pe3*e1pe3) xa.Output['Ctype'] = (e1me2*e1me2 + e1me3*e1me3 + e2me3*e2me3)/(e1*e1 + e2*e2 + e3*e3) xa.doOutput()
def doCompute(): xs = xa.SI["nrinl"] ys = xa.SI["nrcrl"] zs = xa.params["ZSampMargin"]["Value"][1] - xa.params["ZSampMargin"]["Value"][0] + 1 kernel = xl.getGaussian(xs - 4, ys - 4, zs - 4) inlFactor = xa.SI["zstep"] / xa.SI["inldist"] * xa.SI["dipFactor"] crlFactor = xa.SI["zstep"] / xa.SI["crldist"] * xa.SI["dipFactor"] while True: xa.doInput() g = xa.Input["Input"] # # Compute gradients gx = xl.farid5(g, axis=0) gy = xl.farid5(g, axis=1) gz = xl.farid5(g, axis=2) # # Inner product of gradients gx2 = gx[2 : xs - 2, 2 : ys - 2, :] * gx[2 : xs - 2, 2 : ys - 2, :] gy2 = gy[2 : xs - 2, 2 : ys - 2, :] * gy[2 : xs - 2, 2 : ys - 2, :] gz2 = gz[2 : xs - 2, 2 : ys - 2, :] * gz[2 : xs - 2, 2 : ys - 2, :] gxgy = gx[2 : xs - 2, 2 : ys - 2, :] * gy[2 : xs - 2, 2 : ys - 2, :] gxgz = gx[2 : xs - 2, 2 : ys - 2, :] * gz[2 : xs - 2, 2 : ys - 2, :] gygz = gy[2 : xs - 2, 2 : ys - 2, :] * gz[2 : xs - 2, 2 : ys - 2, :] # # Outer gaussian smoothing rgx2 = xl.sconvolve(gx2, kernel) rgy2 = xl.sconvolve(gy2, kernel) rgz2 = xl.sconvolve(gz2, kernel) rgxgy = xl.sconvolve(gxgy, kernel) rgxgz = xl.sconvolve(gxgz, kernel) rgygz = xl.sconvolve(gygz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([[rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evecs = evecs[np.arange(0, T.shape[0], 1), :, ndx[:, 2]] e1 = evals[np.arange(0, T.shape[0], 1), ndx[:, 2]] e2 = evals[np.arange(0, T.shape[0], 1), ndx[:, 1]] xa.Output["Crl_dip"] = -evecs[:, 1] / evecs[:, 2] * crlFactor xa.Output["Inl_dip"] = -evecs[:, 0] / evecs[:, 2] * inlFactor xa.Output["True Dip"] = np.sqrt( xa.Output["Crl_dip"] * xa.Output["Crl_dip"] + xa.Output["Inl_dip"] * xa.Output["Inl_dip"] ) xa.Output["Dip Azimuth"] = np.degrees(np.arctan2(xa.Output["Inl_dip"], xa.Output["Crl_dip"])) coh = (e1 - e2) / (e1 + e2) xa.Output["Coherency"] = coh * coh xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = xl.getGaussian(xs, ys, zs) inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() gx = xa.Input['In-line gradient'] gy = xa.Input['Cross-line gradient'] gz = xa.Input['Z gradient'] # # Inner product of gradients gx2 = gx * gx gy2 = gy * gy gz2 = gz * gz gxgy = gx * gy gxgz = gx * gz gygz = gy * gz # # Outer gaussian smoothing rgx2 = xl.sconvolve(gx2, kernel) rgy2 = xl.sconvolve(gy2, kernel) rgz2 = xl.sconvolve(gz2, kernel) rgxgy = xl.sconvolve(gxgy, kernel) rgxgz = xl.sconvolve(gxgz, kernel) rgygz = xl.sconvolve(gygz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([ [rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2 ]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evecs = evecs[np.arange(0,T.shape[0],1),:,ndx[:,2]] eval2 = evals[np.arange(0,T.shape[0],1),ndx[:,2]] eval1 = evals[np.arange(0,T.shape[0],1),ndx[:,1]] xa.Output['Crl_dip'] = -evecs[:,1]/evecs[:,2]*crlFactor xa.Output['Inl_dip'] = -evecs[:,0]/evecs[:,2]*inlFactor xa.Output['True Dip'] = np.sqrt(xa.Output['Crl_dip']*xa.Output['Crl_dip']+xa.Output['Inl_dip']*xa.Output['Inl_dip']) xa.Output['Dip Azimuth'] = np.degrees(np.arctan2(xa.Output['Inl_dip'],xa.Output['Crl_dip'])) coh = (eval2-eval1)/(eval2+eval1) xa.Output['Coherency'] = coh * coh xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = xl.getGaussian(xs, ys, zs) while True: xa.doInput() gx = xa.Input['In-line gradient'] gy = xa.Input['Cross-line gradient'] gz = xa.Input['Z gradient'] # # Inner product of gradients gx2 = gx * gx gy2 = gy * gy gz2 = gz * gz gxgy = gx * gy gxgz = gx * gz gygz = gy * gz # # Outer gaussian smoothing rgx2 = xl.sconvolve(gx2, kernel) rgy2 = xl.sconvolve(gy2, kernel) rgz2 = xl.sconvolve(gz2, kernel) rgxgy = xl.sconvolve(gxgy, kernel) rgxgz = xl.sconvolve(gxgz, kernel) rgygz = xl.sconvolve(gygz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([ [rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2 ]]), 2) # # Get the eigenvalues w = np.linalg.eigvalsh(T) v = np.rollaxis(np.sort(w),1) xa.Output['e1'] = v[2,:] xa.Output['e2'] = v[1,:] xa.Output['e3'] = v[0,:] xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = min(2*int(xa.params['Par_0']['Value'])+1,3) kernel = xl.getGaussian(xs-2, ys-2, zs-2) hxs = xs//2 hys = ys//2 inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] N = xa.params['ZSampMargin']['Value'][1] band = xa.params['Par_1']['Value'] hilbkernel = xl.hilbert_kernel(N, band) while True: xa.doInput() indata = xa.Input['Input'] # # Analytic Signal # ansig = np.apply_along_axis(np.convolve,-1, indata, hilbkernel, mode="same") sr = np.real(ansig) si = np.imag(ansig) # # Compute partial derivatives # sx = xl.kroon3( sr, axis=0 ) sy = xl.kroon3( sr, axis=1 ) sz = xl.kroon3( sr, axis=2 ) shx = xl.kroon3( si, axis=0 ) shy = xl.kroon3( si, axis=1 ) shz = xl.kroon3( si, axis=2 ) px = sr[1:xs-1,1:ys-1,:] * shx[1:xs-1,1:ys-1,:] - si[1:xs-1,1:ys-1,:] * sx[1:xs-1,1:ys-1,:] py = sr[1:xs-1,1:ys-1,:] * shy[1:xs-1,1:ys-1,:] - si[1:xs-1,1:ys-1,:] * sy[1:xs-1,1:ys-1,:] pz = sr[1:xs-1,1:ys-1,:] * shz[1:xs-1,1:ys-1,:] - si[1:xs-1,1:ys-1,:] * sz[1:xs-1,1:ys-1,:] # # Inner product of gradients px2 = px * px py2 = py * py pz2 = pz * pz pxpy = px * py pxpz = px * pz pypz = py * pz # # Outer smoothing rgx2 = xl.sconvolve(px2, kernel) rgy2 = xl.sconvolve(py2, kernel) rgz2 = xl.sconvolve(pz2, kernel) rgxgy = xl.sconvolve(pxpy, kernel) rgxgz = xl.sconvolve(pxpz, kernel) rgygz = xl.sconvolve(pypz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([ [rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2 ]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evec = evecs[np.arange(0,T.shape[0],1),:,ndx[:,2]] e1 = evals[np.arange(0,T.shape[0],1),ndx[:,2]] e2 = evals[np.arange(0,T.shape[0],1),ndx[:,1]] xa.Output['Crl_dip'] = -evec[:,1]/evec[:,2]*crlFactor xa.Output['Inl_dip'] = -evec[:,0]/evec[:,2]*inlFactor xa.Output['True Dip'] = np.sqrt(xa.Output['Crl_dip']*xa.Output['Crl_dip']+xa.Output['Inl_dip']*xa.Output['Inl_dip']) xa.Output['Dip Azimuth'] = np.degrees(np.arctan2(xa.Output['Inl_dip'],xa.Output['Crl_dip'])) xa.Output['Cplane'] = (e1-e2)/(e1+e2) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = xl.getGaussian(xs-2, ys-2, zs-2) hxs = xs//2 hys = ys//2 inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() s = xa.Input['Input'] sh = np.imag( hilbert(s) ) # # Compute partial derivatives sx = xl.kroon3( s, axis=0 ) sy = xl.kroon3( s, axis=1 ) sz = xl.kroon3( s, axis=2 ) shx = xl.kroon3( sh, axis=0 ) shy = xl.kroon3( sh, axis=1 ) shz = xl.kroon3( sh, axis=2 ) px = s[1:xs-1,1:ys-1,:] * shx[1:xs-1,1:ys-1,:] - sh[1:xs-1,1:ys-1,:] * sx[1:xs-1,1:ys-1,:] py = s[1:xs-1,1:ys-1,:] * shy[1:xs-1,1:ys-1,:] - sh[1:xs-1,1:ys-1,:] * sy[1:xs-1,1:ys-1,:] pz = s[1:xs-1,1:ys-1,:] * shz[1:xs-1,1:ys-1,:] - sh[1:xs-1,1:ys-1,:] * sz[1:xs-1,1:ys-1,:] # # Inner product of gradients px2 = px * px py2 = py * py pz2 = pz * pz pxpy = px * py pxpz = px * pz pypz = py * pz # # Outer smoothing rgx2 = xl.sconvolve(px2, kernel) rgy2 = xl.sconvolve(py2, kernel) rgz2 = xl.sconvolve(pz2, kernel) rgxgy = xl.sconvolve(pxpy, kernel) rgxgz = xl.sconvolve(pxpz, kernel) rgygz = xl.sconvolve(pypz, kernel) # # Form the structure tensor T = np.rollaxis(np.array([ [rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2 ]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evec = evecs[np.arange(0,T.shape[0],1),:,ndx[:,2]] e1 = evals[np.arange(0,T.shape[0],1),ndx[:,2]] e2 = evals[np.arange(0,T.shape[0],1),ndx[:,1]] xa.Output['Crl_dip'] = -evec[:,1]/evec[:,2]*crlFactor xa.Output['Inl_dip'] = -evec[:,0]/evec[:,2]*inlFactor xa.Output['True Dip'] = np.sqrt(xa.Output['Crl_dip']*xa.Output['Crl_dip']+xa.Output['Inl_dip']*xa.Output['Inl_dip']) xa.Output['Dip Azimuth'] = np.degrees(np.arctan2(xa.Output['Inl_dip'],xa.Output['Crl_dip'])) xa.Output['Cplane'] = (e1-e2)/(e1+e2) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 kernel = xl.getGaussian(xs - 2, ys - 2, zs - 2) hxs = xs // 2 hys = ys // 2 inlFactor = xa.SI['zstep'] / xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep'] / xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() s = xa.Input['Input'] sh = np.imag(hilbert(s)) # # Compute partial derivatives sx = xl.kroon3(s, axis=0) sy = xl.kroon3(s, axis=1) sz = xl.kroon3(s, axis=2) shx = xl.kroon3(sh, axis=0) shy = xl.kroon3(sh, axis=1) shz = xl.kroon3(sh, axis=2) a = s[1:xs - 1, 1:ys - 1, :] * s[1:xs - 1, 1:ys - 1, :] + sh[ 1:xs - 1, 1:ys - 1, :] * sh[1:xs - 1, 1:ys - 1, :] px = (s[1:xs - 1, 1:ys - 1, :] * shx[1:xs - 1, 1:ys - 1, :] - sh[1:xs - 1, 1:ys - 1, :] * sx[1:xs - 1, 1:ys - 1, :]) / a py = (s[1:xs - 1, 1:ys - 1, :] * shy[1:xs - 1, 1:ys - 1, :] - sh[1:xs - 1, 1:ys - 1, :] * sy[1:xs - 1, 1:ys - 1, :]) / a pz = (s[1:xs - 1, 1:ys - 1, :] * shz[1:xs - 1, 1:ys - 1, :] - sh[1:xs - 1, 1:ys - 1, :] * sz[1:xs - 1, 1:ys - 1, :]) / a # # Inner product of gradients px2 = px * px py2 = py * py pz2 = pz * pz pxpy = px * py pxpz = px * pz pypz = py * pz # # Outer smoothing rgx2 = xl.sconvolve(px2, kernel) rgy2 = xl.sconvolve(py2, kernel) rgz2 = xl.sconvolve(pz2, kernel) rgxgy = xl.sconvolve(pxpy, kernel) rgxgz = xl.sconvolve(pxpz, kernel) rgygz = xl.sconvolve(pypz, kernel) # # Form the structure tensor T = np.rollaxis( np.array([[rgx2, rgxgy, rgxgz], [rgxgy, rgy2, rgygz], [rgxgz, rgygz, rgz2]]), 2) # # Get the eigenvalues and eigen vectors and calculate the dips evals, evecs = np.linalg.eigh(T) ndx = evals.argsort() evec = evecs[np.arange(0, T.shape[0], 1), :, ndx[:, 2]] e1 = evals[np.arange(0, T.shape[0], 1), ndx[:, 2]] e2 = evals[np.arange(0, T.shape[0], 1), ndx[:, 1]] xa.Output['Crl_dip'] = -evec[:, 1] / evec[:, 2] * crlFactor xa.Output['Inl_dip'] = -evec[:, 0] / evec[:, 2] * inlFactor xa.Output['True Dip'] = np.sqrt( xa.Output['Crl_dip'] * xa.Output['Crl_dip'] + xa.Output['Inl_dip'] * xa.Output['Inl_dip']) xa.Output['Dip Azimuth'] = np.degrees( np.arctan2(xa.Output['Inl_dip'], xa.Output['Crl_dip'])) xa.Output['Cplane'] = (e1 - e2) / (e1 + e2) xa.doOutput()