def doCompute(): inlpos = xa.SI['nrinl'] // 2 crlpos = xa.SI['nrcrl'] // 2 filt = xa.params['Select']['Selection'] while True: xa.doInput() indata = xa.Input['Input'] if filt == 0: xa.Output['In-line gradient'] = xl.scharr3_dx(indata, full=False) xa.Output['Cross-line gradient'] = xl.scharr3_dy(indata, full=False) xa.Output['Z gradient'] = xl.scharr3_dz(indata, full=False) else: xa.Output['In-line gradient'] = xl.kroon3(indata, axis=0)[inlpos, crlpos, :] xa.Output['Cross-line gradient'] = xl.kroon3(indata, axis=1)[inlpos, crlpos, :] xa.Output['Z gradient'] = xl.kroon3(indata, axis=-1)[inlpos, crlpos, :] xa.Output['Average Gradient'] = (xa.Output['In-line gradient'] + xa.Output['Cross-line gradient'] + xa.Output['Z gradient']) / 3 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) 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.kroon3(g, axis=0) gy = xl.kroon3(g, axis=1) gz = xl.kroon3(g, axis=2) # # Inner product of gradients gx2 = gx[1:xs - 1, 1:ys - 1, :] * gx[1:xs - 1, 1:ys - 1, :] gy2 = gy[1:xs - 1, 1:ys - 1, :] * gy[1:xs - 1, 1:ys - 1, :] gz2 = gz[1:xs - 1, 1:ys - 1, :] * gz[1:xs - 1, 1:ys - 1, :] gxgy = gx[1:xs - 1, 1:ys - 1, :] * gy[1:xs - 1, 1:ys - 1, :] gxgz = gx[1:xs - 1, 1:ys - 1, :] * gz[1:xs - 1, 1:ys - 1, :] gygz = gy[1:xs - 1, 1:ys - 1, :] * gz[1:xs - 1, 1:ys - 1, :] # # 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'])) xa.Output['Cplane'] = (e1 - e2) / e1 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) 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.kroon3(g, axis=0) gy = xl.kroon3(g, axis=1) gz = xl.kroon3(g, axis=2) # # Inner product of gradients gx2 = gx[1 : xs - 1, 1 : ys - 1, :] * gx[1 : xs - 1, 1 : ys - 1, :] gy2 = gy[1 : xs - 1, 1 : ys - 1, :] * gy[1 : xs - 1, 1 : ys - 1, :] gz2 = gz[1 : xs - 1, 1 : ys - 1, :] * gz[1 : xs - 1, 1 : ys - 1, :] gxgy = gx[1 : xs - 1, 1 : ys - 1, :] * gy[1 : xs - 1, 1 : ys - 1, :] gxgz = gx[1 : xs - 1, 1 : ys - 1, :] * gz[1 : xs - 1, 1 : ys - 1, :] gygz = gy[1 : xs - 1, 1 : ys - 1, :] * gz[1 : xs - 1, 1 : ys - 1, :] # # 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"])) xa.Output["Cplane"] = (e1 - e2) / e1 xa.doOutput()
def doCompute(): hxs = xa.SI['nrinl'] // 2 hys = xa.SI['nrcrl'] // 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() U = -xa.Input['Inl_dip'] / inlFactor V = -xa.Input['Crl_dip'] / crlFactor W = np.ones(U.shape) # # Calculate the derivatives of the components and some intermediate results ux = xl.kroon3(U, axis=0)[hxs, hys, :] uy = xl.kroon3(U, axis=1)[hxs, hys, :] uz = xl.kroon3(U, axis=2)[hxs, hys, :] vx = xl.kroon3(V, axis=0)[hxs, hys, :] vy = xl.kroon3(V, axis=1)[hxs, hys, :] vz = xl.kroon3(V, axis=2)[hxs, hys, :] wx = xl.kroon3(W, axis=0)[hxs, hys, :] wy = xl.kroon3(W, axis=1)[hxs, hys, :] wz = xl.kroon3(W, axis=2)[hxs, hys, :] u = U[hxs, hys, :] v = V[hxs, hys, :] w = W[hxs, hys, :] uv = u * v vw = v * w u2 = u * u v2 = v * v w2 = w * w u2pv2 = u2 + v2 v2pw2 = v2 + w2 s = np.sqrt(u2pv2 + w2) # # Compute the basic measures of Gauss's theory of surfaces E = np.ones(u.shape) F = -(u * w) / (np.sqrt(u2pv2) * np.sqrt(v2pw2)) G = np.ones(u.shape) D = -(-uv * vx + u2 * vy + v2 * ux - uv * uy) / (u2pv2 * s) Di = -(vw * (uy + vx) - 2 * u * w * vy - v2 * (uz + wx) + uv * (vz + wy)) / (2 * np.sqrt(u2pv2) * np.sqrt(v2pw2) * s) Dii = -(-vw * wy + v2 * wz + w2 * vy - vw * vz) / (v2pw2 * s) H = (E * Dii - 2 * F * Di + G * D) / (2 * (E * G - F * F)) K = (D * Dii - Di * Di) / (E * G - F * F) Kmin = H - np.sqrt(H * H - K) Kmax = H + np.sqrt(H * H - K) # # Get the output xa.Output['Mean curvature'] = H xa.Output['Gaussian curvature'] = K xa.Output['Maximum curvature'] = Kmax xa.Output['Minimum curvature'] = Kmin xa.Output['Most pos curvature'] = np.maximum(Kmax, Kmin) xa.Output['Most neg curvature'] = np.minimum(Kmax, Kmin) xa.doOutput()
def doCompute(): hxs = xa.SI['nrinl']//2 hys = xa.SI['nrcrl']//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() U = -xa.Input['Inl_dip']/inlFactor V = -xa.Input['Crl_dip']/crlFactor W = np.ones(U.shape) # # Calculate the derivatives of the components and some intermediate results ux = xl.kroon3( U, axis=0 )[hxs,hys,:] uy = xl.kroon3( U, axis=1 )[hxs,hys,:] uz = xl.kroon3( U, axis=2 )[hxs,hys,:] vx = xl.kroon3( V, axis=0 )[hxs,hys,:] vy = xl.kroon3( V, axis=1 )[hxs,hys,:] vz = xl.kroon3( V, axis=2 )[hxs,hys,:] wx = xl.kroon3( W, axis=0 )[hxs,hys,:] wy = xl.kroon3( W, axis=1 )[hxs,hys,:] wz = xl.kroon3( W, axis=2 )[hxs,hys,:] u = U[hxs,hys,:] v = V[hxs,hys,:] w = W[hxs,hys,:] uv = u*v vw = v*w u2 = u*u v2 = v*v w2 = w*w u2pv2 = u2+v2 v2pw2 = v2+w2 s = np.sqrt(u2pv2+w2) # # Compute the basic measures of Gauss's theory of surfaces E = np.ones(u.shape) F = -(u*w)/(np.sqrt(u2pv2)*np.sqrt(v2pw2)) G = np.ones(u.shape) D = -(-uv*vx+u2*vy+v2*ux-uv*uy)/(u2pv2*s) Di = -(vw*(uy+vx)-2*u*w*vy-v2*(uz+wx)+uv*(vz+wy))/(2*np.sqrt(u2pv2)*np.sqrt(v2pw2)*s) Dii = -(-vw*wy+v2*wz+w2*vy-vw*vz)/(v2pw2*s) H = (E*Dii - 2*F*Di + G*D)/(2*(E*G - F*F)) K = (D*Dii - Di*Di)/(E*G - F*F) Kmin = H - np.sqrt(H*H - K) Kmax = H + np.sqrt(H*H - K) # # Get the output xa.Output['Mean curvature'] = H xa.Output['Gaussian curvature'] = K xa.Output['Maximum curvature'] = Kmax xa.Output['Minimum curvature'] = Kmin xa.Output['Most pos curvature'] = np.maximum(Kmax,Kmin) xa.Output['Most neg curvature'] = np.minimum(Kmax,Kmin) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 zw = zs - 2 filt = xa.params['Select']['Selection'] filtFunc = autojit(xl.vecmean) if filt == 0 else autojit( xl.vmf_l1) if filt == 1 else autojit( xl.vmf_l2) if filt == 2 else autojit(xl.vmf_x3) inlFactor = xa.SI['zstep'] / xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep'] / xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() p = xa.Input['Input'] # # Compute partial derivatives px = xl.kroon3(p, axis=0)[1:xs - 1, 1:ys - 1, :] py = xl.kroon3(p, axis=1)[1:xs - 1, 1:ys - 1, :] pz = xl.kroon3(p, axis=2)[1:xs - 1, 1:ys - 1, :] # # Normalise the gradients so Z component is positive p = np.sign(pz) / np.sqrt(px * px + py * py + pz * pz) px *= p py *= p pz *= p # # Filter out = np.empty((3, xa.TI['nrsamp'])) xl.vecFilter(np.array([px, py, pz]), zw, filtFunc, out) # # Get the output xa.Output['Crl_dip'] = -out[1, :] / out[2, :] * crlFactor xa.Output['Inl_dip'] = -out[0, :] / out[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.doOutput()
def doCompute(): hxs = xa.SI['nrinl']//2 hys = xa.SI['nrcrl']//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 )[hxs,hys,:] sy = xl.kroon3( s, axis=1 )[hxs,hys,:] sz = xl.kroon3( s, axis=2 )[hxs,hys,:] shx = xl.kroon3( sh, axis=0 )[hxs,hys,:] shy = xl.kroon3( sh, axis=1 )[hxs,hys,:] shz = xl.kroon3( sh, axis=2 )[hxs,hys,:] px = s[hxs,hys,:] * shx - sh[hxs,hys,:] * sx py = s[hxs,hys,:] * shy - sh[hxs,hys,:] * sy pz = s[hxs,hys,:] * shz - sh[hxs,hys,:] * sz # # Calculate dips and output xa.Output['Crl_dip'] = -py/pz*crlFactor xa.Output['Inl_dip'] = -px/pz*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.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 zw = zs-2 filt = xa.params['Select']['Selection'] filtFunc = autojit(xl.vecmean) if filt==0 else autojit(xl.vmf_l1) if filt==1 else autojit(xl.vmf_l2) inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] while True: xa.doInput() p = xa.Input['Input'] # # Compute partial derivatives px = xl.kroon3( p, axis=0 )[1:xs-1,1:ys-1,:] py = xl.kroon3( p, axis=1 )[1:xs-1,1:ys-1,:] pz = xl.kroon3( p, axis=2 )[1:xs-1,1:ys-1,:] # # Normalise the gradients so Z component is positive p = np.sign(pz)/np.sqrt(px*px+py*py+pz*pz) px *= p py *= p pz *= p # # Filter out = np.empty((3,xa.TI['nrsamp'])) xl.vecFilter(np.array([px,py,pz]), zw, filtFunc, out) # # Get the output xa.Output['Crl_dip'] = -out[1,:]/out[2,:]*crlFactor xa.Output['Inl_dip'] = -out[0,:]/out[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.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 filt = xa.params['Select']['Selection'] filtFunc = autojit(xl.vecmean) if filt==0 else autojit(xl.vmf_l1) if filt==1 else autojit(xl.vmf_l2) inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] band = xa.params['Par_1']['Value'] zw = min(2*int(xa.params['Par_0']['Value'])+1,3) N = xa.params['ZSampMargin']['Value'][1] kernel = xl.hilbert_kernel(N, band) while True: xa.doInput() indata = xa.Input['Input'] # # Analytic Signal # ansig = np.apply_along_axis(np.convolve,-1, indata, kernel, 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,:] # # Normalise the gradients so Z component is positive p = np.sign(pz)/np.sqrt(px*px+py*py+pz*pz) px *= p py *= p pz *= p # # Filter out = np.empty((3,xa.TI['nrsamp'])) xl.vecFilter(np.array([px,py,pz]), zw, filtFunc, out) # # Get the output xa.Output['Crl_dip'] = -out[1,:]/out[2,:]*crlFactor xa.Output['Inl_dip'] = -out[0,:]/out[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.doOutput()
def doCompute(): hxs = xa.SI['nrinl'] // 2 hys = xa.SI['nrcrl'] // 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)[hxs, hys, :] sy = xl.kroon3(s, axis=1)[hxs, hys, :] sz = xl.kroon3(s, axis=2)[hxs, hys, :] shx = xl.kroon3(sh, axis=0)[hxs, hys, :] shy = xl.kroon3(sh, axis=1)[hxs, hys, :] shz = xl.kroon3(sh, axis=2)[hxs, hys, :] a = s[hxs, hys, :] * s[hxs, hys, :] + sh[hxs, hys, :] * sh[hxs, hys, :] px = (s[hxs, hys, :] * shx - sh[hxs, hys, :] * sx) / a py = (s[hxs, hys, :] * shy - sh[hxs, hys, :] * sy) / a pz = (s[hxs, hys, :] * shz - sh[hxs, hys, :] * sz) / a # # Form the structure tensor px2 = px * px py2 = py * py pz2 = pz * pz pxpy = px * py pxpz = px * pz pypz = py * pz T = np.rollaxis( np.array([[px2, pxpy, pxpz], [pxpy, py2, pypz], [pxpz, pypz, pz2]]), 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[:, -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.doOutput()
def doCompute(): hxs = xa.SI['nrinl'] // 2 hys = xa.SI['nrcrl'] // 2 inlFactor = xa.SI['zstep'] / xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep'] / xa.SI['crldist'] * xa.SI['dipFactor'] band = xa.params['Par_0']['Value'] N = xa.params['ZSampMargin']['Value'][1] kernel = xl.hilbert_kernel(N, band) while True: xa.doInput() indata = xa.Input['Input'] # # Analytic Signal # ansig = np.apply_along_axis(np.convolve, -1, indata, kernel, mode="same") sr = np.real(ansig) si = np.imag(ansig) # # Compute partial derivatives sx = xl.kroon3(sr, axis=0)[hxs, hys, :] sy = xl.kroon3(sr, axis=1)[hxs, hys, :] sz = xl.kroon3(sr, axis=2)[hxs, hys, :] shx = xl.kroon3(si, axis=0)[hxs, hys, :] shy = xl.kroon3(si, axis=1)[hxs, hys, :] shz = xl.kroon3(si, axis=2)[hxs, hys, :] px = sr[hxs, hys, :] * shx - si[hxs, hys, :] * sx py = sr[hxs, hys, :] * shy - si[hxs, hys, :] * sy pz = sr[hxs, hys, :] * shz - si[hxs, hys, :] * sz # # Calculate dips and output xa.Output['Crl_dip'] = -py / pz * crlFactor xa.Output['Inl_dip'] = -px / pz * 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.doOutput()
def doCompute(): hxs = xa.SI['nrinl']//2 hys = xa.SI['nrcrl']//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 )[hxs,hys,:] sy = xl.kroon3( s, axis=1 )[hxs,hys,:] sz = xl.kroon3( s, axis=2 )[hxs,hys,:] shx = xl.kroon3( sh, axis=0 )[hxs,hys,:] shy = xl.kroon3( sh, axis=1 )[hxs,hys,:] shz = xl.kroon3( sh, axis=2 )[hxs,hys,:] a = s[hxs,hys,:]*s[hxs,hys,:] + sh[hxs,hys,:]*sh[hxs,hys,:] px = (s[hxs,hys,:] * shx - sh[hxs,hys,:] * sx) /a py = (s[hxs,hys,:] * shy - sh[hxs,hys,:] * sy) /a pz = (s[hxs,hys,:] * shz - sh[hxs,hys,:] * sz) /a # # Form the structure tensor px2 = px * px py2 = py * py pz2 = pz * pz pxpy = px * py pxpz = px * pz pypz = py * pz T = np.rollaxis(np.array([ [px2, pxpy, pxpz], [pxpy, py2, pypz], [pxpz, pypz, pz2 ]]), 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[:,-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.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()