Esempio n. 1
0
 def test_load_single_key(self, nmodes):
     sig = signals.SignalQAMGrayCoded(16, 2**16, nmodes, fb=20e9)
     tmpdir = tempfile.mkdtemp()
     fn = os.path.join(tmpdir, "tmp")
     savemat(fn, {"sig": sig.symbols})
     sigout = io.load_symbols_from_matlab_file(fn,
                                               sig.M, (("sig", ), ),
                                               fb=sig.fb,
                                               normalise=False)
     assert sig.fb == sigout.fb
     assert sig.M == sigout.M
     npt.assert_almost_equal(sig, sigout)
Esempio n. 2
0
 def test_load_key_per_dim(self, nmodes):
     sig = signals.SignalQAMGrayCoded(16, 2**16, nmodes, fb=20e9)
     tmpdir = tempfile.mkdtemp()
     fn = os.path.join(tmpdir, "tmp")
     dat = {}
     keys = []
     for i in range(nmodes):
         dat["sig_{}".format(i)] = sig.symbols[i]
         keys.append(("sig_{}".format(i), ))
     savemat(fn, dat)
     sigout = io.load_symbols_from_matlab_file(fn,
                                               sig.M,
                                               keys,
                                               fb=sig.fb,
                                               normalise=False)
     assert sig.fb == sigout.fb
     assert sig.M == sigout.M
     assert sig.shape == sigout.shape
     npt.assert_almost_equal(sig, sigout)
Esempio n. 3
0
 def test_load_single_key_dim2cmplx(self, nmodes):
     sig = signals.SignalQAMGrayCoded(16, 2**16, nmodes, fb=20e9)
     tmpdir = tempfile.mkdtemp()
     dat = []
     for i in range(nmodes):
         dat.append(sig.symbols[i].real)
         dat.append(sig.symbols[i].imag)
     portmap = np.arange(2 * nmodes)
     portmap = portmap.reshape(-1, 2)
     fn = os.path.join(tmpdir, "tmp")
     savemat(fn, {"sig": dat})
     sigout = io.load_symbols_from_matlab_file(fn,
                                               sig.M, (("sig", ), ),
                                               fb=sig.fb,
                                               normalise=False,
                                               dim2cmplx=True,
                                               portmap=portmap)
     assert sig.fb == sigout.fb
     assert sig.M == sigout.M
     npt.assert_almost_equal(sig, sigout)
Esempio n. 4
0
import matplotlib.pylab as plt

from qampy import equalisation, analog_frontend, signals, phaserec, io, helpers

os = 2
M = 64
snr = 35
muCMA = 6e-4
muRDE = 6e-4
Ncma = 100000
Nrde = 300000
ntaps = 51
niter = 1
symbs = io.load_symbols_from_matlab_file(
    "data/20GBaud_SRRC0P05_64QAM_PRBS15.mat",
    64, (("X_Symbs", ), ),
    fb=20e9,
    normalise=True,
    fake_polmux=True)
sig = io.create_signal_from_matlab(
    symbs, "data/OSNRLoading_IdealRxLaser_1544p91_Att_1_OSNR_38_1.mat", 50e9,
    (("CH1", "CH2"), ("CH3", "CH4")))
sig = sig[:, :10**6]
sig = helpers.normalise_and_center(sig)
sig = sig.resample(2 * symbs.fb, beta=0.05, renormalise=True)
#sig = analog_frontend.comp_IQ_inbalance(sig)

E, wxy, err_both = equalisation.dual_mode_equalisation(
    sig, (muCMA, muRDE),
    ntaps,
    Niter=(niter, niter),
    methods=("mcma", "sbd"),