code is working, but it's not necessarily doing what I want

This commit is contained in:
David Lenfesty 2019-08-25 20:22:39 -06:00
parent 8b3396278a
commit d4a1105f11
2 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,9 @@
import numpy as np import numpy as np
import scipy import scipy.interpolate
channel_response = np.array([0, 0, 0, 1, 0, 0, 0]) import matplotlib.pyplot as plt
channel_response = np.array([-1 - 1j, 0, 0, 1, 0, 0, -1 - 1j])
# How do I sync this across two files? # How do I sync this across two files?
# figure it out later # figure it out later
@ -30,7 +32,7 @@ def sim(in_data):
# this sort of stuff I had no idea about before I read the guide # this sort of stuff I had no idea about before I read the guide
def estimate(in_data, pilots=0): def estimate(in_data, pilots=0):
all_carriers = np.arange(len(in_data)) all_carriers = np.arange(len(in_data[0]))
if pilots > 0: if pilots > 0:
@ -41,12 +43,15 @@ def estimate(in_data, pilots=0):
H_est = 0 H_est = 0
for i in range(len(in_data)): for i in range(len(in_data)):
H_est_pilots = in_data[i][pilots] / pilot_value H_est_pilots = in_data[i][pilot_carriers] / pilot_value
H_est_abs = scipy.interpolate.interp1d(pilot_carriers, abs(H_est_pilots), kind='linear')(all_carriers)
H_est_phase = scipy.interpolate.interp1d(pilot_carriers, np.angle(H_est_pilots), kind='linear')(all_carriers) H_est_abs = scipy.interpolate.interp1d(pilot_carriers, abs(H_est_pilots), kind='linear', fill_value='extrapolate')(all_carriers)
H_est_phase = scipy.interpolate.interp1d(pilot_carriers, np.angle(H_est_pilots), kind='linear', fill_value='extrapolate')(all_carriers)
H_est += H_est_abs * np.exp(1j*H_est_phase) H_est += H_est_abs * np.exp(1j*H_est_phase)
print(H_est_abs)
H_est = H_est / len(in_data) H_est = H_est / len(in_data)
return H_est return H_est

2
qam.py
View File

@ -35,8 +35,6 @@ def modulate(in_data, pilots=0):
else: else:
data_carriers = all_carriers data_carriers = all_carriers
print(pilot_carriers)
#initialise output array with additional pilot carriers as well #initialise output array with additional pilot carriers as well
out_data = np.ndarray((len(in_data), num_data_carriers + pilots), dtype=np.csingle) out_data = np.ndarray((len(in_data), num_data_carriers + pilots), dtype=np.csingle)