def test_pmd_phase(self, method1, method2, lw):
     theta = np.pi / 4.5
     dgd = 100e-12
     fb = 40.e9
     os = 2
     fs = os * fb
     N = 2**16
     snr = 15
     beta = 0.9
     mu1 = 2e-3
     if method2 == "mddma":
         mu2 = 1.0e-3
     else:
         mu2 = 2e-3
     M = 32
     ntaps = 21
     s = signals.SignalQAMGrayCoded(M, N, nmodes=2, fb=fb)
     s = s.resample(fs, beta=beta, renormalise=True)
     s = impairments.apply_phase_noise(s, lw)
     s = impairments.apply_PMD(s, theta, dgd)
     sout, wxy, err = equalisation.dual_mode_equalisation(
         s, (mu1, mu2),
         Ntaps=ntaps,
         methods=(method1, method2),
         adaptive_stepsize=(True, True))
     sout, ph = phaserec.bps(sout, M, 21)
     sout = helpers.normalise_and_center(sout)
     sout = helpers.dump_edges(sout, 50)
     ser = sout.cal_ser()
     if ser.mean() > 0.4:
         ser = sout[::-1].cal_ser()
     npt.assert_allclose(ser, 0,
                         atol=1.01 * 3 / N)  # Three wrong symbols is ok
Esempio n. 2
0
 def test_bps(self, dtype, angle, method):
     s = signals.SignalQAMGrayCoded(32, 2**12, dtype=dtype)
     s3 = s*np.exp(1.j*angle)
     s2, ph = phaserec.bps(s3, 32 , 11, method=method)
     o = ph[0][20:-20]+angle
     ser = s2[:,20:-20].cal_ser()
     npt.assert_allclose(0, ser)
     npt.assert_allclose(0, o, atol=np.pi/4/32)
def test_phaserec_bps(lw, M):
    fb = 40.e9
    os = 1
    fs = os * fb
    N = 2**17
    snr = 30
    shiftN = np.random.randint(-N / 2, N / 2, 1)
    s = signals.SignalQAMGrayCoded(M, N, fb=fb)
    s = s.resample(fs, beta=0.1, renormalise=True)
    s = impairments.change_snr(s, snr)
    s = np.roll(s, shiftN, axis=1)
    pp = impairments.apply_phase_noise(s, lw)
    recoverd, ph1 = phaserec.bps(pp, M, 14, method='pyt')
    recoverd = helpers.dump_edges(recoverd, 20)
    ser = recoverd.cal_ser()
    npt.assert_allclose(ser, 0)
Esempio n. 4
0


fb = 40.e9
os = 1
fs = os*fb
N = 3*10**5
M = 64
snr = 30
lw_LO = np.linspace(10e1, 1000e1, 4)
#lw_LO = [100e3]
sers = []

for lw in lw_LO:
    shiftN = np.random.randint(-N/2, N/2, 1)
    s = signals.SignalQAMGrayCoded(M, N, fb=fb)
    s = s.resample(fs, beta=0.1, renormaise=True)
    s = impairments.change_snr(s, snr)
    s = np.roll(s, shiftN, axis=1)
    pp = impairments.apply_phase_noise(s, lw)
    recoverd, ph1 = phaserec.bps_twostage(pp, 28, s.coded_symbols, 14, method='pyx')
    recoverd_2, ph2 = phaserec.bps(pp, 64, s.coded_symbols, 14, method='pyx')
    recoverd = helpers.dump_edges(recoverd, 20)
    recoverd_2 = helpers.dump_edges(recoverd_2, 20)
    ser = recoverd.cal_ser()
    ser2 = recoverd_2.cal_ser()
    print("1 stage pyx ser=%g"%ser)
    print("2 stage pyx ser=%g"%ser2)


Esempio n. 5
0
 def test_bps(self, ndim):
     s = signals.SignalQAMGrayCoded(32, 2 ** 16, fb=20e9, nmodes=ndim)
     s2, ph = phaserec.bps(s, 32, 10)
     assert type(s2) is type(s)
Esempio n. 6
0
 def test_bps(self, dtype):
     s = signals.SignalQAMGrayCoded(32, 2**12, dtype=dtype)
     s *= np.exp(1.j*np.pi/3)
     s2, ph = phaserec.bps(s, 32, 10, method="pyx")
     assert s2.dtype is np.dtype(dtype)
     assert ph.dtype.itemsize is np.dtype(dtype).itemsize//2
Esempio n. 7
0
import numpy as np
from qampy import impairments, phaserec
from qampy import signals, helpers

fb = 40.e9
os = 1
fs = os * fb
N = 3 * 10**5
M = 64
snr = 30
lw_LO = np.linspace(10e1, 1000e1, 4)
#lw_LO = [100e3]
sers = []

for lw in lw_LO:
    shiftN = np.random.randint(-N / 2, N / 2, 1)
    s = signals.SignalQAMGrayCoded(M, N, fb=fb)
    s = s.resample(fs, beta=0.1, renormaise=True)
    s = impairments.change_snr(s, snr)
    s = np.roll(s, shiftN, axis=1)
    pp = impairments.apply_phase_noise(s, lw)
    recoverd, ph1 = phaserec.bps_twostage(pp, 28, 14, method='pyx')
    recoverd_2, ph2 = phaserec.bps(pp, 64, 14, method='pyx')
    recoverd = helpers.dump_edges(recoverd, 20)
    recoverd_2 = helpers.dump_edges(recoverd_2, 20)
    ser = recoverd.cal_ser()
    ser2 = recoverd_2.cal_ser()
    print("1 stage pyx ser=%g" % ser)
    print("2 stage pyx ser=%g" % ser2)