Пример #1
0
def VU_vfrdB(a, rng):
    N_len = int(a.length)
    ca = a.otherEmpty.fill(0.0)
    fftType = {'cvview_d': 'ccfftip_d', 'cvview_f': 'ccfftip_f'}[ca.type]
    fft = pv.FFT(fftType, N_len, 1, pv.VSIP_FFT_FWD, 0, 0)
    ra = ca.realview
    ia = ca.imagview
    ta = a.cloneview
    s = ta.stride
    pv.copy(a, ra)
    fft.dft(ca)
    pv.cmagsq(ca, ra)
    maxv = ra.maxval
    minv = maxv * rng
    pv.clip(ra, minv, maxv, minv, maxv, ra)
    Nlen = int(N_len / 2)
    if N_len % 2:
        ta.putlength(Nlen + 1)
        ra.putlength(Nlen + 1)
        ta.putoffset(Nlen * s)
        pv.copy(ra, ta)
        ra.putlength(Nlen)
        ta.putlength(Nlen)
        ta.putoffset(a.offset)
        ra.putoffset(Nlen + 1)
        pv.copy(ra, ta)
    else:
        pv.copy(ra, ta)
        ta.putlength(Nlen)
        a.putlength(Nlen)
        ta.putoffset(Nlen * s)
        pv.swap(ta, a)
        a.putlength(N_len)
    a.log10
    a *= 10.0
Пример #2
0
def VU_vfrdB(a,rng):
    N_len=int(a.length)
    ca=a.otherEmpty.fill(0.0)
    fftType={'cvview_d':'ccfftip_d','cvview_f':'ccfftip_f'}[ca.type]
    fft =  pv.FFT(fftType,N_len,1,pv.VSIP_FFT_FWD,0,0)
    ra = ca.realview
    ia = ca.imagview
    ta = a.cloneview
    s  = ta.stride
    pv.copy(a,ra)
    fft.dft(ca)
    pv.cmagsq(ca,ra)
    maxv = ra.maxval
    minv = maxv * rng
    pv.clip(ra,minv,maxv,minv,maxv,ra)
    Nlen = int(N_len/2)
    if N_len%2:
         ta.putlength(Nlen+1)
         ra.putlength(Nlen+1)
         ta.putoffset(Nlen * s)
         pv.copy(ra,ta)
         ra.putlength(Nlen)
         ta.putlength(Nlen)
         ta.putoffset(a.offset)
         ra.putoffset(Nlen+1)
         pv.copy(ra,ta)
    else :
         pv.copy(ra,ta)
         ta.putlength(Nlen)
         a.putlength(Nlen)
         ta.putoffset(Nlen * s)
         pv.swap(ta,a)
         a.putlength(N_len)
    a.log10
    a *= 10.0
Пример #3
0
def center(gram):
    assert gram.rowstride == 1
    assert gram.colstride == gram.rowlength
    if gram.collength & 1: #odd
        for i in range(gram.rowlength):
            pv.freqswap(gram.colview(i))
    else: #even number of columns; use trick
        lngth = int(gram.collength*gram.rowlength/2)
        gramvec=gram.block.vector
        pv.swap(gramvec[lngth:],gramvec[:lngth])     
    return gram
Пример #4
0
def center(gram):
    assert gram.rowstride == 1
    assert gram.colstride == gram.rowlength
    if gram.collength & 1:  #odd
        for i in range(gram.rowlength):
            pv.freqswap(gram.colview(i))
    else:  #even number of columns; use trick
        lngth = int(gram.collength * gram.rowlength / 2)
        gramvec = gram.block.vector
        pv.swap(gramvec[lngth:], gramvec[:lngth])
    return gram