Simulation

  1# coding: utf-8
  2import os
  3import sys
  4import json
  5from Scene import Scene
  6from Landscape import Landscape
  7from Sensor import SensorBasic, SensorOrthographic, SensorPhotonTracing, SensorPerspective, SensorFisheye, SensorLiDAR, SensorType
  8from Illumination import Illumination
  9from Observation import ObservationOrthographic, ObservationPerspective, ObservationFisheye
 10from AdvancedParams import AdvancedParams
 11from SimulationHelper import SimulationHelper
 12from LiDAR import LiDARSimMode, create_lidar_from_file
 13from RuntimeScene import RuntimeScene
 14
 15
 16class Simulation(object):
 17    def __init__(self, sim_dir, simulation_helper):
 18        self.__sim_dir = sim_dir
 19        self.__sim_helper = simulation_helper
 20        self.__scene = Scene(self)
 21        self.__dist_file = ""
 22
 23        # calculated members
 24        self.__input_conf_path = os.path.join(sim_dir, "Parameters", "input.conf")
 25        self.__input_conf = self.load_input_conf()
 26
 27        self.__runtime_scene = None
 28        self.__runtime_modification = False
 29
 30    def enable_runtime_modification_of_properties(self, runtime_modification):
 31        self.__runtime_modification = runtime_modification
 32
 33    def get_scene_helper(self):
 34        return self.__sim_helper
 35
 36    def load_input_conf(self):
 37        f = open(self.__input_conf_path)
 38        input_conf = json.load(f)
 39        f.close()
 40        return input_conf
 41
 42    def get_dist_file(self):
 43        return self.__dist_file
 44
 45    def set_dist_file(self, dist_file):
 46        self.__dist_file = dist_file
 47
 48    def prepare_for_ui(self):
 49        self.get_scene().get_landscape().prepare_for_ui()
 50
 51    # 初始化默认文件名
 52    def __init_dist_file(self):
 53        if self.__dist_file != "":
 54            return
 55        thermal_img_prefix = "thermal_"
 56        spectral_img_prefix = "spectral_"
 57        photon_tracing_img_prefix = "photontracing_"
 58
 59        distFileName = ""
 60        imgPrefix = ""
 61        sensor = self.__scene.get_sensor()
 62        obs = self.__scene.get_observation()
 63        if sensor.thermal_radiation:
 64            imgPrefix = thermal_img_prefix
 65        else:
 66            imgPrefix = spectral_img_prefix
 67
 68        if sensor.sensor_type == "orthographic":
 69            distFileName = imgPrefix + "VZ=" + str(obs.obs_zenith) + \
 70                           "_VA=" + str(obs.obs_azimuth)
 71        if sensor.sensor_type == "perspective" or sensor.sensor_type == "CircularFisheye":
 72            ox, oy, oz, tx, ty, tz = obs.obs_o_x, obs.obs_o_y, obs.obs_o_z, obs.obs_t_x, obs.obs_t_y, obs.obs_t_z
 73            distFileName = imgPrefix + "ox=%.2f_oy=%.2f_oz=%.2f_tx=%.2f_ty=%.2f_tz=%.2f" % (ox, oy, oz, tx, ty, tz)
 74            distFileName = distFileName.replace(".", "_")
 75
 76        if sensor.sensor_type == "PhotonTracing":
 77            distFileName = photon_tracing_img_prefix + str(sensor.sun_ray_resolution).replace(".", "_")
 78        self.__dist_file = os.path.join(self.get_sim_dir(), "Results", distFileName)
 79
 80    def __read_sensor_from_json(self):
 81        sensor_type = self.__input_conf["sensor"]["sensor_type"]
 82        sensor = SensorBasic()
 83        if sensor_type == "orthographic":
 84            sensor = SensorOrthographic()
 85        if sensor_type == "PhotonTracing":
 86            sensor = SensorPhotonTracing()
 87        if sensor_type == "perspective":
 88            sensor = SensorPerspective()
 89        if sensor_type == "CircularFisheye":
 90            sensor = SensorFisheye()
 91        if sensor_type == "LiDAR":
 92            sensor = SensorLiDAR()
 93        sensor.set_sim(self)
 94        sensor.init_sensor_from_json(self.__input_conf)
 95        return sensor
 96
 97    def __read_observation_from_json(self):
 98        sensor_type = self.__input_conf["sensor"]["sensor_type"]
 99        if sensor_type == "orthographic":
