PlotSimple.py 文件源码

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

项目:piradar 作者: scivision 项目源码 文件源码
def dodemod(rx, P:dict):
    aud = None
    fs =  P['rxfs']

    if P['demod']=='chirp':
        tx = loadbin(P['txfn'], P['txfs'])
        if tx is None:
            warnings.warn('simulated chirp reception')
            tx = rx
            rx = 0.05*rx + 0.1*rx.max()*(np.random.randn(rx.size) + 1j*np.random.randn(rx.size))
            txfs = fs
        else:
            rx = scipy.signal.resample_poly(rx, UP, DOWN)
            fs = txfs = P['txfs']

        txsec = tx.size/txfs # length of TX in seconds
        if P['pri'] is None:
            pri=txsec
        print(f'Using {pri*1000} ms PRI and {P["Npulse"]} pulses incoherently integrated')

# %% integration
        NrxPRI = int(fs * pri) # Number of RX samples per PRI
        NrxStack = rx.size // NrxPRI # number of complete PRIs received in this data
        Nint = NrxStack // P['Npulse'] # Number of steps we'll take iterating
        Nextract = P['Npulse'] * NrxPRI  # total number of samples to extract (in general part of one PRI is discarded after numerous PRIs)

        ax=None
        for i in range(Nint):
            ci = slice(i*Nextract, (i+1)*Nextract)
            rxint = rx[ci].reshape((NrxPRI, P['Npulse'])).mean(axis=1)
            Rxy = np.correlate(tx, rxint, 'full')
            ax = plotxcor(Rxy, txfs, ax)
            draw(); pause(0.5)
    elif P['demod']=='am':
        aud = am_demod(P['again']*rx, fs, fsaudio, P['fc'], p.audiobw, frumble=p.frumble, verbose=True)
    elif P['demod']=='ssb':
        aud = ssb_demod(P['again']*rx, fs, fsaudio, P['fc'], p.audiobw,verbose=True)

    return aud,fs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号