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():
#
#	Compute the filter kernel
#
	nil = xa.SI['nrinl']
	nxl = xa.SI['nrcrl']
	centre_trace_x = nil//2
	centre_trace_y = nxl//2
	freq = xa.params['Par_0']['Value']
	type = xa.params['Select']['Selection']
	kernelFunc = lpKernel if type==0 else hpKernel if type==1 else bpKernel if type==2 else brKernel
	kernel = np.zeros((nil,nil,1))
	N = nil//2
	if (N%2 == 0):
		N=N-1
		kernel[1:2*N+2,1:2*N+2,1] = kernelFunc(N, freq)
	else:
		kernel = kernelFunc(N, freq)
#
#	This is the trace processing loop
#
	while True:
		xa.doInput()
#
#	Get the input
#
		indata = xa.Input['Input']
#
#	Apply the kernel
#
		outdata = np.sum(kernel * indata, axis=(0,1))
#------------------------------------------------------------------------------------
#
		xa.Output = outdata
		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():
    inlFactor = xa.SI['zstep'] / xa.SI['inldist'] * xa.SI['dipFactor']
    crlFactor = xa.SI['zstep'] / xa.SI['crldist'] * xa.SI['dipFactor']
    zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][
        'Value'][0] + 1
    filt = xa.params['Select']['Selection']
    filtFunc = jit(xl.vecmean) if filt == 0 else jit(
        xl.vmf_l1) if filt == 1 else jit(xl.vmf_l2)
    while True:
        xa.doInput()

        dx = -xa.Input['Inl_dip'] / inlFactor
        dy = -xa.Input['Crl_dip'] / crlFactor
        dz = np.ones(dx.shape)
        s = np.sqrt(dx * dx + dy * dy + dz * dz)
        #
        #	Apply the Vector Filter
        out = np.empty((3, xa.TI['nrsamp']))
        xl.vecFilter(np.array([dx / s, dy / s, dz / s]), 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
	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
        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():
    near_ang = xa.params['Par_0']['Value']
    mid_ang = xa.params['Par_1']['Value']
    far_ang = xa.params['Par_2']['Value']
    ufar_ang = xa.params['Par_3']['Value']
    angs = np.array([near_ang, mid_ang, far_ang, ufar_ang])

    while True:
        xa.doInput()

        near = xa.Input['Near'][0, 0, :]
        mid = xa.Input['Mid'][0, 0, :]
        far = xa.Input['Far'][0, 0, :]
        ufar = xa.Input['UltraFar'][0, 0, :]
        refl = np.array([near, mid, far, ufar])
        ns = near.shape[0]

        G = np.zeros(ns)
        I = np.zeros(ns)
        Q = np.zeros(ns)
        avo_IG_numpy(refl, angs, I, G, Q)
        #
        #	Get the output
        xa.Output['Intercept'] = I
        xa.Output['Gradient'] = G
        xa.Output['Quality'] = Q
        xa.doOutput()
Ejemplo n.º 8
0
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
        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()
Ejemplo n.º 10
0
def doCompute():
#
#	Compute the filter kernel
#
	nil = xa.SI['nrinl']
	nxl = xa.SI['nrcrl']
	centre_trace_x = nil//2
	centre_trace_y = nxl//2
	freq = xa.params['Par_0']['Value']
	type = xa.params['Select']['Selection']
	kernelFunc = lpKernel if type==0 else hpKernel if type==1 else bpKernel if type==2 else brKernel
	kernel = np.zeros((nil,nil,1))
	N = nil//2
	if (N%2 == 0):
		N=N-1
		kernel[1:2*N+2,1:2*N+2,1] = kernelFunc(N, freq)
	else:
		kernel = kernelFunc(N, freq)
#
#	This is the trace processing loop
#
	while True:
		xa.doInput()
#
#	Get the input
#
		indata = xa.Input['Input']
#
#	Apply the kernel
#
		outdata = np.sum(kernel * indata, axis=(0,1))
#------------------------------------------------------------------------------------
#
		xa.Output = outdata
		xa.doOutput()
def doCompute():
	near_ang = xa.params['Par_0']['Value']
	mid_ang = xa.params['Par_1']['Value']
	far_ang = xa.params['Par_2']['Value']
	ufar_ang = xa.params['Par_3']['Value']
	angs = np.array([near_ang, mid_ang, far_ang, ufar_ang])

	while True:
		xa.doInput()

		near = xa.Input['Near'][0,0,:]
		mid = xa.Input['Mid'][0,0,:]
		far = xa.Input['Far'][0,0,:]
		ufar = xa.Input['UltraFar'][0,0,:]
		refl = np.array([near,mid,far,ufar])
		ns = near.shape[0]
    
		G=np.zeros(ns)
		I=np.zeros(ns)
		Q=np.zeros(ns)
		avo_IG_numpy( refl, angs, I, G, Q)
#
#	Get the output
		xa.Output['Intercept'] = I
		xa.Output['Gradient'] = G
		xa.Output['Quality'] = Q
		xa.doOutput()
def doCompute():
	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'][0,0,:]
		gy = xa.Input['Cross-line gradient'][0,0,:]
		gz = xa.Input['Z gradient'][0,0,:]
#
#	Inner product of  gradients
		gx2 = gx * gx
		gy2 = gy * gy
		gz2 = gz * gz
		gxgy = gx * gy
		gxgz = gx * gz
		gygz = gy * gz
#
#	Form the structure tensor
		T = np.rollaxis(np.array([	[gx2,  gxgy, gxgz],
									[gxgy, gy2,  gygz],
									[gxgz, gygz, gz2 ]]), 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()
Ejemplo n.º 13
0
def doCompute():
    endpoint_name = "endpoint-from-saved-model"

    predictor = TensorFlowPredictor(endpoint_name)

    myfile = open(
        r"C:\Users\Polash-Dell\coder_guy\PycharmProjects\aws_dl\1_aws_dl.txt",
        'w+')
    myfile.write("Norm Amp : Porosity")
    while True:
        xa.doInput()
        x_test_list = xa.Input['Input'][0, 0, :].tolist()
        x_test = pd.DataFrame(x_test_list)
        stats = x_test.describe()
        stats = stats.transpose()
        x_test = (x_test - stats['mean']) / stats['std']
        for a in x_test.values:
            myfile.write(str(a) + ": ")
            try:
                test_predictions = predictor.predict(a)
                myfile.write(str(test_predictions['predictions'][0][0]) + "\n")
            except:
                e = sys.exc_info()[0]
                myfile.write("\nError:" + str(e))
        xa.Output['Output'] = xa.Input['Input']
        xa.doOutput()
    myfile.close()
Ejemplo n.º 14
0
def doCompute():
    #
    #	Initialise some constants from the attribute parameters or the SeismicInfo, xa.SI, array for use in the calculations
    #	These are just some examples - keep/add what you need
    #
    nyquist = 1.0 / (2.0 * xa.SI['zstep'])
    par0 = xa.params['Par_0']['Value']
    zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][
        'Value'][0] + 1
    select = xa.params['Select']['Selection']
    #
    #	This is the trace processing loop
    #
    while True:
        xa.doInput()
        #
        #	After doInput the TraceInfo, xa.TI, array contains information specific to this trace segment - keep what you need
        #
        number_of_samples = xa.TI['nrsamp']
        start_time = xa.TI['z0']
        current_inline = xa.TI['inl']
        current_crossline = xa.TI['crl']
        #
        #	Get the input
        #
        indata = xa.Input['Input'][0, 0, :]
        #
        #	Your attribute calculation goes here
        #
        outdata = indata
        #------------------------------------------------------------------------------------
        #
        xa.Output = outdata
        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():
#
#	Initialise some constants from the attribute parameters or the SeismicInfo, xa.SI, array for use in the calculations
#	These are just some examples - keep/add what you need
#
	nyquist = 1.0/(2.0*xa.SI['zstep'])
	par0 = xa.params['Par_0']['Value']
	zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1
	select = xa.params['Select']['Selection']
#
#	This is the trace processing loop
#
	while True:
		xa.doInput()
#
#	After doInput the TraceInfo, xa.TI, array contains information specific to this trace segment - keep what you need
#
		number_of_samples = xa.TI['nrsamp']
		start_time =	xa.TI['z0']
		current_inline = xa.TI['inl']
		current_crossline = xa.TI['crl']
#
#	Get the input
#
		indata = xa.Input['Input'][0,0,:]
#
#	Your attribute calculation goes here
#
		outdata = indata
#------------------------------------------------------------------------------------
#
		xa.Output = outdata
		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()
Ejemplo n.º 18
0
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()
Ejemplo n.º 19
0
def doCompute():
    while True:
        xa.doInput()

        #
        #	Get the output
        xa.Output['Output'] = xa.Input['Input'] * 5
        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()
Ejemplo n.º 21
0
def doCompute():
    while True:
        xa.doInput()
        mylist=xa.Input['Input'][0, 0, :].tolist()
        myfile = open(r"C:\Users\Polash-Dell\coder_guy\PycharmProjects\snippets\123pol.txt", 'a')
        myfile.write(str(xa.TI['z0'])+"\n"+str(mylist)+"\n")
        myfile.close()
        xa.doOutput()
Ejemplo n.º 22
0
def doCompute():
	while True:
		xa.doInput()
		xa.Output['A'] = xa.Input['A']
		xa.Output['B'] = xa.Input['B']
		xa.Output['C'] = xa.Input['C']
		xa.Output['A+B-2C'] = xa.Input['A'] + xa.Input['B'] - 2.0 * xa.Input['C']
		xa.doOutput()
Ejemplo n.º 23
0
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():
	order = xa.params['Par_1']['Value']
	nyquist = 1.0/(2.0*xa.SI['zstep'])
	cutoff = xa.params['Par_0']['Value']/nyquist
	b, a = sig.butter(order, cutoff, 'low', analog=False)
	while True:
		xa.doInput()
		xa.Output = sig.filtfilt(b, a, xa.Input[0,0,:], padtype=None, padlen=0)
		xa.doOutput()
def doCompute():
	hxs = xa.SI['nrinl']//2
	hys = xa.SI['nrcrl']//2
	while True:
		xa.doInput()
		xa.Output['A'] = np.mean(xa.Input['A'],axis=(0,1))
		xa.Output['B'] = np.mean(xa.Input['B'],axis=(0,1))
		xa.Output['C'] = np.mean(xa.Input['C'],axis=(0,1))
		xa.Output['A+B-2C'] = xa.Input['A'][hxs,hys,:] + xa.Input['B'][hxs,hys,:] - 2.0 * xa.Input['C'][hxs,hys,:]
		xa.doOutput()
def doCompute():
    #
    # index of current trace position in Input numpy array
    #
    ilndx = xa.SI['nrinl'] // 2
    crldx = xa.SI['nrcrl'] // 2
    while True:
        xa.doInput()
        xa.Output = xa.Input[ilndx, crldx, :]
        xa.doOutput()
def doCompute():
#
# index of current trace position in Input numpy array
#
	ilndx = xa.SI['nrinl']//2
	crldx = xa.SI['nrcrl']//2
	while True:
		xa.doInput()
		xa.Output = xa.Input[ilndx,crldx,:]
		xa.doOutput()
Ejemplo n.º 28
0
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():
    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()
Ejemplo n.º 30
0
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():
	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()
Ejemplo n.º 32
0
def doCompute():
	inlFactor = xa.SI['zstep']/xa.SI['inldist'] * xa.SI['dipFactor']
	crlFactor = xa.SI['zstep']/xa.SI['crldist'] * xa.SI['dipFactor']
	while True:
		xa.doInput()

#
#	Get the output
		xa.Output['True Dip'] = np.sqrt(xa.Input['Crl_dip']*xa.Input['Crl_dip']+xa.Input['Inl_dip']*xa.Input['Inl_dip'])
		xa.Output['Dip Azimuth'] = np.degrees(np.arctan2(xa.Input['Inl_dip'],xa.Input['Crl_dip']))
		xa.doOutput()
def doCompute():
    hxs = xa.SI['nrinl'] // 2
    hys = xa.SI['nrcrl'] // 2
    while True:
        xa.doInput()
        xa.Output['A'] = np.mean(xa.Input['A'], axis=(0, 1))
        xa.Output['B'] = np.mean(xa.Input['B'], axis=(0, 1))
        xa.Output['C'] = np.mean(xa.Input['C'], axis=(0, 1))
        xa.Output['A+B-2C'] = xa.Input['A'][hxs, hys, :] + xa.Input['B'][
            hxs, hys, :] - 2.0 * xa.Input['C'][hxs, hys, :]
        xa.doOutput()
Ejemplo n.º 34
0
def doCompute():
    while True:
        xa.doInput()

        inp = xa.Input['Input'][0, 0, :]
        outp = np.zeros(inp.shape)

        response(inp, outp)
        #
        #	Get the output
        xa.Output = outp
        xa.doOutput()
def doCompute():
#
# index of current trace position in Input numpy array
#
	ilndx = xa.SI['nrinl']//2
	crldx = xa.SI['nrcrl']//2
	dz = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1
	kernel = lpa3D_smooth(xa.SI['nrinl'], xa.SI['nrcrl'], dz, xa.params['Par_0']['Value'])
	while True:
		xa.doInput()
		xa.Output = convolve(xa.Input, kernel)[ilndx,crldx,:]
		xa.doOutput()
def doCompute():
	while True:
		xa.doInput()

		inp = xa.Input['Input'][0,0,:]
		outp = np.zeros(inp.shape)

		response( inp, outp)
#
#	Get the output
		xa.Output = outp
		xa.doOutput()
Ejemplo n.º 37
0
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()
Ejemplo n.º 38
0
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()
Ejemplo n.º 39
0
def doCompute():
    #
    #	Initialise some constants from the attribute parameters or the SeismicInfo, xa.SI, array for use in the calculations
    #	These are just some examples - keep/add what you need
    #
    number_inline = xa.SI['nrinl']
    number_xline = xa.SI['nrcrl']
    centre_trace_x = xa.SI['nrinl'] // 2
    centre_trace_y = xa.SI['nrcrl'] // 2
    nyquist = 1.0 / (2.0 * xa.SI['zstep'])
    par0 = xa.params['Par_0']['Value']
    zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin'][
        'Value'][0] + 1
    select = xa.params['Select']['Selection']
    #
    #	This is the trace processing loop
    #
    while True:
        xa.doInput()
        #
        #	After doInput the TraceInfo, xa.TI, array contains information specific to this trace segment - keep what you need
        #
        number_of_samples = xa.TI['nrsamp']
        start_time = xa.TI['z0']
        current_inline = xa.TI['inl']
        current_crossline = xa.TI['crl']
        #
        #	Get the input
        #
        indata = xa.Input['Input']
        #
        #	Your attribute calculation goes here
        #
        #	Warning Python loops can be slow - this is contrived just to show how to access traces in the analysis data cube
        #
        outdata = np.zeros(number_of_samples)
        for inline in range(number_inline):
            for xline in range(number_xline):
                if (inline != centre_trace_x and xline != centre_trace_y):
                    outdata += indata[inline, xline, :]

        out_1 = indata[centre_trace_x, centre_trace_y, :]
        out_2 = outdata
        out_3 = outdata / (number_inline * number_xline - 1)
        #------------------------------------------------------------------------------------
        #
        #	Replace Output1-Output3 with the names in the xa.params Output array
        #
        xa.Output['Output1'] = out_1
        xa.Output['Output2'] = out_2
        xa.Output['Output3'] = out_3
        xa.doOutput()
