from pyitpp import itload from pylab import * from numpy import * from math import pi from scipy.signal import butter, lfilter out = itload('in_out_signals.it') sig_len = len(out['out_sig']) in_sig = array(out['in_sig'])[:,0].tolist() sig = array(out['out_sig'])[:,0].tolist() time = range(0, sig_len) N = 1024 fft_sig = fft.fft(sig, N) freq = [] for i in range(0, N): freq.append((i*2*pi/N)/(2*pi)) #reference filter order = int(out['order']) if 0 == int(out['type']): filt_type = 'lowpass' Wn = float(out['fc'])/(float(out['fs'])/2.0) elif 1 == int(out['type']): filt_type = 'highpass' Wn = float(out['fc'])/(float(out['fs'])/2.0) elif 2 == int(out['type']): filt_type = 'bandpass' Wn = [float(out['fl'])/(float(out['fs'])/2.0), float(out['fh'])/(float(out['fs'])/2.0)] elif 3 == int(out['type']):
import sys sys.path.append('/usr/local/share/itpp') import math import pyitpp import numpy as np from scipy import special from matplotlib import pyplot as plt data = pyitpp.itload('2x1_alamouti.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-*') data = pyitpp.itload('2x2_alamouti.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-x') data = pyitpp.itload('2x3_alamouti.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-o') plt.title('Alamouti Coding - BER vs EbN0 plot') plt.xlabel('Eb/N0 (dB)') plt.ylabel('BER') plt.yscale('log') plt.legend(['2x1 MIMO', '2x2 MIMO', '2x3 MIMO']) plt.grid(True)
def setUp(self): self.out = itload('test_pyitpp.it') self.eps = 1e-6
#!/usr/bin/env python from pyitpp import itload from matplotlib.pyplot import * out = itload('pccc_bersim_awgn.it') semilogy(out['EbN0_dB'], out['BER'].T, 'o-') grid() xlabel('$E_b/N_0$') ylabel('$BER$') title('PCCC performance in AWGN channel') show()
def setUp(self): self.out = itload('../C++/IT++_trial/test_pyitpp.it') self.eps = 1e-6
import sys sys.path.append('/usr/local/share/itpp') import math import pyitpp import numpy as np from scipy import special from matplotlib import pyplot as plt data = pyitpp.itload('ofdm.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-*') data = pyitpp.itload('ofdm_tdl.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-x') #ebn0 = np.power(10, np.divide(ebn0_dB, 10.0)) #plt.plot(ebn0_dB, 0.5*(1 - np.sqrt(np.divide(ebn0, (2+ebn0)))), '-o') plt.title('OFDM - BER vs EbN0 plot') plt.xlabel('Eb/N0 (dB)') plt.ylabel('BER') plt.yscale('log') plt.legend(['AWGN channel', 'TDL channel']) plt.grid(True) plt.show()
#compare the output of the filters in fixed point with #the reference implementation (double) from pyitpp import itload from pylab import * from scipy.signal import butter, lfilter from numpy import * from math import pi Q_FACTOR = 20 out = itload('testFilt_'+str(Q_FACTOR)+'.it') norm_freq = float(out['norm_freq']) norm_freq_h = float(out['norm_freq_h']) length = int(out['length']) in_sig = array(out['pSignal'])[:,0].tolist() fx_in_sig = array(out['pFxSignal'])[:,0].tolist() N = 1024 order = 2 #generate time and frequency supports time = range(0, length) freq = [] for i in range(0, N): freq.append((i*2*pi/N)/(2*pi)) # lowpass #generate filter [B, A] = butter(order, 2*norm_freq, btype='lowpass')
import sys sys.path.append('/usr/local/share/itpp') import math import pyitpp import numpy as np from scipy import special from matplotlib import pyplot as plt fig, ax = plt.subplots() data = pyitpp.itload('mimo_ofdm_tdl.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-*') data = pyitpp.itload('../alamouti/plots/2x2_alamouti.it') ber = data.get('ber') ebn0_dB = data.get('ebno_dB') plt.plot(ebn0_dB, ber, '-^') plt.title('2x2 MIMO-OFDM - BER vs EbN0 plot') plt.xlabel('Eb/N0 (dB)') plt.ylabel('BER') plt.yscale('log') plt.legend(['Zero Forcing', 'Alamouti Coding']) plt.grid(True) plt.show()
#process coefficients from pyitpp import itload from pylab import * out = itload('coeffs.it') figure(0) for i in range(0, 8): freq_idx = 'freq_range['+str(i)+']' Alow_idx = 'pAlow['+str(i)+',:]' plot(out[Alow_idx], 'o-') Blow_idx = 'pBlow['+str(i)+',:]' plot(out[Blow_idx], 'o-') grid() title('Lowpass') figure(1) for i in range(0, 8): Ahigh_idx = 'pAhigh['+str(i)+',:]' plot(out[Ahigh_idx], 'o-') Bhigh_idx = 'pBhigh['+str(i)+',:]' plot(out[Bhigh_idx], 'o-') grid() title('Highpass') figure(2) for i in range(0, 7): Apass_idx = 'pApass['+str(i)+',:]' plot(out[Apass_idx], 'o-') Bpass_idx = 'pBpass['+str(i)+',:]'