Пример #1
0
    print('A: process debug data')
    print('M: QAM Modem')
    print('X: Exit')
    print('>> ')

    while True:
        if msvcrt.kbhit():
            c = msvcrt.getch().decode("utf-8")
            print(c)
            c = c.lower()

            if c == 'a':  ## Qam16 modem

                payload = (np.random.rand(100) * 256).astype(np.uint8)
                txBaseband = QAM.modulation(payload,
                                            QAM.Constant.ModulationType.QAM16)
                #plt.plot(txBaseband.real, txBaseband.imag, 'bo')
                #plt.grid()
                #plt.show()

                tx_upsampled = rf.UpSampling(txBaseband, 5 / 100, 100)
                tx_mixer = rf.Mixer(tx_upsampled, 30 / 100, np.pi / 4)
                tx_sig = tx_mixer.real + rf.WhiteNoise(tx_mixer, 50)

                #sp.fftPlot(txBaseband.real, txBaseband.imag, n=2)
                #sp.fftPlot(tx_upsampled.real, tx_upsampled.imag, n=2)
                #sp.fftPlot(tx_mixer.real, tx_mixer.imag, n=2)
                #sp.fftPlot(tx_sig.real)

                rx_mixer = rf.Mixer(tx_sig, -30 / 100, -1 * np.pi / 4)
                b = signal.remez(100 + 1, [0, .1, 0.2, 0.5], [1, 1e-4])