Ejemplo n.º 40
0
def doCompute():
    endpoint_name = "endpoint-from-saved-model"
    predictor = TensorFlowPredictor(endpoint_name)
    while True:
        xa.doInput()
        x_test_list = xa.Input['Input'][0, 0, :].tolist()
        x_test = pd.DataFrame(x_test_list)
        stats = x_test.describe()
        stats = stats.transpose()
        x_test = (x_test - stats['mean']) / stats['std']
        y_test = predictor.predict(np.array(x_test))
        xa.Output['Output'] = np.array(y_test['predictions'])
        xa.doOutput()
Ejemplo n.º 41
0
def doCompute():
    order = xa.params['Par_1']['Value']
    nyquist = 1.0 / (2.0 * xa.SI['zstep'])
    cutoff = xa.params['Par_0']['Value'] / nyquist
    b, a = sig.butter(order, cutoff, 'low', analog=False)
    while True:
        xa.doInput()
        xa.Output = sig.filtfilt(b,
                                 a,
                                 xa.Input[0, 0, :],
                                 padtype=None,
                                 padlen=0)
        xa.doOutput()
Ejemplo n.º 42
0
def doCompute():
    xa.doInput()
    mylist = xa.Input['Input'][0, 0, :].tolist()
    myz0 = xa.TI['z0']
    myfile = open(
        r"C:\Users\Polash-Dell\coder_guy\PycharmProjects\snippets\321pol.csv",
        'a')
    for samp in mylist:
        myfile.write(str(myz0) + ", " + str(samp) + "\n")
        myz0 = myz0 + 1
    myfile.close()

    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():
