def narrowBandGen(data, alpha, targets, Fs): """ Usage: data = narrowBandGen(data,alpha,targets,Fs) Where: data is an array of size number of sensors by samples Matrix data contains simulated noise field for array alpha is the array constant targets is a list of tuples containing simulated narrow band target information Fs is the sample rate (Hz) """ from math import pi as M_PI f = {'mview_d': 'vview_d', 'mview_f': 'vview_f'} tp = data.type N = data.rowlength M = data.collength t = pv.create(f[tp], N).ramp(0, 1) tt = pv.create(f[tp], N) Xim = pv.create(tp, M, M + 1, 'ROW') m = pv.create(f[tp], M).ramp(0, 1) Xi = pv.create(f[tp], M + 1).ramp(0, M_PI / M).cos pv.outer(alpha, m, Xi, Xim) for i in range(M): data_v = data.rowview(i) for j in range(len(targets)): tgt = targets[j] w0 = float(2.0 * M_PI * tgt[0] / Fs) Theta = int(tgt[1]) sc = tgt[2] Xim_val = Xim[i, Theta] pv.ma(t, w0, -w0 * Xim_val, tt) tt.cos tt *= sc data_v += tt return data
def narrowBandGen(data,alpha,targets,Fs): """ Usage: data = narrowBandGen(data,alpha,targets,Fs) Where: data is an array of size number of sensors by samples Matrix data contains simulated noise field for array alpha is the array constant targets is a list of tuples containing simulated narrow band target information Fs is the sample rate (Hz) """ from math import pi as M_PI f={'mview_d':'vview_d','mview_f':'vview_f'} tp=data.type N=data.rowlength M=data.collength t =pv.create(f[tp],N).ramp(0,1) tt = pv.create(f[tp],N) Xim = pv.create(tp,M,M+1,'ROW') m = pv.create(f[tp],M).ramp(0,1) Xi = pv.create(f[tp],M + 1).ramp(0,M_PI/M).cos pv.outer(alpha,m,Xi,Xim) for i in range(M): data_v = data.rowview(i) for j in range(len(targets)): tgt=targets[j]; w0=float(2.0 * M_PI * tgt[0]/Fs); Theta=int(tgt[1]) sc=tgt[2] Xim_val = Xim[i,Theta] pv.ma(t,w0,-w0 * Xim_val,tt) tt.cos tt *= sc data_v += tt return data
def coscoef(rs,n,V,Y): f={'vview_d':'mview_d','vview_f':'mview_f'} m=rs.length + 1 y=pv.create(Y.type,m) y[:Y.length]=Y;y[m-1]=0.0 A=pv.create(f[y.type],m,y.length) a=A[:rs.length,:n+1] a=pv.outer(1,rs,pv.create(rs.type,n+1).ramp(0,1),a).cos at=A.rowview(m-1) A.rowview(m-1)[:]=V[:] return A.luSolve(y)
def coscoef(rs, n, V, Y): f = {'vview_d': 'mview_d', 'vview_f': 'mview_f'} m = rs.length + 1 y = pv.create(Y.type, m) y[:Y.length] = Y y[m - 1] = 0.0 A = pv.create(f[y.type], m, y.length) a = A[:rs.length, :n + 1] a = pv.outer(1, rs, pv.create(rs.type, n + 1).ramp(0, 1), a).cos at = A.rowview(m - 1) A.rowview(m - 1)[:] = V[:] return A.luSolve(y)