def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 wf = xa.params['Par_0']['Value'] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1/(8*((min(xs,ys,zs)-1)*wf)**2) while True: xa.doInput() r = np.zeros((10,xa.TI['nrsamp'])) for i in range(0,10): r[i,:] = xl.sconvolve(xa.Input,kernel[i]) A = np.rollaxis(np.array([[r[4],r[7]/2, r[8]/2], [r[7]/2, r[5], r[9]/2], [r[8]/2, r[9]/2, r[6]]]),2) AAT = np.einsum('...ij,...jk->...ik', A, np.swapaxes(A,1,2)) B = np.rollaxis(np.array([[r[1]],[r[2]],[r[3]]]),2) BBT = np.einsum('...ij,...jk->...ik', B, np.swapaxes(B,1,2)) T = AAT+gam*BBT p = np.rollaxis(T,0,3) xa.Output['t1x'] = p[0,0,:]*np.sign(p[0,2,:]) xa.Output['t1y'] = p[0,1,:]*np.sign(p[0,2,:]) xa.Output['t1z'] = p[0,2,:]*np.sign(p[0,2,:]) xa.Output['t2x'] = p[1,0,:]*np.sign(p[1,2,:]) xa.Output['t2y'] = p[1,1,:]*np.sign(p[1,2,:]) xa.Output['t2z'] = p[1,2,:]*np.sign(p[1,2,:]) xa.Output['t3x'] = p[2,0,:]*np.sign(p[2,2,:]) xa.Output['t3y'] = p[2,1,:]*np.sign(p[2,2,:]) xa.Output['t3z'] = p[2,2,:]*np.sign(p[2,2,:]) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 wf = xa.params['Par_0']['Value'] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1 / (8 * ((min(xs, ys, zs) - 1) * wf)**2) while True: xa.doInput() r = np.zeros((10, xa.TI['nrsamp'])) for i in range(0, 10): r[i, :] = xl.sconvolve(xa.Input, kernel[i]) A = np.rollaxis( np.array([[r[4], r[7] / 2, r[8] / 2], [r[7] / 2, r[5], r[9] / 2], [r[8] / 2, r[9] / 2, r[6]]]), 2) AAT = np.einsum('...ij,...jk->...ik', A, np.swapaxes(A, 1, 2)) B = np.rollaxis(np.array([[r[1]], [r[2]], [r[3]]]), 2) BBT = np.einsum('...ij,...jk->...ik', B, np.swapaxes(B, 1, 2)) T = AAT + gam * BBT p = np.rollaxis(T, 0, 3) xa.Output['t1x'] = p[0, 0, :] * np.sign(p[0, 2, :]) xa.Output['t1y'] = p[0, 1, :] * np.sign(p[0, 2, :]) xa.Output['t1z'] = p[0, 2, :] * np.sign(p[0, 2, :]) xa.Output['t2x'] = p[1, 0, :] * np.sign(p[1, 2, :]) xa.Output['t2y'] = p[1, 1, :] * np.sign(p[1, 2, :]) xa.Output['t2z'] = p[1, 2, :] * np.sign(p[1, 2, :]) xa.Output['t3x'] = p[2, 0, :] * np.sign(p[2, 2, :]) xa.Output['t3y'] = p[2, 1, :] * np.sign(p[2, 2, :]) xa.Output['t3z'] = p[2, 2, :] * np.sign(p[2, 2, :]) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 wf = xa.params['Par_0']['Value'] maxDip = xa.params['Par_1']['Value'] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1/(8*((min(xs,ys,zs)-1)*wf)**2) inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor'] crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor'] smb,sma = butter(4, 0.3, btype='lowpass', analog=False) while True: xa.doInput() r = np.zeros((10,xa.TI['nrsamp'])) for i in range(0,10): r[i,:] = xl.sconvolve(xa.Input,kernel[i]) A = np.rollaxis(np.array([[r[4],r[7]/2, r[8]/2], [r[7]/2, r[5], r[9]/2], [r[8]/2, r[9]/2, r[6]]]),2) AAT = np.einsum('...ij,...jk->...ik', A, np.swapaxes(A,1,2)) B = np.rollaxis(np.array([[r[1]],[r[2]],[r[3]]]),2) BBT = np.einsum('...ij,...jk->...ik', B, np.swapaxes(B,1,2)) T = AAT+gam*BBT evals, evecs = np.linalg.eigh(T) ndx = evals.argsort()[:,-1] evecs = evecs[np.arange(0,T.shape[0],1),:,ndx] dip = -evecs[:,1]/evecs[:,2]*crlFactor dip[dip>maxDip] = 0.0 dip[dip<-maxDip] = 0.0 xa.Output['Crl_dip'] = filtfilt(smb, sma, dip) dip = -evecs[:,0]/evecs[:,2]*inlFactor dip[dip>maxDip] = 0.0 dip[dip<-maxDip] = 0.0 xa.Output['Inl_dip'] = filtfilt(smb, sma, 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 wf = xa.params['Par_0']['Value'] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1/(8*((min(xs,ys,zs)-1)*wf)**2) while True: xa.doInput() r = np.zeros((10,xa.TI['nrsamp'])) for i in range(0,10): r[i,:] = xl.sconvolve(xa.Input,kernel[i]) A = np.rollaxis(np.array([[r[4],r[7]/2, r[8]/2], [r[7]/2, r[5], r[9]/2], [r[8]/2, r[9]/2, r[6]]]),2) AAT = np.einsum('...ij,...jk->...ik', A, np.swapaxes(A,1,2)) B = np.rollaxis(np.array([[r[1]],[r[2]],[r[3]]]),2) BBT = np.einsum('...ij,...jk->...ik', B, np.swapaxes(B,1,2)) T = AAT+gam*BBT w = np.linalg.eigvalsh(T) v=np.rollaxis(np.sort(w),1) e1 = v[2,:] e2 = v[1,:] e3 = v[0,:] 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 wf = xa.params["Par_0"]["Value"] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1 / (8 * ((min(xs, ys, zs) - 1) * wf) ** 2) while True: xa.doInput() r = np.zeros((10, xa.TI["nrsamp"])) for i in range(0, 10): r[i, :] = xl.sconvolve(xa.Input, kernel[i]) A = np.rollaxis( np.array([[r[4], r[7] / 2, r[8] / 2], [r[7] / 2, r[5], r[9] / 2], [r[8] / 2, r[9] / 2, r[6]]]), 2 ) AAT = np.einsum("...ij,...jk->...ik", A, np.swapaxes(A, 1, 2)) B = np.rollaxis(np.array([[r[1]], [r[2]], [r[3]]]), 2) BBT = np.einsum("...ij,...jk->...ik", B, np.swapaxes(B, 1, 2)) T = AAT + gam * BBT 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(): dz = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = lpa3D_init(xa.SI['nrinl'], xa.SI['nrcrl'], dz, xa.params['Par_0']['Value'])[0] while True: xa.doInput() xa.Output = xl.sconvolve(xa.Input, kernel) xa.doOutput()
def doCompute(): xs = xa.SI['nrinl'] ys = xa.SI['nrcrl'] zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 wf = xa.params['Par_0']['Value'] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1 / (8 * ((min(xs, ys, zs) - 1) * wf)**2) while True: xa.doInput() r = np.zeros((10, xa.TI['nrsamp'])) for i in range(0, 10): r[i, :] = xl.sconvolve(xa.Input, kernel[i]) A = np.rollaxis( np.array([[r[4], r[7] / 2, r[8] / 2], [r[7] / 2, r[5], r[9] / 2], [r[8] / 2, r[9] / 2, r[6]]]), 2) AAT = np.einsum('...ij,...jk->...ik', A, np.swapaxes(A, 1, 2)) B = np.rollaxis(np.array([[r[1]], [r[2]], [r[3]]]), 2) BBT = np.einsum('...ij,...jk->...ik', B, np.swapaxes(B, 1, 2)) T = AAT + gam * BBT 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(): zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1 kernel = lpa3D_init(xa.SI['nrinl'], xa.SI['nrcrl'], zs, xa.params['Par_0']['Value']) while True: xa.doInput() for i in range(0,10): xa.Output['r'+str(i)] = xl.sconvolve(xa.Input,kernel[i]) xa.doOutput()
def doCompute(): dz = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 kernel = lpa3D_init(xa.SI['nrinl'], xa.SI['nrcrl'], dz, xa.params['Par_0']['Value'])[0] while True: xa.doInput() xa.Output = xl.sconvolve(xa.Input['Input'], kernel) xa.doOutput()
def doCompute(): zs = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][ 'Value'][0] + 1 kernel = lpa3D_init(xa.SI['nrinl'], xa.SI['nrcrl'], zs, xa.params['Par_0']['Value']) while True: xa.doInput() for i in range(0, 10): xa.Output['r' + str(i)] = xl.sconvolve(xa.Input, kernel[i]) 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) 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 wf = xa.params["Par_0"]["Value"] kernel = lpa3D_init(xs, ys, zs, wf) gam = 1 / (8 * ((min(xs, ys, zs) - 1) * wf) ** 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() r = np.zeros((10, xa.TI["nrsamp"])) for i in range(0, 10): r[i, :] = xl.sconvolve(xa.Input, kernel[i]) A = np.rollaxis( np.array([[r[4], r[7] / 2, r[8] / 2], [r[7] / 2, r[5], r[9] / 2], [r[8] / 2, r[9] / 2, r[6]]]), 2 ) AAT = np.einsum("...ij,...jk->...ik", A, np.swapaxes(A, 1, 2)) B = np.rollaxis(np.array([[r[1]], [r[2]], [r[3]]]), 2) BBT = np.einsum("...ij,...jk->...ik", B, np.swapaxes(B, 1, 2)) T = AAT + gam * BBT 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[:, 0]] 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 = 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()
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()