100            observation = ObservationOrthographic()
101            observation.init_obs_from_json(self.__input_conf)
102            return observation
103        if sensor_type == "PhotonTracing":  # This is actually not used
104            observation = ObservationOrthographic()
105            observation.init_obs_from_json(self.__input_conf)
106            return observation
107        if sensor_type == "perspective":
108            observation = ObservationPerspective()
109            observation.init_obs_from_json(self.__input_conf)
110            return observation
111        if sensor_type == "CircularFisheye":
112            observation = ObservationPerspective()
113            observation.init_obs_from_json(self.__input_conf)
114            return observation
115        if sensor_type == "LiDAR":  # an orth obs is used # This is actually not used
116            observation = ObservationOrthographic()
117            return observation
118
119    def get_scene(self):
120        return self.__scene
121
122    def get_sim_dir(self):
123        return self.__sim_dir
124
125    def get_parameters_dir(self):
126        return os.path.join(self.get_sim_dir(), "Parameters")
127
128    def is_sim_valid(self):
129        if os.path.exists(os.path.join(self.__sim_dir, ".less")):
130            return True
131        else:
132            return False
133
134    def read_sim_project(self):
135        if not self.is_sim_valid():
136            print("Simulation project: "+self.__sim_dir+" is not a valid project.")
137            sys.exit(0)
138        # Sensor
139        self.__scene.set_sensor(self.__read_sensor_from_json())
140
141        # Landscape
142        landscape = Landscape()
143        landscape.set_sim(self)
144        landscape.init_landscape_from_json(self.__input_conf)
145
146        self.__scene.set_landscape(landscape)
147
148        # Illumination
149        illumination = Illumination()
150        illumination.set_sim(self)
151        illumination.init_illumination_from_json(self.__input_conf)
152        self.__scene.set_illumination(illumination)
153
154        # Observation
155        self.__scene.set_observation(self.__read_observation_from_json())
156
157        # Advanced parameters
158        advanced_params = AdvancedParams()
159        advanced_params.init_advanced_params_from_json(self.__input_conf)
160        self.__scene.set_advanced_params(advanced_params)
161
162    def save_sim_project(self):
163        f_out = open(self.__input_conf_path, "w")
164        json.dump(self.__scene.to_json_object(self), f_out, indent=2)
165        f_out.close()
166
167    def __check_correction_before_run(self):
168        pass
169
170    def start(self):
171        self.__init_dist_file()
172        if self.__runtime_modification:
173            if self.__scene.with_lidar_sensor():
174                print("INFO: LiDAR simulation does not support runtime modification of scene properties currently. If"
175                      "you really want, please contact [email protected]")
176                sys.exit(0)
177            self.__start_runtime_simulation()
178            return
179
180        if self.__scene.with_lidar_sensor():
181            cwd = os.getcwd()
182            os.chdir(self.__sim_dir)
183            interpreter = self.__sim_helper.get_py_interpreter_path()
184            script_lidar_gen_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidargen.py")
185            os.system(interpreter + " " + script_lidar_gen_path + " --genall")
186
187            script_lidar_sim_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidarless.py")
188            if self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.SingleRayPointCloud:
189                os.system(interpreter + " " + script_lidar_sim_path + " singleRay")
190            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloud:
191                os.system(interpreter + " " + script_lidar_sim_path + " pointcloud")
192            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloudIncident:
193                os.system(interpreter + " " + script_lidar_sim_path + " pointcloudIncident")
194            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayWaveform:
195                os.system(interpreter + " " + script_lidar_sim_path + " waveform")
196                print("INFO: Performing convolution...")
197                convolve_script_path = os.path.join(self.__sim_helper.get_less_py_dir(),
198                                                    "lidar/waveformConvolve/convolveWaveform.py")
199                scene_xsize = self.__scene.get_landscape().get_terrain().extent_width
200                scene_ysize = self.__scene.get_landscape().get_terrain().extent_height
201                os.system(interpreter + " " + convolve_script_path + " -1 " + str(scene_xsize) + " " + str(scene_ysize))
202
203            os.chdir(cwd)
204        else:
205            cwd = os.getcwd()
206            os.chdir(self.__sim_dir)
207            interpreter = self.__sim_helper.get_py_interpreter_path()
208            script_lesspy_path = self.__sim_helper.get_script_less_py_path()
209            os.system(interpreter + " " + script_lesspy_path + " -g s")
210            os.system(interpreter + " " + script_lesspy_path + " -g v")
211            if self.__dist_file == "":
212                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
213                          str(self.get_scene().get_advanced_params().number_of_cores))
214            else:
215                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
216                          str(self.get_scene().get_advanced_params().number_of_cores) + " -d " + self.__dist_file)
217            os.chdir(cwd)
218
219    def __load_runtime_scene(self):
220        if self.__runtime_scene is None:
221            cwd = os.getcwd()
222            os.chdir(self.__sim_dir)
223            interpreter = self.__sim_helper.get_py_interpreter_path()
224            script_lesspy_path = self.__sim_helper.get_script_less_py_path()
225            os.system(interpreter + " " + script_lesspy_path + " -g s")
226            os.system(interpreter + " " + script_lesspy_path + " -g v")
227            os.chdir(cwd)
228            self.__runtime_scene = RuntimeScene(self)
229            self.__runtime_scene.load_scene()
230        self.__runtime_scene.less_runtime_scene.setDestinationFile(self.get_dist_file())
231
232    def __start_runtime_simulation(self):
233        self.__load_runtime_scene()
234        self.__runtime_scene.update_parameters()
235        self.__runtime_scene.start()
236
237if __name__ == "__main__":
238    sim_helper = SimulationHelper(r"D:\LESS")
239    sim_helper.create_new_sim(r"D:\LESS\simulations\test_auto_create")
240    sim = Simulation(r"D:\LESS\simulations\test_auto_create", sim_helper)
241    sim.read_sim_project()
242    # Change parameters
243    sim.get_scene().get_sensor().film_type = "rgb"
244    for i in [0, 30, 50, 60]:
245        # obs = ObservationOrthographic()
246        # obs.obs_zenith = i
247        # sim.get_scene().set_observation(obs)
248        obs = ObservationFisheye()
249        obs.obs_o_z = 50
250        sim.get_scene().set_observation(obs)
251        sim.save_sim_project()
252        sim.start()
class Simulation:
 17class Simulation(object):
 18    def __init__(self, sim_dir, simulation_helper):
 19        self.__sim_dir = sim_dir
 20        self.__sim_helper = simulation_helper
 21        self.__scene = Scene(self)
 22        self.__dist_file = ""
 23
 24        # calculated members
 25        self.__input_conf_path = os.path.join(sim_dir, "Parameters", "input.conf")
 26        self.__input_conf = self.load_input_conf()
 27
 28        self.__runtime_scene = None
 29        self.__runtime_modification = False
 30
 31    def enable_runtime_modification_of_properties(self, runtime_modification):
 32        self.__runtime_modification = runtime_modification
 33
 34    def get_scene_helper(self):
 35        return self.__sim_helper
 36
 37    def load_input_conf(self):
 38        f = open(self.__input_conf_path)
 39        input_conf = json.load(f)
 40        f.close()
 41        return input_conf
 42
 43    def get_dist_file(self):
 44        return self.__dist_file
 45
 46    def set_dist_file(self, dist_file):
 47        self.__dist_file = dist_file
 48
 49    def prepare_for_ui(self):
 50        self.get_scene().get_landscape().prepare_for_ui()
 51
 52    # 初始化默认文件名
 53    def __init_dist_file(self):
 54        if self.__dist_file != "":
 55            return
 56        thermal_img_prefix = "thermal_"
 57        spectral_img_prefix = "spectral_"
 58        photon_tracing_img_prefix = "photontracing_"
 59
 60        distFileName = ""
 61        imgPrefix = ""
 62        sensor = self.__scene.get_sensor()
 63        obs = self.__scene.get_observation()
 64        if sensor.thermal_radiation:
 65            imgPrefix = thermal_img_prefix
 66        else:
 67            imgPrefix = spectral_img_prefix
 68
 69        if sensor.sensor_type == "orthographic":
 70            distFileName = imgPrefix + "VZ=" + str(obs.obs_zenith) + \
 71                           "_VA=" + str(obs.obs_azimuth)
 72        if sensor.sensor_type == "perspective" or sensor.sensor_type == "CircularFisheye":
 73            ox, oy, oz, tx, ty, tz = obs.obs_o_x, obs.obs_o_y, obs.obs_o_z, obs.obs_t_x, obs.obs_t_y, obs.obs_t_z
 74            distFileName = imgPrefix + "ox=%.2f_oy=%.2f_oz=%.2f_tx=%.2f_ty=%.2f_tz=%.2f" % (ox, oy, oz, tx, ty, tz)
 75            distFileName = distFileName.replace(".", "_")
 76
 77        if sensor.sensor_type == "PhotonTracing":
 78            distFileName = photon_tracing_img_prefix + str(sensor.sun_ray_resolution).replace(".", "_")
 79        self.__dist_file = os.path.join(self.get_sim_dir(), "Results", distFileName)
 80
 81    def __read_sensor_from_json(self):
 82        sensor_type = self.__input_conf["sensor"]["sensor_type"]
 83        sensor = SensorBasic()
 84        if sensor_type == "orthographic":
 85            sensor = SensorOrthographic()
 86        if sensor_type == "PhotonTracing":
 87            sensor = SensorPhotonTracing()
 88        if sensor_type == "perspective":
 89            sensor = SensorPerspective()
 90        if sensor_type == "CircularFisheye":
 91            sensor = SensorFisheye()
 92        if sensor_type == "LiDAR":
 93            sensor = SensorLiDAR()
 94        sensor.set_sim(self)
 95        sensor.init_sensor_from_json(self.__input_conf)
 96        return sensor
 97
 98    def __read_observation_from_json(self):
 99        sensor_type = self.__input_conf["sensor"]["sensor_type"]