#
#	Initialise some constants from the attribute parameters or the SeismicInfo, xa.SI, array for use in the calculations
#	These are just some examples - keep/add what you need
#
	number_inline = xa.SI['nrinl']
	number_xline = xa.SI['nrcrl']
	centre_trace_x = xa.SI['nrinl']//2
	centre_trace_y = xa.SI['nrcrl']//2
	nyquist = 1.0/(2.0*xa.SI['zstep'])
	par0 = xa.params['Par_0']['Value']
	zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1
	select = xa.params['Select']['Selection']
#
#	This is the trace processing loop
#
	while True:
		xa.doInput()
#
#	After doInput the TraceInfo, xa.TI, array contains information specific to this trace segment - keep what you need
#
		number_of_samples = xa.TI['nrsamp']
		start_time =	xa.TI['z0']
		current_inline = xa.TI['inl']
		current_crossline = xa.TI['crl']
#
#	Get the input
#
		indata = xa.Input['Input']
#
#	Your attribute calculation goes here
#
#	Warning Python loops can be slow - this is contrived just to show how to access traces in the analysis data cube
#
		outdata = np.zeros(number_of_samples)
		for inline in range(number_inline):
			for xline in range(number_xline):
				if (inline != centre_trace_x and xline != centre_trace_y):
					outdata += indata[inline,xline,:]

		out_1 = indata[centre_trace_x,centre_trace_y,:]
		out_2 = outdata
		out_3 = outdata / (number_inline * number_xline - 1)
