gammasimtools 0.26.0__py3-none-any.whl → 0.27.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/METADATA +5 -1
  2. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/RECORD +70 -66
  3. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/WHEEL +1 -1
  4. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/entry_points.txt +1 -1
  5. simtools/_version.py +2 -2
  6. simtools/applications/convert_geo_coordinates_of_array_elements.py +2 -1
  7. simtools/applications/db_get_array_layouts_from_db.py +1 -1
  8. simtools/applications/{calculate_incident_angles.py → derive_incident_angle.py} +16 -16
  9. simtools/applications/derive_mirror_rnda.py +111 -177
  10. simtools/applications/generate_corsika_histograms.py +38 -1
  11. simtools/applications/generate_regular_arrays.py +73 -36
  12. simtools/applications/simulate_flasher.py +3 -13
  13. simtools/applications/simulate_illuminator.py +2 -10
  14. simtools/applications/simulate_pedestals.py +1 -1
  15. simtools/applications/simulate_prod.py +8 -7
  16. simtools/applications/submit_data_from_external.py +2 -1
  17. simtools/applications/validate_camera_efficiency.py +28 -27
  18. simtools/applications/validate_cumulative_psf.py +1 -3
  19. simtools/applications/validate_optics.py +2 -1
  20. simtools/atmosphere.py +83 -0
  21. simtools/camera/camera_efficiency.py +171 -48
  22. simtools/camera/single_photon_electron_spectrum.py +6 -6
  23. simtools/configuration/commandline_parser.py +47 -9
  24. simtools/constants.py +5 -0
  25. simtools/corsika/corsika_config.py +88 -185
  26. simtools/corsika/corsika_histograms.py +246 -69
  27. simtools/data_model/model_data_writer.py +46 -49
  28. simtools/data_model/schema.py +2 -0
  29. simtools/db/db_handler.py +4 -2
  30. simtools/db/mongo_db.py +2 -2
  31. simtools/io/ascii_handler.py +52 -4
  32. simtools/io/io_handler.py +23 -12
  33. simtools/job_execution/job_manager.py +154 -79
  34. simtools/job_execution/process_pool.py +137 -0
  35. simtools/layout/array_layout.py +0 -1
  36. simtools/layout/array_layout_utils.py +143 -21
  37. simtools/model/array_model.py +22 -50
  38. simtools/model/calibration_model.py +4 -4
  39. simtools/model/model_parameter.py +123 -73
  40. simtools/model/model_utils.py +40 -1
  41. simtools/model/site_model.py +4 -4
  42. simtools/model/telescope_model.py +4 -5
  43. simtools/ray_tracing/incident_angles.py +87 -6
  44. simtools/ray_tracing/mirror_panel_psf.py +337 -217
  45. simtools/ray_tracing/psf_analysis.py +57 -42
  46. simtools/ray_tracing/psf_parameter_optimisation.py +3 -2
  47. simtools/ray_tracing/ray_tracing.py +37 -10
  48. simtools/runners/corsika_runner.py +52 -191
  49. simtools/runners/corsika_simtel_runner.py +74 -100
  50. simtools/runners/runner_services.py +214 -213
  51. simtools/runners/simtel_runner.py +27 -155
  52. simtools/runners/simtools_runner.py +9 -69
  53. simtools/schemas/application_workflow.metaschema.yml +8 -0
  54. simtools/settings.py +19 -0
  55. simtools/simtel/simtel_config_writer.py +0 -55
  56. simtools/simtel/simtel_seeds.py +184 -0
  57. simtools/simtel/simulator_array.py +115 -103
  58. simtools/simtel/simulator_camera_efficiency.py +66 -42
  59. simtools/simtel/simulator_light_emission.py +110 -123
  60. simtools/simtel/simulator_ray_tracing.py +78 -63
  61. simtools/simulator.py +135 -346
  62. simtools/testing/sim_telarray_metadata.py +13 -11
  63. simtools/testing/validate_output.py +87 -19
  64. simtools/utils/general.py +6 -17
  65. simtools/utils/random.py +36 -0
  66. simtools/visualization/plot_corsika_histograms.py +2 -0
  67. simtools/visualization/plot_incident_angles.py +48 -1
  68. simtools/visualization/plot_psf.py +160 -18
  69. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/licenses/LICENSE +0 -0
  70. {gammasimtools-0.26.0.dist-info → gammasimtools-0.27.1.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,10 @@
1
1
  """Simulation runner for array simulations."""
2
2
 
3
- import logging
4
- import stat
3
+ from pathlib import Path
5
4
 
6
5
  from simtools import settings
7
6
  from simtools.io import io_handler
8
- from simtools.runners.simtel_runner import InvalidOutputFileError, SimtelRunner
9
- from simtools.utils.general import clear_default_sim_telarray_cfg_directories
7
+ from simtools.runners.simtel_runner import SimtelRunner, sim_telarray_env_as_string
10
8
 
11
9
 
12
10
  class SimulatorArray(SimtelRunner):
@@ -21,60 +19,42 @@ class SimulatorArray(SimtelRunner):
21
19
  Instance label.
22
20
  use_multipipe: bool
23
21
  Use multipipe to run CORSIKA and sim_telarray.
24
- sim_telarray_seeds: dict
25
- Dictionary with configuration for sim_telarray random instrument setup.
22
+ is_calibration_run: bool
23
+ Flag to indicate if this is a calibration run.
26
24
  """
27
25
 
28
26
  def __init__(
29
27
  self,
30
28
  corsika_config,
31
29
  label=None,
32
- use_multipipe=False,
33
- sim_telarray_seeds=None,
34
- calibration_config=None,
30
+ is_calibration_run=False,
35
31
  ):
36
32
  """Initialize SimulatorArray."""
37
- self._logger = logging.getLogger(__name__)
38
- self._logger.debug("Init SimulatorArray")
39
- super().__init__(
40
- label=label,
41
- corsika_config=corsika_config,
42
- use_multipipe=use_multipipe,
43
- calibration_run_mode=calibration_config.get("run_mode") if calibration_config else None,
44
- )
33
+ super().__init__(label=label, config=corsika_config, is_calibration_run=is_calibration_run)
45
34
 
46
- self.sim_telarray_seeds = sim_telarray_seeds
47
35
  self.corsika_config = corsika_config
48
- self.calibration_config = calibration_config
36
+ self.is_calibration_run = is_calibration_run
49
37
  self.io_handler = io_handler.IOHandler()
50
38
  self._log_file = None
51
39
 
52
- def prepare_run_script(self, test=False, input_file=None, run_number=None, extra_commands=None):
40
+ def prepare_run(self, run_number=None, sub_script=None, corsika_file=None, extra_commands=None):
53
41
  """
54
42
  Build and return the full path of the bash run script containing the sim_telarray command.
55
43
 
56
44
  Parameters
57
45
  ----------
58
- test: bool
59
- Test flag for faster execution.
60
- input_file: str or Path
61
- Full path of the input CORSIKA file.
62
46
  run_number: int
63
47
  Run number.
48
+ corsika_file: str or Path
49
+ Full path of the input CORSIKA file.
64
50
  extra_commands: list[str]
65
51
  Additional commands for running simulations given in config.yml.
66
-
67
- Returns
68
- -------
69
- Path
70
- Full path of the run script.
71
52
  """
72
- script_file_path = self.get_file_name(file_type="sub_script", run_number=run_number)
73
- self._logger.debug(f"Run bash script - {script_file_path}")
53
+ command = self.make_run_command(run_number=run_number, input_file=corsika_file)
54
+ sub_script = Path(sub_script)
55
+ self._logger.debug(f"Run bash script - {sub_script}")
74
56
  self._logger.debug(f"Extra commands to be added to the run script {extra_commands}")
75
-
76
- command = self.make_run_command(run_number=run_number, input_file=input_file)
77
- with script_file_path.open("w", encoding="utf-8") as file:
57
+ with sub_script.open("w", encoding="utf-8") as file:
78
58
  file.write("#!/usr/bin/env bash\n\n")
79
59
  file.write("set -e\n")
80
60
  file.write("set -o pipefail\n")
@@ -86,16 +66,12 @@ class SimulatorArray(SimtelRunner):
86
66
  file.write(f"{line}\n")
87
67
  file.write("# End of extras\n\n")
88
68
 
89
- n = 1 if test else self.runs_per_set
90
- for _ in range(n):
91
- file.write(f"{command}\n\n")
69
+ for _ in range(self.runs_per_set):
70
+ file.write(f"{sim_telarray_env_as_string()} " + " ".join(command) + "\n")
92
71
 
93
72
  file.write('\necho "RUNTIME: $SECONDS"\n')
94
73
 
95
- script_file_path.chmod(script_file_path.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP)
96
- return script_file_path
97
-
98
- def make_run_command(self, run_number=None, input_file=None, weak_pointing=None):
74
+ def make_run_command(self, run_number=None, input_file=None):
99
75
  """
100
76
  Build and return the command to run sim_telarray.
101
77
 
@@ -105,26 +81,22 @@ class SimulatorArray(SimtelRunner):
105
81
  Full path of the input CORSIKA file
106
82
  run_number: int (optional)
107
83
  run number
108
- weak_pointing: bool (optional)
109
- Specify weak pointing option for sim_telarray.
110
84
 
111
85
  Returns
112
86
  -------
113
- str
87
+ list
114
88
  Command to run sim_telarray.
115
89
  """
116
- command = self._common_run_command(run_number, weak_pointing)
90
+ self.file_list = self.runner_service.load_files(run_number=run_number)
91
+ command = self._common_run_command(run_number)
117
92
 
118
- if self.calibration_config:
93
+ if self.is_calibration_run:
119
94
  command += self._make_run_command_for_calibration_simulations()
120
95
  else:
121
96
  command += self._make_run_command_for_shower_simulations()
122
97
 
123
98
  # "-C show=all" should be the last option
124
- command += super().get_config_option("show", "all")
125
- command += f" {input_file} | gzip > {self._log_file} 2>&1 || exit"
126
-
127
- return clear_default_sim_telarray_cfg_directories(command)
99
+ return [*command, "-C", "show=all", input_file]
128
100
 
129
101
  def _make_run_command_for_shower_simulations(self):
130
102
  """
@@ -135,80 +107,117 @@ class SimulatorArray(SimtelRunner):
135
107
  str
136
108
  Command to run sim_telarray.
137
109
  """
138
- return super().get_config_option(
139
- "power_law",
140
- SimulatorArray.get_power_law_for_sim_telarray_histograms(
141
- self.corsika_config.primary_particle
142
- ),
143
- )
110
+ return [
111
+ "-C",
112
+ "power_law="
113
+ f"{
114
+ SimulatorArray.get_power_law_for_sim_telarray_histograms(
115
+ self.corsika_config.primary_particle
116
+ )
117
+ }",
118
+ ]
144
119
 
145
120
  def _make_run_command_for_calibration_simulations(self):
146
121
  """Build sim_telarray command for calibration simulations."""
147
- cfg = self.calibration_config
122
+ cfg = settings.config.args
148
123
  altitude = self.corsika_config.array_model.site_model.get_parameter_value_with_unit(
149
124
  "reference_point_altitude"
150
125
  ).to_value("m")
151
126
 
152
- command = super().get_config_option("Altitude", altitude)
153
-
127
+ options = {"Altitude": altitude}
154
128
  for key in ("nsb_scaling_factor", "stars"):
155
- if cfg.get(key):
156
- command += super().get_config_option(key, cfg[key])
129
+ if key in cfg:
130
+ options[key] = cfg[key]
157
131
 
158
132
  run_mode = cfg.get("run_mode")
159
133
  if run_mode in ("pedestals", "pedestals_nsb_only"):
160
134
  n_events = cfg.get("number_of_pedestal_events", cfg["number_of_events"])
161
- command += super().get_config_option("pedestal_events", n_events)
135
+ options["pedestal_events"] = n_events
162
136
  if run_mode == "pedestals_nsb_only":
163
- command += self._pedestals_nsb_only_command()
137
+ options.update(self._pedestals_nsb_only_options())
164
138
  if run_mode == "pedestals_dark":
165
139
  n_events = cfg.get("number_of_dark_events", cfg["number_of_events"])
166
- command += super().get_config_option("dark_events", n_events)
140
+ options["dark_events"] = n_events
167
141
  if run_mode == "direct_injection":
168
142
  n_events = cfg.get("number_of_flasher_events", cfg["number_of_events"])
169
- command += super().get_config_option("laser_events", n_events)
143
+ options["laser_events"] = n_events
170
144
 
171
- return command
145
+ cmd = []
146
+ for key, value in options.items():
147
+ cmd.extend(["-C", f"{key}={value}"])
148
+ return cmd
172
149
 
173
- def _common_run_command(self, run_number, weak_pointing=None):
150
+ def _common_run_command(self, run_number):
174
151
  """Build generic run command for sim_telarray."""
152
+ weak_pointing = self._determine_pointing_option()
175
153
  config_dir = self.corsika_config.array_model.get_config_directory()
176
- self._log_file = self.get_file_name(file_type="log", run_number=run_number)
177
- histogram_file = self.get_file_name(file_type="histogram", run_number=run_number)
178
- output_file = self.get_file_name(file_type="simtel_output", run_number=run_number)
179
- self.corsika_config.array_model.export_all_simtel_config_files()
180
-
181
- command = str(settings.config.sim_telarray_exe)
182
- command += f" -c {self.corsika_config.array_model.config_file_path}"
183
- command += f" -I{config_dir}"
184
- command += super().get_config_option(
185
- "telescope_theta", self.corsika_config.zenith_angle, weak_pointing
154
+ self._log_file = self.runner_service.get_file_name(
155
+ file_type="sim_telarray_log", run_number=run_number
186
156
  )
187
- command += super().get_config_option(
188
- "telescope_phi", self.corsika_config.azimuth_angle, weak_pointing
157
+ histogram_file = self.runner_service.get_file_name(
158
+ file_type="sim_telarray_histogram", run_number=run_number
189
159
  )
190
- command += super().get_config_option("histogram_file", histogram_file)
191
- command += super().get_config_option("random_state", "none")
192
- if self.sim_telarray_seeds and self.sim_telarray_seeds.get("random_instrument_instances"):
193
- command += super().get_config_option(
194
- "random_seed",
195
- f"file-by-run:{config_dir}/{self.sim_telarray_seeds['seed_file_name']},auto",
196
- )
197
- elif self.sim_telarray_seeds and self.sim_telarray_seeds.get("seed"):
198
- command += super().get_config_option("random_seed", self.sim_telarray_seeds["seed"])
199
- command += super().get_config_option("output_file", output_file)
200
-
201
- return command
202
-
203
- def _pedestals_nsb_only_command(self):
160
+ output_file = self.runner_service.get_file_name(
161
+ file_type="sim_telarray_output", run_number=run_number
162
+ )
163
+ self.corsika_config.array_model.export_all_simtel_config_files()
164
+
165
+ cmd = [
166
+ str(settings.config.sim_telarray_exe),
167
+ "-c",
168
+ str(self.corsika_config.array_model.config_file_path),
169
+ f"-I{config_dir}",
170
+ ]
171
+ weak_options = {
172
+ "telescope_theta": self.corsika_config.zenith_angle,
173
+ "telescope_phi": self.corsika_config.azimuth_angle,
174
+ }
175
+ options = {
176
+ "histogram_file": histogram_file,
177
+ "random_state": "none",
178
+ "output_file": output_file,
179
+ }
180
+
181
+ try:
182
+ options["random_seed"] = self.corsika_config.array_model.sim_telarray_seed.seed_string
183
+ except AttributeError as exc:
184
+ raise AttributeError("Error setting sim_telarray seed string") from exc
185
+
186
+ for key, value in options.items():
187
+ cmd.extend(["-C", f"{key}={value}"])
188
+ for key, value in weak_options.items():
189
+ cmd.extend([("-W" if weak_pointing else "-C"), f"{key}={value}"])
190
+ return cmd
191
+
192
+ def _determine_pointing_option(self):
204
193
  """
205
- Generate the command to run sim_telarray for nsb-only pedestal simulations.
194
+ Determine the pointing option for sim_telarray.
195
+
196
+ Parameters
197
+ ----------
198
+ label: str
199
+ Label of the simulation.
206
200
 
207
201
  Returns
208
202
  -------
209
- str
203
+ bool:
204
+ True if weak pointing is to be used.
205
+ """
206
+ if isinstance(self.label, str):
207
+ return any(pointing in self.label for pointing in ["divergent", "convergent"])
208
+ return False
209
+
210
+ def _pedestals_nsb_only_options(self):
211
+ """
212
+ Generate options to run sim_telarray for nsb-only pedestal simulations.
213
+
214
+ Returns
215
+ -------
216
+ dict
210
217
  Command to run sim_telarray.
211
218
  """
219
+ options = {}
220
+
212
221
  null_values = [
213
222
  "fadc_noise",
214
223
  "fadc_lg_noise",
@@ -219,8 +228,8 @@ class SimulatorArray(SimtelRunner):
219
228
  "fadc_sysvar_pedestal",
220
229
  "fadc_dev_pedestal",
221
230
  ]
222
- null_command_parts = [super().get_config_option(param, 0.0) for param in null_values]
223
- command = " ".join(null_command_parts)
231
+ for param in null_values:
232
+ options[param] = 0.0
224
233
 
225
234
  one_values = [
226
235
  "fadc_lg_var_pedestal",
@@ -228,9 +237,10 @@ class SimulatorArray(SimtelRunner):
228
237
  "fadc_lg_dev_pedestal",
229
238
  "fadc_lg_sysvar_pedestal",
230
239
  ]
231
- one_command_parts = [super().get_config_option(param, -1.0) for param in one_values]
232
- command += " " + " ".join(one_command_parts)
233
- return command
240
+ for param in one_values:
241
+ options[param] = -1.0
242
+
243
+ return options
234
244
 
235
245
  def _check_run_result(self, run_number=None):
236
246
  """
@@ -248,12 +258,14 @@ class SimulatorArray(SimtelRunner):
248
258
 
249
259
  Raises
250
260
  ------
251
- InvalidOutputFileError
261
+ FileNotFoundError
252
262
  If sim_telarray output file does not exist.
253
263
  """
254
- output_file = self.get_file_name(file_type="simtel_output", run_number=run_number)
264
+ output_file = self.runner_service.get_file_name(
265
+ file_type="simtel_output", run_number=run_number
266
+ )
255
267
  if not output_file.exists():
256
- raise InvalidOutputFileError(f"sim_telarray output file {output_file} does not exist.")
268
+ raise FileNotFoundError(f"sim_telarray output file {output_file} does not exist.")
257
269
  self._logger.debug(f"sim_telarray output file {output_file} exists.")
258
270
  return True
259
271
 
@@ -6,7 +6,6 @@ from pathlib import Path
6
6
  from simtools import settings
7
7
  from simtools.io import ascii_handler
8
8
  from simtools.runners.simtel_runner import SimtelRunner
9
- from simtools.utils import general
10
9
 
11
10
 
12
11
  class SimulatorCameraEfficiency(SimtelRunner):
@@ -25,6 +24,8 @@ class SimulatorCameraEfficiency(SimtelRunner):
25
24
  Location of the sim_telarray testeff tool output file.
26
25
  zenith_angle: float
27
26
  Zenith angle given in the config to CameraEfficiency.
27
+ x_max: float
28
+ Maximum depth of shower development in g/cm2.
28
29
  nsb_spectrum: str or Path
29
30
  Path to the nsb spectrum file.
30
31
  skip_correction_to_nsb_spectrum: bool
@@ -39,10 +40,11 @@ class SimulatorCameraEfficiency(SimtelRunner):
39
40
  file_simtel=None,
40
41
  file_log=None,
41
42
  zenith_angle=None,
43
+ x_max=None,
42
44
  nsb_spectrum=None,
43
45
  skip_correction_to_nsb_spectrum=False,
44
46
  ):
45
- """Initialize SimtelRunner."""
47
+ """Camera efficiency simulator initialization."""
46
48
  self._logger = logging.getLogger(__name__)
47
49
  self._logger.debug("Init SimulatorCameraEfficiency")
48
50
 
@@ -55,6 +57,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
55
57
  self._file_simtel = file_simtel
56
58
  self._file_log = file_log
57
59
  self.zenith_angle = zenith_angle
60
+ self.x_max = x_max
58
61
  self.nsb_spectrum = nsb_spectrum
59
62
  self.skip_correction_to_nsb_spectrum = skip_correction_to_nsb_spectrum
60
63
 
@@ -74,7 +77,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
74
77
  / Path(self._site_model.get_parameter_value("nsb_reference_spectrum")).name
75
78
  )
76
79
 
77
- def _make_run_command(self, run_number=None, input_file=None): # pylint: disable=unused-argument
80
+ def make_run_command(self, run_number=None, input_file=None): # pylint: disable=unused-argument
78
81
  """Prepare the command used to run testeff."""
79
82
  self._logger.debug("Preparing the command to run testeff")
80
83
 
@@ -107,52 +110,73 @@ class SimulatorCameraEfficiency(SimtelRunner):
107
110
  "mirror_reflectivity", "secondary_mirror_incidence_angle"
108
111
  )
109
112
 
110
- command = str(settings.config.sim_telarray_path / "bin/testeff")
113
+ cmd = [str(settings.config.sim_telarray_path / "bin/testeff")]
114
+
111
115
  if self.skip_correction_to_nsb_spectrum:
112
- command += " -nc" # Do not apply correction to original altitude where B&E was derived
113
- command += " -I" # Clear the fall-back configuration directories
114
- command += f" -I{self._telescope_model.config_file_directory}"
115
- if self.nsb_spectrum is not None:
116
- command += f" -fnsb {self.nsb_spectrum}"
117
- command += " -nm -nsb-extra"
118
- command += f" -alt {self._site_model.get_parameter_value('corsika_observation_level')}"
119
- command += f" -fatm {self._site_model.get_parameter_value('atmospheric_transmission')}"
120
- command += f" -flen {focal_length}"
121
- command += f" -fcur {curvature_radius:.3f}"
122
- command += f" {pixel_shape_cmd} {pixel_diameter}"
123
- if mirror_class == 0:
124
- command += f" -fmir {self._telescope_model.get_parameter_value('mirror_list')}"
125
- if mirror_class == 2:
126
- command += f" -fmir {self._telescope_model.get_parameter_value('fake_mirror_list')}"
127
- command += f" -fref {mirror_reflectivity}"
128
- if mirror_class == 2:
129
- command += " -m2"
130
- command += f" -fref2 {mirror_reflectivity_secondary}"
131
- command += " -teltrans "
132
- command += f"{self._telescope_model.get_parameter_value('telescope_transmission')[0]}"
133
- command += f" -camtrans {camera_transmission}"
134
- command += f" -fflt {camera_filter_file}"
135
- command += (
136
- f" -fang {self._telescope_model.camera.get_lightguide_efficiency_angle_file_name()}"
116
+ cmd.append("-nc")
117
+
118
+ cmd.extend(
119
+ [
120
+ "-I",
121
+ f"-I{self._telescope_model.config_file_directory}",
122
+ ]
137
123
  )
138
- command += (
139
- f" -fwl {self._telescope_model.camera.get_lightguide_efficiency_wavelength_file_name()}"
124
+
125
+ if self.nsb_spectrum is not None:
126
+ cmd.extend(["-fnsb", str(self.nsb_spectrum)])
127
+
128
+ cmd.extend(
129
+ [
130
+ "-nm",
131
+ "-nsb-extra",
132
+ "-alt",
133
+ str(self._site_model.get_parameter_value("corsika_observation_level")),
134
+ "-fatm",
135
+ str(self._site_model.get_parameter_value("atmospheric_transmission")),
136
+ "-flen",
137
+ str(focal_length),
138
+ "-fcur",
139
+ f"{curvature_radius:.3f}",
140
+ pixel_shape_cmd,
141
+ str(pixel_diameter),
142
+ ]
140
143
  )
141
- command += f" -fqe {self._telescope_model.get_parameter_value('quantum_efficiency')}"
142
- command += " 200 1000" # lmin and lmax
143
- command += " 300" # Xmax
144
- command += f" {self._site_model.get_parameter_value('atmospheric_profile')}"
145
- command += f" {self.zenith_angle}"
146
144
 
147
- # Remove the default sim_telarray configuration directories
148
- command = general.clear_default_sim_telarray_cfg_directories(command)
145
+ if mirror_class == 0:
146
+ cmd.extend(["-fmir", self._telescope_model.get_parameter_value("mirror_list")])
147
+ elif mirror_class == 2:
148
+ cmd.extend(["-fmir", self._telescope_model.get_parameter_value("fake_mirror_list")])
149
149
 
150
- return (
151
- f"cd {settings.config.sim_telarray_path} && {command}",
152
- self._file_simtel,
153
- self._file_log,
150
+ cmd.extend(["-fref", mirror_reflectivity])
151
+
152
+ if mirror_class == 2:
153
+ cmd.append("-m2")
154
+ cmd.extend(["-fref2", mirror_reflectivity_secondary])
155
+
156
+ cmd.extend(
157
+ [
158
+ "-teltrans",
159
+ str(self._telescope_model.get_parameter_value("telescope_transmission")[0]),
160
+ "-camtrans",
161
+ str(camera_transmission),
162
+ "-fflt",
163
+ camera_filter_file,
164
+ "-fang",
165
+ self._telescope_model.camera.get_lightguide_efficiency_angle_file_name(),
166
+ "-fwl",
167
+ self._telescope_model.camera.get_lightguide_efficiency_wavelength_file_name(),
168
+ "-fqe",
169
+ str(self._telescope_model.get_parameter_value("quantum_efficiency")),
170
+ "200", # lmin
171
+ "1000", # lmax
172
+ f"{self.x_max:.1f}" if self.x_max is not None else "300",
173
+ str(self._site_model.get_parameter_value("atmospheric_profile")),
174
+ str(self.zenith_angle),
175
+ ]
154
176
  )
155
177
 
178
+ return cmd, self._file_simtel, self._file_log
179
+
156
180
  def _check_run_result(self, run_number=None): # pylint: disable=unused-argument
157
181
  """Check run results.
158
182