def test_bps_1d(self): s = signals.SignalQAMGrayCoded(32, 2 ** 16, fb=20e9, nmodes=1) s2, ph = cphaserecovery.bps(s.flatten(), 32 , s.coded_symbols, 10) assert 2**16 == s2.shape[0]
from qampy.core import impairments, phaserecovery from qampy import signals fb = 40.e9 os = 1 fs = os*fb N = 10**5 M = 64 QAM = signals.QAMModulator(M) snr = 40 lw_LO = np.linspace(10e1, 1000e1, 10) #lw_LO = [100e3] sers = [] X, symbolsX, bitsX = QAM.generate_signal(N, snr, baudrate=fb, samplingrate=fs, PRBS=False , dual_pol=False) #symbolsX = np.random.randn(2**15-1) + 1.j*np.random.randn(2**15-1) for lw in lw_LO: shiftN = np.random.randint(-N/2, N/2, 1) pp = impairments.phase_noise(X.shape[0], lw, fs) XX = X*np.exp(1.j*pp) print("shiftN: %d"%shiftN) recoverd,ph= phaserecovery.bps(XX, 64, QAM.symbols, 5) ser = QAM.cal_ser(X, symbol_tx=np.roll(symbolsX, shiftN)) print("SER=%f"%ser) sers.append(ser) #plt.plot(lw_LO, sers)
def test_bps(self, ndim): s = signals.SignalQAMGrayCoded(32, 2 ** 16, fb=20e9, nmodes=ndim) s2, ph = cphaserecovery.bps(s, 32 , s.coded_symbols, 10) assert ndim == s2.shape[0]
Y = signal_quality.norm_to_s0(E[1, :], M) E = np.vstack([X,Y]) foe = phaserecovery.find_freq_offset(E, fft_size =2 ** 10) E = phaserecovery.comp_freq_offset(E, foe) #Ec = E[:,2e4:-2e4] wx, err_both = equalisation.equalise_signal(E, 1, M, Ntaps=ntaps, Niter=4, method="sbd", adaptive_stepsize=False) Ec = equalisation.apply_filter(E, 1, wx) E = Ec print("X pol phase") Ex, phx = phaserecovery.bps(E[0], 32, QAM.symbols, 8) print("X pol phase done") print("Y pol phase") Ey, phy = phaserecovery.bps(E[1], 32, QAM.symbols, 8) print("Y pol phase done") Ec = np.vstack([Ex,Ey]) evmX = QAM.cal_evm(X[::2]) evmY = QAM.cal_evm(Y[::2]) evmEx = QAM.cal_evm(E[0]) evmEy = QAM.cal_evm(E[1]) #Ec[0] = signal_quality.normalise_sig(Ec[0], M)[1] #Ec[1] = signal_quality.normalise_sig(Ec[1], M)[1] evmEx_c = QAM.cal_evm(Ec[0]) evmEy_c = QAM.cal_evm(Ec[1]) print(evmEy_c)