This commit is contained in:
HappyZ 2019-05-23 20:33:53 -05:00
parent bb0af93707
commit f23941953f
4 changed files with 18 additions and 5 deletions

View File

@ -24,9 +24,9 @@ def log_gamma_loc(
dist_squared = np.nansum((rx_loc - tx_loc) * (rx_loc - tx_loc), axis=1) dist_squared = np.nansum((rx_loc - tx_loc) * (rx_loc - tx_loc), axis=1)
dist_squared[dist_squared < 0.02] = 0.02 dist_squared[dist_squared < 0.02] = 0.02
noise = np.random.normal(GAUSSIAN_NOISE_MEAN, GAUSSIAN_NOISE_STD) if gaussian_noise else 0.0 noise = np.random.normal(GAUSSIAN_NOISE_MEAN, GAUSSIAN_NOISE_STD) if gaussian_noise else 0.0
rss = pwr - 10.0 * gamma / 2 * np.log10(dist_squared) + noise + loss rss = pwr - 10.0 * gamma / 2 * np.log10(dist_squared) + noise
rss[rss < NOISE_FLOOR] = NOISE_FLOOR rss[rss < NOISE_FLOOR] = NOISE_FLOOR
rss[rss > pwr] = pwr rss[rss > pwr] = pwr + loss
return rss return rss

View File

@ -374,6 +374,7 @@ class SpaceMap():
# initialize the map # initialize the map
self.__loss_p = np.zeros(self.map.shape) self.__loss_p = np.zeros(self.map.shape)
self.__loss_r = np.ones(self.map.shape) * -100 self.__loss_r = np.ones(self.map.shape) * -100
self.__orient = np.ones(self.map.shape) * float('nan')
self.__tx_locs = np.zeros(self.map.shape) self.__tx_locs = np.zeros(self.map.shape)
for j in range(self.map.shape[1]): for j in range(self.map.shape[1]):
y = self.bs * (j + 0.5) y = self.bs * (j + 0.5)
@ -409,6 +410,9 @@ class SpaceMap():
for i in range(self.map.shape[0]): for i in range(self.map.shape[0]):
self.setLoss(i, j, penetrations[i ,j], reflections[i, j]) self.setLoss(i, j, penetrations[i ,j], reflections[i, j])
def getOrientations(self):
return self.__orient
def setOrientations(self, orientations): def setOrientations(self, orientations):
for j in range(self.map.shape[1]): for j in range(self.map.shape[1]):
for i in range(self.map.shape[0]): for i in range(self.map.shape[0]):
@ -418,6 +422,7 @@ class SpaceMap():
if np.isnan(orientation): if np.isnan(orientation):
orientation = None orientation = None
self.map[i, j].setOrientation(orientation) self.map[i, j].setOrientation(orientation)
self.__orient[i, j] = orientation
def setLoss(self, i, j, penetration, reflection): def setLoss(self, i, j, penetration, reflection):
self.map[i, j].setLoss(penetration, reflection) self.map[i, j].setLoss(penetration, reflection)

View File

@ -63,10 +63,10 @@ def floormap_noise_injection(floormap, args):
if np.random.random() < 0.8: if np.random.random() < 0.8:
continue continue
loss_p, loss_r = floormap.getLoss(i, j) loss_p, loss_r = floormap.getLoss(i, j)
loss_r = np.random.randint(-3, 3) - 50 loss_r = np.random.randint(-3, 3) - 10
floormap.setLoss( floormap.setLoss(
i, j, i, j,
min(loss_p + np.random.randint(-3, 3), 0.0), min(loss_p + np.random.randint(-10, 5), 0.0),
loss_r loss_r
) )
floormap.setOrientation( floormap.setOrientation(
@ -150,6 +150,14 @@ def generateData(floormap, tx_locs, args):
with open("{}_{}.pickle".format(fp_base, int(power)), 'wb') as f: with open("{}_{}.pickle".format(fp_base, int(power)), 'wb') as f:
pickle.dump(rss_map, f, pickle.HIGHEST_PROTOCOL) pickle.dump(rss_map, f, pickle.HIGHEST_PROTOCOL)
loss_p, loss_r = floormap.getLosses()
orient = floormap.getOrientations()
with open("{}_{}_floormap.pickle".format(fp_base, int(power)), 'wb') as f:
pickle.dump([loss_p, loss_r, orient], f, pickle.HIGHEST_PROTOCOL)
sys.exit()
def getFloormap(args): def getFloormap(args):
''' '''

View File

@ -25,7 +25,7 @@ def plotSingle(filepath, args):
if data is None: if data is None:
print("err: failed to load file {}".format(filepath)) print("err: failed to load file {}".format(filepath))
return return
plotRSS(data) plotRSS(data, cminmax=(-85, -30))
def main(args): def main(args):