-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_dataGeneration.py
More file actions
93 lines (79 loc) · 4.6 KB
/
Copy pathexample_dataGeneration.py
File metadata and controls
93 lines (79 loc) · 4.6 KB
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
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ABeL: example_dataGeneration.py +
# Copyright (C) 2025 Simon Huh +
# +
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public +
# License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any +
# later version. +
# +
# This program is distributed in the hope that it will be useful, but +
# WITHOUT ANY WARRANTY; without +
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +
# License for more details. +
# +
# You should have received a copy of the GNU General Public License along with this program. If not, see +
# <https://www.gnu.org/licenses/>. +
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import logging
import logging.config
import yaml
from pathlib import Path
from SionnaPathGeneration.pathGeneration import PathGeneration
from globalUtils.terminalInput import askForInput
# Definition of filters for logging
class WarningsAndBelowFilter(logging.Filter):
def filter(self, record):
return record.levelno <= logging.WARNING
class WarningsAndAboveFilter(logging.Filter):
def filter(self, record):
return record.levelno >= logging.WARNING
if __name__ == '__main__':
"""
A simple example for using the generation signal propagation data.
To execute the programm, navigate to the "MultipathSionna" folder via the shell / terminal and type
python3 example_dataGeneration.py
"""
# Load logging config
Path("data/output").mkdir(parents=True, exist_ok=True)
with open("config/loggingConfig.yaml", "r") as yamlFile:
logging.config.dictConfig(yaml.safe_load(yamlFile))
logger = logging.getLogger(__name__)
# Ask user for his preferences for the propagation data generation
errMsg = "No correct user input was given! Aborting operation ..."
logger.info("This is an example for generating data with ABeL." + "\n" +
"Do you want to use a GPU for generating the propagation data? " + "\t[Y/n]:")
try:
userInput = askForInput(listOfArguments=["Y", "n"], returnWhenEnter="Y")
if userInput == "n":
logger.warning("Using a GPU is strongly recommended! The simulation time will rise significantly if "
"the CPU is used for generating propagation data." + "\n" +
"Are you sure?")
userInput = askForInput(listOfArguments=["N", "y"], returnWhenEnter="N")
if userInput == "n":
useGPU = True
elif userInput == "y":
useGPU = False
else:
raise ValueError
elif userInput == "y":
useGPU = True
else:
raise ValueError
except ValueError:
logger.error(errMsg)
raise
logger.info("Do you want to simulate the receivers movement data? " + "\t[Y/n]:")
userInput = askForInput(listOfArguments=["Y", "n"], returnWhenEnter="Y")
if userInput == "y":
simulateMovement = True
elif userInput == "n":
simulateMovement = False
else:
logger.error(errMsg)
raise ValueError(errMsg)
# Generate signal propagation data
PathGenerationInstance = PathGeneration(useGPU=useGPU)
PathGenerationInstance.importConfig()
PathGenerationInstance.setupEnvironment()
PathGenerationInstance.runPathGeneration(simulateMovement=simulateMovement)
PathGenerationInstance.saveSionnaPathData()