#------------------------------------------------------------------------------------
#
#	Replace Output1-Output3 with the names in the xa.params Output array
#
		xa.Output['Output1'] = out_1
		xa.Output['Output2'] = out_2
		xa.Output['Output3'] = out_3
		xa.doOutput()
def doCompute():
	inlpos = xa.SI['nrinl']//2
	crlpos = xa.SI['nrcrl']//2

	while True:
		xa.doInput()
		indata = xa.Input['Input']
		xa.Output['In-line gradient'] 		= prewitt(indata, axis=0)[inlpos,crlpos,:]
		xa.Output['Cross-line gradient'] 	= prewitt(indata, axis=1)[inlpos,crlpos,:]
		xa.Output['Z gradient'] 			= prewitt(indata, axis=2)[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():
    #
    # index of current trace position in Input numpy array
    #
    ilndx = xa.SI["nrinl"] // 2
    crldx = xa.SI["nrcrl"] // 2
    while True:
        xa.doInput()
        xa.Output["In-line gradient"] = prewitt(xa.Input, axis=0)[ilndx, crldx, :]
        xa.Output["Cross-line gradient"] = prewitt(xa.Input, axis=1)[ilndx, crldx, :]
        xa.Output["Z gradient"] = prewitt(xa.Input, axis=2)[ilndx, crldx, :]
        xa.Output["Average gradient"] = (
            xa.Output["In-line gradient"] + xa.Output["Cross-line gradient"] + xa.Output["Z gradient"]
        ) / 3
        xa.doOutput()
Ejemplo n.º 47
0
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 = 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()
Ejemplo n.º 49
0
def doCompute():
    inlpos = xa.SI['nrinl'] // 2
    crlpos = xa.SI['nrcrl'] // 2

    while True:
        xa.doInput()
        indata = xa.Input['Input']
        xa.Output['In-line gradient'] = prewitt(indata, axis=0)[inlpos,
                                                                crlpos, :]
        xa.Output['Cross-line gradient'] = prewitt(indata, axis=1)[inlpos,
                                                                   crlpos, :]
        xa.Output['Z gradient'] = prewitt(indata, axis=2)[inlpos, crlpos, :]
        xa.Output['Average Gradient'] = (xa.Output['In-line gradient'] +
                                         xa.Output['Cross-line gradient'] +
                                         xa.Output['Z gradient']) / 3
        xa.doOutput()
Ejemplo n.º 50
0
def doCompute():
	zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1
	width = np.arange(1,zw)
	while True:
		xa.doInput()
		
		data  = xa.Input['Input'][0,0,:]
#
# Find signal peaks
		peakidx = signal.find_peaks_cwt(data, width)
		out = np.zeros(data.shape)
		out[peakidx] = data[peakidx]
		xa.Output['Find Peaks'] = out
#
# Output
		xa.doOutput()
def doCompute():
	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'][0,0,:]
		gy = xa.Input['Cross-line gradient'][0,0,:]
		gz = xa.Input['Z gradient'][0,0,:]
#
# Calculate the dips and output
		xa.Output['Crl_dip'] = -gy/gz*crlFactor
		xa.Output['Inl_dip'] = -gx/gz*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():
#
#   Start debugging before computation starts
#
	web_pdb.set_trace()
#
	while True:
		xa.doInput()
		inp = xa.Input['Input1'][0,0,:]
#
#   Add some more local variables
#
		inline = xa.TI['inl']
		crossline = xa.TI['crl']
#
		xa.Output = inp
		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():
	zw = xa.params['ZSampMargin']['Value'][1] - xa.params['ZSampMargin']['Value'][0] + 1
	nlag = int(xa.params['Par_0']['Value'])
	while True:
		xa.doInput()

		ref = xa.Input['Reference'][0,0,:]
		mat = xa.Input['Match'][0,0,:]
		ns = ref.shape[0]
		lag = np.zeros(ns)
		qual = np.zeros(ns)

		localCorr( ref, mat, zw, nlag, lag, qual)
#
#	Get the output
		xa.Output['Shift'] = lag*xa.SI['zstep']
		xa.Output['Quality'] = qual
		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()

		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,:]
