|
12 | 12 |
|
13 | 13 | # +
|
14 | 14 | import os
|
15 |
| -import subprocess |
16 | 15 | import sys
|
17 | 16 | import tempfile
|
18 | 17 | import time
|
19 | 18 |
|
| 19 | +import plotly.graph_objects as go |
20 | 20 | from ansys.aedt.core import Emit
|
21 |
| -from ansys.aedt.core.emit_core.emit_constants import InterfererType |
| 21 | +from ansys.aedt.core.emit_core.emit_constants import \ |
| 22 | + InterfererType # noqa: F401 |
22 | 23 |
|
23 | 24 | # -
|
24 | 25 |
|
|
27 | 28 | AEDT_VERSION = "2024.2"
|
28 | 29 | NG_MODE = False # Open Electronics UI when the application is launched.
|
29 | 30 |
|
30 |
| -# ## Python Dependencies |
31 |
| -# |
32 |
| -# The following cell can be run to make sure the ``plotly`` package is installed |
33 |
| -# in the current Python environment. If ``plotly`` is installed there is no need |
34 |
| -# to run this cell. |
35 |
| - |
36 |
| -# + |
37 |
| -# Check to see which Python packages have been installed |
38 |
| -reqs = subprocess.check_output([sys.executable, "-m", "pip", "freeze"]) |
39 |
| -installed_packages = [r.decode().split("==")[0] for r in reqs.split()] |
40 |
| - |
41 |
| - |
42 |
| -# Install required packages if they are not installed |
43 |
| -def install(package): |
44 |
| - subprocess.check_call([sys.executable, "-m", "pip", "install", package]) |
45 |
| - |
46 |
| - |
47 |
| -# Install any missing libraries |
48 |
| -required_packages = ["plotly"] |
49 |
| -for package in required_packages: |
50 |
| - if package not in installed_packages: |
51 |
| - install(package) |
52 |
| -# - |
53 |
| - |
54 |
| -# Import to support plotting. |
55 |
| - |
56 |
| -import plotly.graph_objects as go |
57 |
| - |
58 | 31 | # ## Create temporary directory
|
59 | 32 | #
|
60 | 33 | # Create temporary directory.
|
@@ -271,31 +244,33 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios):
|
271 | 244 | #
|
272 | 245 | # Get lists of all transmitters and receivers in the project.
|
273 | 246 |
|
274 |
| -if os.getenv("PYAEDT_DOC_GENERATION", "0") != "1": |
275 |
| - rev = emitapp.results.current_revision |
276 |
| - rx_radios = rev.get_receiver_names() |
277 |
| - tx_radios = rev.get_interferer_names(InterfererType.TRANSMITTERS) |
278 |
| - domain = emitapp.results.interaction_domain() |
| 247 | +# NOTE : The following code can be uncommented. |
| 248 | +# |
| 249 | +# rev = emitapp.results.current_revision |
| 250 | +# rx_radios = rev.get_receiver_names() |
| 251 | +# tx_radios = rev.get_interferer_names(InterfererType.TRANSMITTERS) |
| 252 | +# domain = emitapp.results.interaction_domain() |
279 | 253 |
|
280 | 254 | # ## Classify the results
|
281 | 255 | #
|
282 | 256 | # Iterate over all the transmitters and receivers and compute the power
|
283 | 257 | # at the input to each receiver due to each of the transmitters. Computes
|
284 | 258 | # which, if any, protection levels are exceeded by these power levels.
|
285 | 259 |
|
286 |
| -if os.getenv("PYAEDT_DOC_GENERATION", "0") != "1": |
287 |
| - power_matrix = [] |
288 |
| - all_colors = [] |
| 260 | +# NOTE : The following code can be uncommented but depends on the previous commented code. |
| 261 | +# |
| 262 | +# power_matrix = [] |
| 263 | +# all_colors = [] |
289 | 264 |
|
290 |
| - all_colors, power_matrix = rev.protection_level_classification( |
291 |
| - domain, global_levels=protection_levels |
292 |
| - ) |
| 265 | +# all_colors, power_matrix = rev.protection_level_classification( |
| 266 | +# domain, global_levels=protection_levels |
| 267 | +# ) |
293 | 268 |
|
294 |
| - # Create a scenario matrix-like view for the protection levels |
295 |
| - create_scenario_view(power_matrix, all_colors, tx_radios, rx_radios) |
| 269 | +# # Create a scenario matrix-like view for the protection levels |
| 270 | +# create_scenario_view(power_matrix, all_colors, tx_radios, rx_radios) |
296 | 271 |
|
297 |
| - # Create a legend for the protection levels |
298 |
| - create_legend_table() |
| 272 | +# # Create a legend for the protection levels |
| 273 | +# create_legend_table() |
299 | 274 |
|
300 | 275 | # ## Release AEDT
|
301 | 276 | #
|
|
0 commit comments