def load_channels(dirs): """ Load all the 868 channels If it is a continious measurement we split the channel snapshots per 100 snapshots All locations are stored in an array and returned per antenna conf ULA/URA """ H_ula = [] H_ura = [] for d in dirs: # only process 868 measurements is_868_b = is_868(d) is_ula_b = is_ula(d) if not is_868_b: print(f"Skipped {d}") continue print(f"processing {d}") H = np.load(os.path.join(root_dir, d, "small-channel.npy")) # remove faulty antenna 32 H = H[:, :, :-1] H = normalize(H) if is_cont_meas(d): # too much samples, split in 1 sec snapshots, i.e. 100 snapshots H_splitted = np.array_split(H, H.shape[0] // 100) for H_split in H_splitted: if is_ula_b: H_ula.append(H_split) else: H_ura.append(H_split) else: if is_ula_b: H_ula.append(H) else: H_ura.append(H) return H_ula, H_ura
from tqdm import tqdm from utils.load_yaml import load_root_dir from utils.util_loc import is_cont_meas, is_ula, is_868, get_path, get_point import matplotlib.pyplot as plt if __name__ == '__main__': root_dir = load_root_dir() subdir, dirs, files = next(os.walk(os.path.join(root_dir))) ax = plt.gca() res = [] for d in dirs: # only process 868 measurements is_868_b = is_868(d) is_ula_b = is_ula(d) if not is_868_b: # print(f"Skipped {d}") continue # print(f"processing {d}") H = np.load(os.path.join(root_dir, d, "small-channel.npy")) # remove faulty antenna 32 # [snapshots x freq points x BS antennas] H = H[:, 0, :31] if (not is_cont_meas(d)) and (is_ula(d)): H = np.nanmean(H, axis=0) # H = np.mean(H, axis=0) H_norm = H / np.linalg.norm(H) res.append(H_norm)
import random import numpy as np from tqdm import tqdm from utils.load_yaml import load_root_dir from utils.util_loc import is_cont_meas, is_ula, is_868, get_path import matplotlib.pyplot as plt if __name__ == '__main__': root_dir = load_root_dir() subdir, dirs, files = next(os.walk(os.path.join(root_dir))) for d in dirs: # only process 868 measurements is_868_b = is_868(d) is_ula_b = is_ula(d) if not is_868_b: print(f"Skipped {d}") continue print(f"processing {d}") H = np.load(os.path.join(root_dir, d, "small-channel.npy")) # remove faulty antenna 32 # [snapshots x freq points x BS antennas] H = H[:, :, :] H = np.nanmean(H, axis=1) plt.cla() if is_cont_meas(d): path = get_path(d) conf = "ULA" if is_ula(d) else "URA"
import random import numpy as np from utils.load_yaml import load_root_dir from utils.util_loc import is_cont_meas, is_ula, is_868 import matplotlib.pyplot as plt import aoa_algorithms as alg root_dir = load_root_dir() subdir, dirs, files = next(os.walk(os.path.join(root_dir))) if __name__ == '__main__': for d in dirs: if is_868(d) and not is_cont_meas(d) and is_ula(d): H = np.load(os.path.join(root_dir, d, "small-channel.npy")) H = H[:, :, 0:31] # average over freq points H_avg = np.mean(H, axis=1) H_avg = H_avg.transpose() # so it is a MxN matrix cov_mat = H_avg @ H_avg.conj().transpose() M = H.shape[2] angles = np.linspace(-np.pi / 2, np.pi / 2, 360) pspectrum, psindB, peaks = alg.music(cov_mat, 1, M, angles) plt.cla() plt.plot(angles, psindB) plt.plot(angles[peaks], psindB[peaks], 'x') plt.legend(['pseudo spectrum', 'Estimated DoAs']) plt.savefig(os.path.join(root_dir, d, "power_spectrum.png"))
if __name__ == '__main__': H_ula = [] H_ura = [] for d in dirs: # [snapshots x freq points x BS antennas] path = os.path.join(root_dir, d, "small-channel.npy") H = np.load(input) if is_cont_meas(d): # to much samples, split in 1 sec snapshots, i.e. 100 snapshots H_splitted = np.array_split(H, H.shape[0] // 100) for H_split in H_splitted: if is_ula(d): H_ula.append(H_split) else: H_ura.append(H_split) else: if is_ula(d): H_ula.append(H) else: H_ura.append(H) antenna_idx = list(range(31)) num_simulations = 10000 results = { "ULA": [[]*num_simulations]*31,
from utils.util_loc import is_cont_meas, is_ula, is_868, get_path, get_point import matplotlib.pyplot as plt if __name__ == '__main__': root_dir = load_root_dir() subdir, dirs, files = next(os.walk(os.path.join(root_dir))) pbar = tqdm(total=len(dirs)) URA = "URA" ULA = "ULA" for d in dirs: # only process 868 measurements is_868_b = is_868(d) is_ula_b = is_ula(d) # if is_cont_meas(d): # print(f"processing {d}") H = np.load(os.path.join(root_dir, d, "small-channel.npy")) # remove faulty antenna 32 # [snapshots x freq points x BS antennas] H = H[:, :, :-1] H = np.nanmean(H, axis=1) conf = ULA if is_ula(d) else URA _min = np.min(H[np.nonzero(H)]) H[H == 0] = _min H = 20 * np.log10(np.abs(H))