def try_mimo_setting(df, sig, set, mset, trainingSyms, mimodir):
    N = set['N']
    nmodes = set['nmodes']
    n_training_syms = mset['n_training_syms']
    lb = mset['lb']
    mu = mset['mu']
    nloops = mset['nloops']
    ovsmpl = set['ovsmpl']
    t_conv = N - 50000
    t_stop = N - 1000

    if mset['errorcalc'] == 'lms':
        print('LMS Enabled')
        unit = np.sqrt(2) * 0.5
        constellation = [
            unit + 1j * unit, unit - 1j * unit, -unit + 1j * unit,
            -unit - 1j * unit
        ]
        errorcalc = TrainedLMS(trainingSyms[:, :n_training_syms],
                               constellation, lb)
        sig_with_loops = errorcalc.AddTrainingLoops(sig, ovsmpl, nloops)
        sig_Martin = sig_with_loops.copy()[:, :N + n_training_syms * nloops]
        mimo = FrequencyDomainBlockwizeMimo(nmodes, lb, ovsmpl, mu, errorcalc)
        sig_Martin[:, :], taps_Martin = mimo.equalize_signal(sig_with_loops)

    else:
        errorcalc = CMAErrorCalculator()
        sig_Martin = sig_with_loops.copy()[:, :N]
        mimo = FrequencyDomainBlockwizeMimo(nmodes, lb, ovsmpl, mu, errorcalc)
        sig_Martin[:, :], taps_Martin = mimo.equalize_signal(sig)
    print(sig_Martin.shape)
    #sig_Martin ,ph = phaserec.viterbiviterbi(sig_Martin, 11)
    err_Martin = []
    for i_mode in range(nmodes):
        err_Martin_ = calculate_radius_directed_error(
            sig_Martin[i_mode, 0:t_stop], 1)
        err_Martin.append(mlab.movavg(abs(err_Martin_), movavg_taps))
    try:
        ber_martin = calculate_BER(sig_Martin, range(t_conv, t_stop))
    except:
        ber_martin = np.ones(nmodes)

    title = "Martin_mu {mu}_lb{lb}"
    plot_constellation(sig_Martin[:, t_conv:t_stop], title, True, mimodir)
    plot_error(err_Martin, title, True, mimodir)
    plot_taps(taps_Martin, True, mimodir)
    final_error_Martin = calculate_final_error(err_Martin, t_conv, t_stop)
    t_conv_martin = calculate_convergence(err_Martin, final_error_Martin)
    df_martin = UpdateDataFrame(set, mset, ber_martin, t_conv_martin,
                                final_error_Martin, "Martin")
    return df.append(df_martin)
Exemple #2
0
        mimodir = create_dir_for_signalrow(sigdir, mimo_settings, i_mrow)
        if mset['errorcalc'] == 'lms':
            print('LMS Enabled')
            unit = np.sqrt(2) * 0.5
            constellation = [
                unit + 1j * unit, unit - 1j * unit, -unit + 1j * unit,
                -unit - 1j * unit
            ]
            errorcalc = TrainedLMS(trainingSyms, constellation,
                                   mset['n_training_syms'], mset['lb'])
        else:
            errorcalc = CMAErrorCalculator()
        mimo = FrequencyDomainBlockwizeMimo(set['nmodes'], mset['lb'], ovsmpl,
                                            mset['mu'], errorcalc)

        sig_Martin[:, :], taps_Martin = mimo.equalize_signal(sig)
        sig_Martin, ph = phaserec.viterbiviterbi(sig_Martin, 11)
        err_Martin = []
        for i_mode in range(set['nmodes']):
            err_Martin_ = calculate_radius_directed_error(
                sig_Martin[i_mode, 0:t_stop], 1)
            err_Martin.append(mlab.movavg(abs(err_Martin_), movavg_taps))
        try:
            ber_martin = calculate_BER(sig_Martin, range(t_conv, t_stop))
        except:
            ber_martin = np.ones(nmodes)

        title = "Martin_mu" + str(mset['mu']) + "_lb" + str(mset['lb'])
        plot_constellation(sig_Martin[:, t_conv:t_stop], title, True, mimodir)
        plot_error(err_Martin, title, True, mimodir)
        plot_taps(taps_Martin[:, :, 0, :], True, mimodir)
Exemple #3
0
 def test_mimo_only_accepts_complex(self):
     mimo = FrequencyDomainBlockwizeMimo(2)
     sig = np.zeros(10000).reshape(2, 5000)
     self.assertRaises(ValueError, mimo.equalize_signal, sig)
     sig.dtype = np.complex128
     mimo.equalize_signal(sig)