Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
Archivo: ex20.py Proyecto: rrjudd/jvsip
avg = pv.create('vview_f', 4 * N_data)
data.putlength(int((N_data - 1) / dec1) + 1)
avg.putlength(int((N_data - 1) / dec1) + 1)
data.putstride(2)
avg.putstride(4)
noise.putlength(N_data)
noise.putstride(3)
conv = pv.CONV('conv1d_f', kernel, pv.VSIP_NONSYM, N_data, dec1,
               pv.VSIP_SUPPORT_SAME, 0, 0)
fir = pv.FIR('fir_f', kernel, 'NONE', N_data, dec1, 'NO')
avg.fill(0.0)
for i in range(10):
    r_state.randn(noise)
    conv.convolve(noise, data)
    VU_vfrdB(data, 1e-13)
    pv.ma(data, 0.1, avg, avg)
N_len = avg.length
x = pv.create('vview_f', N_len).ramp(-.5, 1.0 / float(N_len - 1))
VU_vwritexyg("%8.6f %8.6f\n", x, avg, "conv_dec1")
avg.fill(0.0)
for i in range(10):
    r_state.randn(noise)
    fir.flt(noise, data)
    VU_vfrdB(data, 1e-13)
    pv.ma(data, 0.1, avg, avg)
N_len = avg.length
x = pv.create('vview_f', N_len).ramp(-.5, 1.0 / float(N_len - 1))
VU_vwritexyg("%8.6f %8.6f\n", x, avg, "fir_dec1")
conv = pv.CONV('conv1d_f', kernel, pv.VSIP_NONSYM, N_data, dec3,
               pv.VSIP_SUPPORT_SAME, 0, 0)
fir = pv.FIR('fir_f', kernel, 'NONE', N_data, dec3, 'NO')
Ejemplo n.º 4
0
Archivo: ex20.py Proyecto: rrjudd/jvsip
noise = pv.create('vview_f', 3 * N_data)
avg   = pv.create('vview_f', 4 * N_data)
data.putlength(int((N_data-1)/dec1)+1)
avg.putlength(int((N_data-1)/dec1)+1)
data.putstride(2)
avg.putstride(4)
noise.putlength(N_data)
noise.putstride(3)
conv = pv.CONV('conv1d_f',kernel,pv.VSIP_NONSYM, N_data,dec1,pv.VSIP_SUPPORT_SAME,0,0)
fir  = pv.FIR('fir_f', kernel,'NONE', N_data,dec1,'NO')
avg.fill(0.0)
for i in range(10):
    r_state.randn(noise)
    conv.convolve(noise,data)
    VU_vfrdB(data,1e-13)
    pv.ma(data,0.1,avg,avg)
N_len = avg.length
x = pv.create('vview_f', N_len).ramp(-.5,1.0/float(N_len-1))
VU_vwritexyg("%8.6f %8.6f\n",x,avg,"conv_dec1");
avg.fill(0.0)
for i in range(10):
    r_state.randn(noise)
    fir.flt(noise,data)
    VU_vfrdB(data,1e-13)
    pv.ma(data,0.1,avg,avg)
N_len = avg.length
x = pv.create('vview_f', N_len).ramp(-.5,1.0/float(N_len-1))
VU_vwritexyg("%8.6f %8.6f\n",x,avg,"fir_dec1")
conv = pv.CONV('conv1d_f', kernel,pv.VSIP_NONSYM, N_data,dec3,pv.VSIP_SUPPORT_SAME,0,0);
fir  = pv.FIR('fir_f', kernel,'NONE', N_data,dec3,'NO')
data.putlength(int((N_data-1)/dec3) + 1)