weakutil.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:weakmon 作者: rtmrtmrtmrtm 项目源码 文件源码
def freq_shift_ramp(x, hza, dt):
    N_orig = len(x)
    N_padded = 2**nextpow2(N_orig)
    t = numpy.arange(0, N_padded)
    f_shift = numpy.linspace(hza[0], hza[1], len(x))
    f_shift = numpy.append(f_shift, hza[1]*numpy.ones(N_padded-len(x)))

    pc1 = f_shift[:-1] - f_shift[1:]
    phase_correction = numpy.add.accumulate(
      t * dt * numpy.append(numpy.zeros(1), 2*numpy.pi*pc1))

    lo = numpy.exp(1j*(2*numpy.pi*dt*f_shift*t + phase_correction))
    x0 = numpy.append(x, numpy.zeros(N_padded-N_orig, x.dtype))
    h = scipy.signal.hilbert(x0)*lo
    ret = h[:N_orig].real
    return ret

# avoid most of the round-up-to-power-of-two penalty by
# doing log-n shifts. discontinuity at boundaries,
# but that's OK for JT65 2048-sample symbols.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号