diff --git a/libs/models.py b/libs/models.py index c94fd6b..2ff0ff0 100644 --- a/libs/models.py +++ b/libs/models.py @@ -24,9 +24,9 @@ def log_gamma_loc( dist_squared = np.nansum((rx_loc - tx_loc) * (rx_loc - tx_loc), axis=1) dist_squared[dist_squared < 0.02] = 0.02 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 > pwr] = pwr + rss[rss > pwr] = pwr + loss return rss diff --git a/libs/spacemap.py b/libs/spacemap.py index e4a23f9..14b2452 100644 --- a/libs/spacemap.py +++ b/libs/spacemap.py @@ -374,6 +374,7 @@ class SpaceMap(): # initialize the map self.__loss_p = np.zeros(self.map.shape) 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) for j in range(self.map.shape[1]): y = self.bs * (j + 0.5) @@ -409,6 +410,9 @@ class SpaceMap(): for i in range(self.map.shape[0]): self.setLoss(i, j, penetrations[i ,j], reflections[i, j]) + def getOrientations(self): + return self.__orient + def setOrientations(self, orientations): for j in range(self.map.shape[1]): for i in range(self.map.shape[0]): @@ -418,6 +422,7 @@ class SpaceMap(): if np.isnan(orientation): orientation = None self.map[i, j].setOrientation(orientation) + self.__orient[i, j] = orientation def setLoss(self, i, j, penetration, reflection): self.map[i, j].setLoss(penetration, reflection) diff --git a/syngen_floorplan_multipath.py b/syngen_floorplan_multipath.py index d0cccf2..5f73a0d 100644 --- a/syngen_floorplan_multipath.py +++ b/syngen_floorplan_multipath.py @@ -63,10 +63,10 @@ def floormap_noise_injection(floormap, args): if np.random.random() < 0.8: continue 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( i, j, - min(loss_p + np.random.randint(-3, 3), 0.0), + min(loss_p + np.random.randint(-10, 5), 0.0), loss_r ) floormap.setOrientation( @@ -150,6 +150,14 @@ def generateData(floormap, tx_locs, args): with open("{}_{}.pickle".format(fp_base, int(power)), 'wb') as f: 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): ''' diff --git a/visualize.py b/visualize.py index 66dd911..c4ead29 100644 --- a/visualize.py +++ b/visualize.py @@ -25,7 +25,7 @@ def plotSingle(filepath, args): if data is None: print("err: failed to load file {}".format(filepath)) return - plotRSS(data) + plotRSS(data, cminmax=(-85, -30)) def main(args):