-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_network.py
225 lines (178 loc) · 10.5 KB
/
plot_network.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
__author__ = 'Awab Asher'
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np
plt.rc('text', usetex=True)
from simulation_parameters import (
AREA_OF_SIMULATION
)
def plot_poisson(density, area):
""""Args:
density: (int) density to determine intensity of the Poisson Point Process!
area: (float) simulation area!
Returns:
(scatter plot) of the Poisson Point Process for two operators having same densities at different BS densities!
"""
# Poisson Point Process simulation adapted from: https://hpaulkeeler.com/poisson-point-process-simulation/
x_min, x_max = 0, area
y_min, y_max = 0, 1
x_delta = x_max - x_min
y_delta = y_max - y_min
area_total = x_delta * y_delta # rectangular area dimensions
poisson_points = np.random.poisson(density * area_total) # Poisson number of points
xcoords, ycoords = [], []
x = x_delta * np.random.uniform(0, 1, poisson_points) + x_min # x coordinates of Poisson points
y = y_delta * np.random.uniform(0, 1, poisson_points) + y_min # y coordinates of Poisson points
xcoords.append(x)
ycoords.append(y)
return x, y
def plot_two_operators_at_different_densities(ue_density, start_density, end_density, area):
""""Args:
ue_density: (int) UE density of both operators!
start_density: (int) lower threshold of BS density!
end_density: (int) upper threshold of BS density!
area: (float) simulation area!
Returns:
(scatter plot) of the Poisson Point Process for two operators having same densities at different BS densities!
"""
num = int((end_density / start_density))
basestation_densities = np.linspace(start_density, end_density, num=num)
coords_ue_x, coords_ue_y = plot_poisson(ue_density, area)
x_bs_25, y_bs_25 = plot_poisson(basestation_densities[0], area)
x_bs_50, y_bs_50 = plot_poisson(basestation_densities[1], area)
x_bs_75, y_bs_75 = plot_poisson(basestation_densities[2], area)
x_bs_100, y_bs_100 = plot_poisson(basestation_densities[3], area)
x_bs_125, y_bs_125 = plot_poisson(basestation_densities[4], area)
x_bs_150, y_bs_150 = plot_poisson(basestation_densities[5], area)
x_bs_175, y_bs_175 = plot_poisson(basestation_densities[6], area)
x_bs_200, y_bs_200 = plot_poisson(basestation_densities[7], area)
x_bs_25_, y_bs_25_ = plot_poisson(basestation_densities[0], area)
x_bs_50_, y_bs_50_ = plot_poisson(basestation_densities[1], area)
x_bs_75_, y_bs_75_ = plot_poisson(basestation_densities[2], area)
x_bs_100_, y_bs_100_ = plot_poisson(basestation_densities[3], area)
x_bs_125_, y_bs_125_ = plot_poisson(basestation_densities[4], area)
x_bs_150_, y_bs_150_ = plot_poisson(basestation_densities[5], area)
x_bs_175_, y_bs_175_ = plot_poisson(basestation_densities[6], area)
x_bs_200_, y_bs_200_ = plot_poisson(basestation_densities[7], area)
# Non-homogeneous intensities!
fig1, axes = plt.subplots(2, 4, figsize=(13, 6))
axes[0, 0].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[0, 0].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[0, 0].scatter(x_bs_25_, y_bs_25_, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[0, 0].margins(0.05)
axes[0, 0].set_title(r'\bf{25 BSs/$km^2$}', fontsize=12)
axes[0, 0].set_xticks([])
axes[0, 0].set_yticks([])
axes[0, 1].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[0, 1].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[0, 1].scatter(x_bs_50, y_bs_50, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[0, 1].margins(0.05)
axes[0, 1].set_title(r'\bf{50 BSs/$km^2$}', fontsize=12)
axes[0, 1].set_xticks([])
axes[0, 1].set_yticks([])
axes[0, 2].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[0, 2].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[0, 2].scatter(x_bs_75, y_bs_75, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[0, 2].margins(0.05)
axes[0, 2].set_title(r'\bf{75 BSs/$km^2$}', fontsize=12)
axes[0, 2].set_xticks([])
axes[0, 2].set_yticks([])
axes[0, 3].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[0, 3].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[0, 3].scatter(x_bs_100, y_bs_100, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[0, 3].margins(0.05)
axes[0, 3].set_title(r'\bf{100 BSs/$km^2$}', fontsize=12)
axes[0, 3].set_xticks([])
axes[0, 3].set_yticks([])
axes[1, 0].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[1, 0].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[1, 0].scatter(x_bs_125, y_bs_125, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[1, 0].margins(0.05)
axes[1, 0].set_title(r'\bf{125 BSs/$km^2$}', fontsize=12)
axes[1, 0].set_xticks([])
axes[1, 0].set_yticks([])
axes[1, 1].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[1, 1].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[1, 1].scatter(x_bs_150, y_bs_150, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[1, 1].margins(0.05)
axes[1, 1].set_title(r'\bf{150 BSs/$km^2$}', fontsize=12)
axes[1, 1].set_xticks([])
axes[1, 1].set_yticks([])
axes[1, 2].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[1, 2].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[1, 2].scatter(x_bs_175, y_bs_175, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[1, 2].margins(0.05)
axes[1, 2].set_title(r'\bf{175 BSs/$km^2$}', fontsize=12)
axes[1, 2].set_xticks([])
axes[1, 2].set_yticks([])
axes[1, 3].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none')
axes[1, 3].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9)
axes[1, 3].scatter(x_bs_200, y_bs_200, edgecolor='#000FFA', facecolor='none', alpha=0.9)
axes[1, 3].margins(0.05)
axes[1, 3].set_title(r'\bf{200 BSs/$km^2$}', fontsize=12)
axes[1, 3].set_xticks([])
axes[1, 3].set_yticks([])
fig1.savefig("poisson_nonhomogeneous.pdf", bbox_inches='tight', dpi=400)
# Homogeneous intensities!
fig, axs = plt.subplots(2, 4, figsize=(13, 6))
axs[0, 0].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[0, 0].scatter(x_bs_25, y_bs_25, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[0, 0].scatter(x_bs_25_, y_bs_25_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[0, 0].margins(0.05)
axs[0, 0].set_title(r'\bf{25 BSs/$km^2$}', fontsize=12)
axs[0, 0].set_xticks([])
axs[0, 0].set_yticks([])
axs[0, 1].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[0, 1].scatter(x_bs_50, y_bs_50, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[0, 1].scatter(x_bs_50_, y_bs_50_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[0, 1].margins(0.05)
axs[0, 1].set_title(r'\bf{50 BSs/$km^2$}', fontsize=12)
axs[0, 1].set_xticks([])
axs[0, 1].set_yticks([])
axs[0, 2].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[0, 2].scatter(x_bs_75, y_bs_75, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[0, 2].scatter(x_bs_75_, y_bs_75_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[0, 2].margins(0.05)
axs[0, 2].set_title(r'\bf{75 BSs/$km^2$}', fontsize=12)
axs[0, 2].set_xticks([])
axs[0, 2].set_yticks([])
axs[0, 3].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='o')
axs[0, 3].scatter(x_bs_100, y_bs_100, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[0, 3].scatter(x_bs_100_, y_bs_100_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[0, 3].margins(0.05)
axs[0, 3].set_title(r'\bf{100 BSs/$km^2$}', fontsize=12)
axs[0, 3].set_xticks([])
axs[0, 3].set_yticks([])
axs[1, 0].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[1, 0].scatter(x_bs_100, y_bs_100, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[1, 0].scatter(x_bs_125_, y_bs_125_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[1, 0].margins(0.05)
axs[1, 0].set_title(r'\bf{125 BSs/$km^2$}', fontsize=12)
axs[1, 0].set_xticks([])
axs[1, 0].set_yticks([])
axs[1, 1].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[1, 1].scatter(x_bs_150, y_bs_150, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[1, 1].scatter(x_bs_150_, y_bs_150_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[1, 1].margins(0.05)
axs[1, 1].set_title(r'\bf{150 BSs/$km^2$}', fontsize=12)
axs[1, 1].set_xticks([])
axs[1, 1].set_yticks([])
axs[1, 2].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[1, 2].scatter(x_bs_175, y_bs_175, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[1, 2].scatter(x_bs_175_, y_bs_175_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[1, 2].margins(0.05)
axs[1, 2].set_title(r'\bf{175 BSs/$km^2$}', fontsize=12)
axs[1, 2].set_xticks([])
axs[1, 2].set_yticks([])
axs[1, 3].plot(coords_ue_x, coords_ue_y, c='#3F3C3D', marker='+', linestyle='none', label='+')
axs[1, 3].scatter(x_bs_200, y_bs_200, edgecolor='#00FA09', facecolor='none', alpha=0.9, label='o')
axs[1, 3].scatter(x_bs_200_, y_bs_200_, edgecolor='#000FFA', facecolor='none', alpha=0.9, label='o')
axs[1, 3].margins(0.05)
axs[1, 3].set_title(r'\bf{200 BSs/$km^2$}', fontsize=12)
axs[1, 3].set_xticks([])
axs[1, 3].set_yticks([])
# fig.savefig('poisson.eps', format='eps', dpi=1000)
# fig.savefig('poisson.svg', format='svg', dpi=1200)
# fig.savefig("poisson_homogeneous.pdf", bbox_inches='tight', dpi=400)
plt.show()
# plot_two_operators_at_different_densities(500, 25, 200, area=AREA_OF_SIMULATION)