100        if sensor_type == "orthographic":
101            observation = ObservationOrthographic()
102            observation.init_obs_from_json(self.__input_conf)
103            return observation
104        if sensor_type == "PhotonTracing":  # This is actually not used
105            observation = ObservationOrthographic()
106            observation.init_obs_from_json(self.__input_conf)
107            return observation
108        if sensor_type == "perspective":
109            observation = ObservationPerspective()
110            observation.init_obs_from_json(self.__input_conf)
111            return observation
112        if sensor_type == "CircularFisheye":
113            observation = ObservationPerspective()
114            observation.init_obs_from_json(self.__input_conf)
115            return observation
116        if sensor_type == "LiDAR":  # an orth obs is used # This is actually not used
117            observation = ObservationOrthographic()
118            return observation
119
120    def get_scene(self):
121        return self.__scene
122
123    def get_sim_dir(self):
124        return self.__sim_dir
125
126    def get_parameters_dir(self):
127        return os.path.join(self.get_sim_dir(), "Parameters")
128
129    def is_sim_valid(self):
130        if os.path.exists(os.path.join(self.__sim_dir, ".less")):
131            return True
132        else:
133            return False
134
135    def read_sim_project(self):
136        if not self.is_sim_valid():
137            print("Simulation project: "+self.__sim_dir+" is not a valid project.")
138            sys.exit(0)
139        # Sensor
140        self.__scene.set_sensor(self.__read_sensor_from_json())
141
142        # Landscape
143        landscape = Landscape()
144        landscape.set_sim(self)
145        landscape.init_landscape_from_json(self.__input_conf)
146
147        self.__scene.set_landscape(landscape)
148
149        # Illumination
150        illumination = Illumination()
151        illumination.set_sim(self)
152        illumination.init_illumination_from_json(self.__input_conf)
153        self.__scene.set_illumination(illumination)
154
155        # Observation
156        self.__scene.set_observation(self.__read_observation_from_json())
157
158        # Advanced parameters
159        advanced_params = AdvancedParams()
160        advanced_params.init_advanced_params_from_json(self.__input_conf)
161        self.__scene.set_advanced_params(advanced_params)
162
163    def save_sim_project(self):
164        f_out = open(self.__input_conf_path, "w")
165        json.dump(self.__scene.to_json_object(self), f_out, indent=2)
166        f_out.close()
167
168    def __check_correction_before_run(self):
169        pass
170
171    def start(self):
172        self.__init_dist_file()
173        if self.__runtime_modification:
174            if self.__scene.with_lidar_sensor():
175                print("INFO: LiDAR simulation does not support runtime modification of scene properties currently. If"
176                      "you really want, please contact [email protected]")
177                sys.exit(0)
178            self.__start_runtime_simulation()
179            return
180
181        if self.__scene.with_lidar_sensor():
182            cwd = os.getcwd()
183            os.chdir(self.__sim_dir)
184            interpreter = self.__sim_helper.get_py_interpreter_path()
185            script_lidar_gen_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidargen.py")
186            os.system(interpreter + " " + script_lidar_gen_path + " --genall")
187
188            script_lidar_sim_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidarless.py")
189            if self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.SingleRayPointCloud:
190                os.system(interpreter + " " + script_lidar_sim_path + " singleRay")
191            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloud:
192                os.system(interpreter + " " + script_lidar_sim_path + " pointcloud")
193            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloudIncident:
194                os.system(interpreter + " " + script_lidar_sim_path + " pointcloudIncident")
195            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayWaveform:
196                os.system(interpreter + " " + script_lidar_sim_path + " waveform")
197                print("INFO: Performing convolution...")
198                convolve_script_path = os.path.join(self.__sim_helper.get_less_py_dir(),
199                                                    "lidar/waveformConvolve/convolveWaveform.py")
200                scene_xsize = self.__scene.get_landscape().get_terrain().extent_width
201                scene_ysize = self.__scene.get_landscape().get_terrain().extent_height
202                os.system(interpreter + " " + convolve_script_path + " -1 " + str(scene_xsize) + " " + str(scene_ysize))
203
204            os.chdir(cwd)
205        else:
206            cwd = os.getcwd()
207            os.chdir(self.__sim_dir)
208            interpreter = self.__sim_helper.get_py_interpreter_path()
209            script_lesspy_path = self.__sim_helper.get_script_less_py_path()
210            os.system(interpreter + " " + script_lesspy_path + " -g s")
211            os.system(interpreter + " " + script_lesspy_path + " -g v")
212            if self.__dist_file == "":
213                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
214                          str(self.get_scene().get_advanced_params().number_of_cores))
215            else:
216                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
217                          str(self.get_scene().get_advanced_params().number_of_cores) + " -d " + self.__dist_file)
218            os.chdir(cwd)
219
220    def __load_runtime_scene(self):
221        if self.__runtime_scene is None:
222            cwd = os.getcwd()
223            os.chdir(self.__sim_dir)
224            interpreter = self.__sim_helper.get_py_interpreter_path()
225            script_lesspy_path = self.__sim_helper.get_script_less_py_path()
226            os.system(interpreter + " " + script_lesspy_path + " -g s")
227            os.system(interpreter + " " + script_lesspy_path + " -g v")
228            os.chdir(cwd)
229            self.__runtime_scene = RuntimeScene(self)
230            self.__runtime_scene.load_scene()
231        self.__runtime_scene.less_runtime_scene.setDestinationFile(self.get_dist_file())
232
233    def __start_runtime_simulation(self):
234        self.__load_runtime_scene()
235        self.__runtime_scene.update_parameters()
236        self.__runtime_scene.start()
Simulation(sim_dir, simulation_helper)
18    def __init__(self, sim_dir, simulation_helper):
19        self.__sim_dir = sim_dir
20        self.__sim_helper = simulation_helper
21        self.__scene = Scene(self)
22        self.__dist_file = ""
23
24        # calculated members
25        self.__input_conf_path = os.path.join(sim_dir, "Parameters", "input.conf")
26        self.__input_conf = self.load_input_conf()
27
28        self.__runtime_scene = None
29        self.__runtime_modification = False
def enable_runtime_modification_of_properties(self, runtime_modification):
31    def enable_runtime_modification_of_properties(self, runtime_modification):
32        self.__runtime_modification = runtime_modification
def get_scene_helper(self):
34    def get_scene_helper(self):
35        return self.__sim_helper
def load_input_conf(self):
37    def load_input_conf(self):
38        f = open(self.__input_conf_path)
39        input_conf = json.load(f)
40        f.close()
41        return input_conf
def get_dist_file(self):
43    def get_dist_file(self):
44        return self.__dist_file
def set_dist_file(self, dist_file):
46    def set_dist_file(self, dist_file):
47        self.__dist_file = dist_file
def prepare_for_ui(self):
49    def prepare_for_ui(self):
50        self.get_scene().get_landscape().prepare_for_ui()
def get_scene(self):
120    def get_scene(self):
121        return self.__scene
def get_sim_dir(self):
123    def get_sim_dir(self):
124        return self.__sim_dir
def get_parameters_dir(self):
126    def get_parameters_dir(self):
127        return os.path.join(self.get_sim_dir(), "Parameters")
def is_sim_valid(self):
129    def is_sim_valid(self):
130        if os.path.exists(os.path.join(self.__sim_dir, ".less")):
131            return True
132        else:
133            return False
def read_sim_project(self):
135    def read_sim_project(self):
136        if not self.is_sim_valid():
137            print("Simulation project: "+self.__sim_dir+" is not a valid project.")
138            sys.exit(0)
139        # Sensor
140        self.__scene.set_sensor(self.__read_sensor_from_json())
141
142        # Landscape
143        landscape = Landscape()
144        landscape.set_sim(self)
145        landscape.init_landscape_from_json(self.__input_conf)
146
147        self.__scene.set_landscape(landscape)
148
149        # Illumination
150        illumination = Illumination()
151        illumination.set_sim(self)
152        illumination.init_illumination_from_json(self.__input_conf)
153        self.__scene.set_illumination(illumination)
154
155        # Observation
156        self.__scene.set_observation(self.__read_observation_from_json())
157
158        # Advanced parameters
159        advanced_params = AdvancedParams()
160        advanced_params.init_advanced_params_from_json(self.__input_conf)
161        self.__scene.set_advanced_params(advanced_params)
def save_sim_project(self):
163    def save_sim_project(self):
164        f_out = open(self.__input_conf_path, "w")
165        json.dump(self.__scene.to_json_object(self), f_out, indent=2)
166        f_out.close()
def start(self):
171    def start(self):
172        self.__init_dist_file()
173        if self.__runtime_modification:
174            if self.__scene.with_lidar_sensor():
175                print("INFO: LiDAR simulation does not support runtime modification of scene properties currently. If"
176                      "you really want, please contact [email protected]")
177                sys.exit(0)
178            self.__start_runtime_simulation()
179            return
180
181        if self.__scene.with_lidar_sensor():
182            cwd = os.getcwd()
183            os.chdir(self.__sim_dir)
184            interpreter = self.__sim_helper.get_py_interpreter_path()
185            script_lidar_gen_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidargen.py")
186            os.system(interpreter + " " + script_lidar_gen_path + " --genall")
187
188            script_lidar_sim_path = os.path.join(self.__sim_helper.get_less_py_dir(), "lidarless.py")
189            if self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.SingleRayPointCloud:
190                os.system(interpreter + " " + script_lidar_sim_path + " singleRay")
191            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloud:
192                os.system(interpreter + " " + script_lidar_sim_path + " pointcloud")
193            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayPointCloudIncident:
194                os.system(interpreter + " " + script_lidar_sim_path + " pointcloudIncident")
195            elif self.__scene.get_sensor().get_scanning_device().get_lidar_sim_mode() == LiDARSimMode.MultiRayWaveform:
196                os.system(interpreter + " " + script_lidar_sim_path + " waveform")
197                print("INFO: Performing convolution...")
198                convolve_script_path = os.path.join(self.__sim_helper.get_less_py_dir(),
199                                                    "lidar/waveformConvolve/convolveWaveform.py")
200                scene_xsize = self.__scene.get_landscape().get_terrain().extent_width
201                scene_ysize = self.__scene.get_landscape().get_terrain().extent_height
202                os.system(interpreter + " " + convolve_script_path + " -1 " + str(scene_xsize) + " " + str(scene_ysize))
203
204            os.chdir(cwd)
205        else:
206            cwd = os.getcwd()
207            os.chdir(self.__sim_dir)
208            interpreter = self.__sim_helper.get_py_interpreter_path()
209            script_lesspy_path = self.__sim_helper.get_script_less_py_path()
210            os.system(interpreter + " " + script_lesspy_path + " -g s")
211            os.system(interpreter + " " + script_lesspy_path + " -g v")
212            if self.__dist_file == "":
213                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
214                          str(self.get_scene().get_advanced_params().number_of_cores))
215            else:
216                os.system(interpreter + " " + script_lesspy_path + " -r n -p " +
217                          str(self.get_scene().get_advanced_params().number_of_cores) + " -d " + self.__dist_file)
218            os.chdir(cwd)