#
#	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():
#
#	Compute the filter kernel
#
	nil = xa.SI['nrinl']
	nxl = xa.SI['nrcrl']
	centre_trace_x = nil//2
	centre_trace_y = nxl//2
	ifreq = xa.params['Par_0']['Value']
	xfreq = xa.params['Par_1']['Value']
	type = xa.params['Select']['Selection']
	kernelFunc = lpKernel if type==0 else hpKernel if type==1 else bpKernel if type==2 else brKernel
	ikernel = np.ones((nil,1))
	xkernel = np.ones((nxl,1))
	Ni = nil//2
	Nx = nxl//2
	if (nil != 1):
		if (Ni%2 == 0):
			ikernel[1:2*Ni+2] = kernelFunc(Ni, ifreq)
		else:
			ikernel = kernelFunc(Ni, ifreq)
	if (nxl != 1):
		if (Nx%2 == 0):
			xkernel[1:2*Nx+2] = kernelFunc(Nx,xfreq)
		else:
			xkernel = kernelFunc(Nx,xfreq)
	kernel = np.dot(ikernel, xkernel.T).reshape(nil,nxl,1)
#
#	This is the trace processing loop
#
	while True:
		xa.doInput()
#
#	Get the input
#
		indata = xa.Input['Input']
#
#	Apply the kernel
#
		outdata = np.sum(kernel * indata, axis=(0,1))
#------------------------------------------------------------------------------------
#
		xa.Output = outdata
		xa.doOutput()