gammasimtools 0.15.0__py3-none-any.whl → 0.17.0__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.
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/METADATA +5 -33
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/RECORD +243 -229
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/entry_points.txt +8 -3
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +10 -10
- simtools/applications/convert_all_model_parameters_from_simtel.py +16 -16
- simtools/applications/convert_model_parameter_from_simtel.py +1 -1
- simtools/applications/derive_ctao_array_layouts.py +5 -5
- simtools/applications/derive_psf_parameters.py +12 -9
- simtools/applications/docs_produce_array_element_report.py +3 -3
- simtools/applications/docs_produce_calibration_reports.py +49 -0
- simtools/applications/docs_produce_simulation_configuration_report.py +50 -0
- simtools/applications/{generate_simtel_array_histograms.py → generate_sim_telarray_histograms.py} +2 -2
- simtools/applications/generate_simtel_event_data.py +36 -46
- simtools/applications/merge_tables.py +104 -0
- simtools/applications/plot_array_layout.py +145 -258
- simtools/applications/production_derive_corsika_limits.py +35 -167
- simtools/applications/production_derive_statistics.py +159 -0
- simtools/applications/production_generate_grid.py +197 -0
- simtools/applications/simulate_light_emission.py +6 -13
- simtools/applications/simulate_prod.py +45 -21
- simtools/applications/simulate_prod_htcondor_generator.py +0 -1
- simtools/applications/submit_array_layouts.py +93 -0
- simtools/applications/validate_cumulative_psf.py +6 -4
- simtools/applications/validate_file_using_schema.py +7 -3
- simtools/applications/validate_optics.py +5 -4
- simtools/applications/verify_simulation_model_production_tables.py +52 -0
- simtools/camera/camera_efficiency.py +17 -42
- simtools/configuration/commandline_parser.py +32 -37
- simtools/configuration/configurator.py +10 -4
- simtools/corsika/corsika_config.py +120 -17
- simtools/corsika/primary_particle.py +46 -13
- simtools/data_model/format_checkers.py +9 -0
- simtools/data_model/metadata_collector.py +7 -3
- simtools/data_model/model_data_writer.py +3 -0
- simtools/data_model/schema.py +27 -16
- simtools/data_model/validate_data.py +27 -7
- simtools/db/db_handler.py +21 -15
- simtools/db/db_model_upload.py +2 -2
- simtools/io_operations/io_handler.py +2 -2
- simtools/io_operations/io_table_handler.py +345 -0
- simtools/job_execution/htcondor_script_generator.py +2 -2
- simtools/job_execution/job_manager.py +7 -121
- simtools/layout/array_layout.py +1 -0
- simtools/layout/array_layout_utils.py +385 -0
- simtools/model/array_model.py +68 -29
- simtools/model/model_parameter.py +76 -51
- simtools/model/model_repository.py +134 -0
- simtools/model/model_utils.py +43 -1
- simtools/model/site_model.py +3 -2
- simtools/model/telescope_model.py +4 -4
- simtools/production_configuration/{calculate_statistical_errors_grid_point.py → calculate_statistical_uncertainties_grid_point.py} +101 -116
- simtools/production_configuration/derive_corsika_limits.py +239 -111
- simtools/production_configuration/derive_corsika_limits_grid.py +189 -0
- simtools/production_configuration/derive_production_statistics.py +155 -0
- simtools/production_configuration/derive_production_statistics_handler.py +152 -0
- simtools/production_configuration/generate_production_grid.py +364 -0
- simtools/production_configuration/interpolation_handler.py +303 -96
- simtools/ray_tracing/mirror_panel_psf.py +16 -20
- simtools/ray_tracing/psf_analysis.py +2 -2
- simtools/ray_tracing/ray_tracing.py +12 -7
- simtools/reporting/docs_read_parameters.py +426 -81
- simtools/runners/corsika_runner.py +11 -1
- simtools/runners/corsika_simtel_runner.py +84 -90
- simtools/runners/runner_services.py +22 -8
- simtools/runners/simtel_runner.py +27 -10
- simtools/schemas/model_parameter.metaschema.yml +4 -0
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +1 -0
- simtools/schemas/model_parameters/adjust_gain.schema.yml +2 -2
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +2 -2
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +2 -2
- simtools/schemas/model_parameters/array_window.schema.yml +2 -2
- simtools/schemas/model_parameters/asum_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/asum_shaping.schema.yml +2 -2
- simtools/schemas/model_parameters/asum_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/axes_offsets.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_config_file.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_depth.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_filter.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_pixels.schema.yml +2 -2
- simtools/schemas/model_parameters/camera_transmission.schema.yml +2 -2
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +2 -2
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +2 -2
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +90 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +2 -2
- simtools/schemas/model_parameters/design_model.schema.yml +2 -2
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +2 -2
- simtools/schemas/model_parameters/disc_bins.schema.yml +2 -2
- simtools/schemas/model_parameters/disc_start.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +44 -3
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +2 -2
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_bins.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_noise.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +2 -2
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +2 -2
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +2 -2
- simtools/schemas/model_parameters/focal_length.schema.yml +2 -2
- simtools/schemas/model_parameters/focus_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/gain_variation.schema.yml +2 -2
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +2 -2
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +2 -2
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +2 -2
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +2 -2
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +2 -2
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +2 -2
- simtools/schemas/model_parameters/min_photons.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_class.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_list.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +2 -2
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +2 -2
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +2 -2
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +2 -2
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +2 -2
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +2 -2
- simtools/schemas/model_parameters/num_gains.schema.yml +2 -2
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +2 -2
- simtools/schemas/model_parameters/optics_properties.schema.yml +2 -2
- simtools/schemas/model_parameters/pedestal_events.schema.yml +7 -3
- simtools/schemas/model_parameters/photon_delay.schema.yml +2 -2
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +2 -2
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +2 -2
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +2 -2
- simtools/schemas/model_parameters/qe_variation.schema.yml +2 -2
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +2 -2
- simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -2
- simtools/schemas/model_parameters/random_generator.schema.yml +2 -2
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +2 -2
- simtools/schemas/model_parameters/sampled_output.schema.yml +2 -2
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +2 -2
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +2 -2
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +2 -2
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +2 -2
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +2 -2
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +2 -2
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +2 -2
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +2 -2
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +2 -2
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +2 -2
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +2 -2
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +2 -2
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +2 -2
- simtools/schemas/model_parameters/transit_time_error.schema.yml +2 -2
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +2 -2
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +2 -2
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +2 -2
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +2 -2
- simtools/schemas/production_configuration_metrics.schema.yml +2 -2
- simtools/simtel/simtel_config_reader.py +21 -17
- simtools/simtel/simtel_config_writer.py +258 -66
- simtools/simtel/simtel_io_event_reader.py +301 -194
- simtools/simtel/simtel_io_event_writer.py +207 -227
- simtools/simtel/simtel_io_file_info.py +62 -0
- simtools/simtel/simtel_io_histogram.py +10 -14
- simtools/simtel/simtel_io_histograms.py +2 -2
- simtools/simtel/simtel_io_metadata.py +106 -0
- simtools/simtel/simulator_array.py +28 -14
- simtools/simtel/simulator_camera_efficiency.py +12 -6
- simtools/simtel/simulator_light_emission.py +85 -45
- simtools/simtel/simulator_ray_tracing.py +16 -6
- simtools/simulator.py +286 -89
- simtools/testing/configuration.py +5 -0
- simtools/testing/helpers.py +18 -0
- simtools/testing/sim_telarray_metadata.py +212 -0
- simtools/testing/validate_output.py +16 -6
- simtools/utils/general.py +18 -27
- simtools/utils/names.py +32 -10
- simtools/visualization/plot_array_layout.py +242 -0
- simtools/visualization/plot_pixels.py +681 -0
- simtools/visualization/visualize.py +5 -221
- simtools/applications/production_generate_simulation_config.py +0 -162
- simtools/applications/production_scale_events.py +0 -185
- simtools/layout/ctao_array_layouts.py +0 -172
- simtools/production_configuration/event_scaler.py +0 -120
- simtools/production_configuration/generate_simulation_config.py +0 -158
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.15.0.dist-info → gammasimtools-0.17.0.dist-info}/top_level.txt +0 -0
|
@@ -221,7 +221,12 @@ class CorsikaRunner:
|
|
|
221
221
|
return cmd
|
|
222
222
|
|
|
223
223
|
def get_file_name(
|
|
224
|
-
self,
|
|
224
|
+
self,
|
|
225
|
+
simulation_software="corsika",
|
|
226
|
+
file_type=None,
|
|
227
|
+
run_number=None,
|
|
228
|
+
mode="",
|
|
229
|
+
model_version_index=0,
|
|
225
230
|
):
|
|
226
231
|
"""
|
|
227
232
|
Get the full path of a file for a given run number.
|
|
@@ -234,6 +239,10 @@ class CorsikaRunner:
|
|
|
234
239
|
File type.
|
|
235
240
|
run_number: int
|
|
236
241
|
Run number.
|
|
242
|
+
model_version_index: int
|
|
243
|
+
Index of the model version.
|
|
244
|
+
This is used to select the correct simulator_array instance in case
|
|
245
|
+
multiple array models are simulated.
|
|
237
246
|
|
|
238
247
|
Returns
|
|
239
248
|
-------
|
|
@@ -248,4 +257,5 @@ class CorsikaRunner:
|
|
|
248
257
|
file_type=file_type,
|
|
249
258
|
run_number=run_number,
|
|
250
259
|
mode=mode,
|
|
260
|
+
_model_version_index=model_version_index,
|
|
251
261
|
)
|
|
@@ -6,7 +6,6 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from simtools.runners.corsika_runner import CorsikaRunner
|
|
8
8
|
from simtools.simtel.simulator_array import SimulatorArray
|
|
9
|
-
from simtools.utils.general import clear_default_sim_telarray_cfg_directories
|
|
10
9
|
|
|
11
10
|
__all__ = ["CorsikaSimtelRunner"]
|
|
12
11
|
|
|
@@ -20,8 +19,9 @@ class CorsikaSimtelRunner:
|
|
|
20
19
|
|
|
21
20
|
Parameters
|
|
22
21
|
----------
|
|
23
|
-
corsika_config : CorsikaConfig
|
|
24
|
-
|
|
22
|
+
corsika_config : CorsikaConfig or list of CorsikaConfig
|
|
23
|
+
A list of "CorsikaConfig" instances which
|
|
24
|
+
contain the CORSIKA configuration parameters.
|
|
25
25
|
simtel_path : str or Path
|
|
26
26
|
Location of the sim_telarray package.
|
|
27
27
|
label : str
|
|
@@ -30,6 +30,8 @@ class CorsikaSimtelRunner:
|
|
|
30
30
|
Use seeds based on run number and primary particle. If False, use sim_telarray seeds.
|
|
31
31
|
use_multipipe : bool
|
|
32
32
|
Use multipipe to run CORSIKA and sim_telarray.
|
|
33
|
+
sim_telarray_seeds : dict
|
|
34
|
+
Dictionary with configuration for sim_telarray random instrument setup.
|
|
33
35
|
"""
|
|
34
36
|
|
|
35
37
|
def __init__(
|
|
@@ -40,28 +42,41 @@ class CorsikaSimtelRunner:
|
|
|
40
42
|
keep_seeds=False,
|
|
41
43
|
use_multipipe=False,
|
|
42
44
|
sim_telarray_seeds=None,
|
|
45
|
+
sequential=False,
|
|
43
46
|
):
|
|
44
47
|
self._logger = logging.getLogger(__name__)
|
|
45
|
-
self.corsika_config =
|
|
48
|
+
self.corsika_config = (
|
|
49
|
+
corsika_config if isinstance(corsika_config, list) else [corsika_config]
|
|
50
|
+
)
|
|
51
|
+
# the base corsika config is the one used to define the CORSIKA specific parameters.
|
|
52
|
+
# The others are used for the array configurations.
|
|
53
|
+
self.base_corsika_config = self.corsika_config[0]
|
|
46
54
|
self._simtel_path = simtel_path
|
|
47
55
|
self.sim_telarray_seeds = sim_telarray_seeds
|
|
48
56
|
self.label = label
|
|
57
|
+
self.sequential = "--sequential" if sequential else ""
|
|
49
58
|
|
|
50
|
-
self.
|
|
59
|
+
self.base_corsika_config.set_output_file_and_directory(use_multipipe)
|
|
51
60
|
self.corsika_runner = CorsikaRunner(
|
|
52
|
-
corsika_config=
|
|
61
|
+
corsika_config=self.base_corsika_config,
|
|
53
62
|
simtel_path=simtel_path,
|
|
54
63
|
label=label,
|
|
55
64
|
keep_seeds=keep_seeds,
|
|
56
65
|
use_multipipe=use_multipipe,
|
|
57
66
|
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
# The simulator array should be defined for every CORSIKA configuration
|
|
68
|
+
# because it allows to define multiple sim_telarray instances
|
|
69
|
+
self.simulator_array = []
|
|
70
|
+
for _corsika_config in self.corsika_config:
|
|
71
|
+
self.simulator_array.append(
|
|
72
|
+
SimulatorArray(
|
|
73
|
+
corsika_config=_corsika_config,
|
|
74
|
+
simtel_path=simtel_path,
|
|
75
|
+
label=label,
|
|
76
|
+
use_multipipe=use_multipipe,
|
|
77
|
+
sim_telarray_seeds=sim_telarray_seeds,
|
|
78
|
+
)
|
|
79
|
+
)
|
|
65
80
|
|
|
66
81
|
def prepare_run_script(
|
|
67
82
|
self, run_number=None, input_file=None, extra_commands=None, use_pfp=False
|
|
@@ -103,18 +118,43 @@ class CorsikaSimtelRunner:
|
|
|
103
118
|
Path:
|
|
104
119
|
Full path of the run script file.
|
|
105
120
|
"""
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
input_file="-", # instruct sim_telarray to take input from standard output
|
|
109
|
-
)
|
|
110
|
-
multipipe_file = Path(self.corsika_config.config_file_path.parent).joinpath(
|
|
111
|
-
self.corsika_config.get_corsika_config_file_name("multipipe")
|
|
121
|
+
multipipe_file = Path(self.base_corsika_config.config_file_path.parent).joinpath(
|
|
122
|
+
self.base_corsika_config.get_corsika_config_file_name("multipipe")
|
|
112
123
|
)
|
|
124
|
+
|
|
113
125
|
with open(multipipe_file, "w", encoding="utf-8") as file:
|
|
114
|
-
|
|
126
|
+
for simulator_array in self.simulator_array:
|
|
127
|
+
run_command = simulator_array.make_run_command(
|
|
128
|
+
run_number=run_number,
|
|
129
|
+
input_file="-", # instruct sim_telarray to take input from standard output
|
|
130
|
+
weak_pointing=self._determine_pointing_option(self.label),
|
|
131
|
+
)
|
|
132
|
+
file.write(f"{run_command}")
|
|
133
|
+
file.write("\n")
|
|
115
134
|
self._logger.info(f"Multipipe script: {multipipe_file}")
|
|
116
135
|
self._write_multipipe_script(multipipe_file)
|
|
117
136
|
|
|
137
|
+
@staticmethod
|
|
138
|
+
def _determine_pointing_option(label):
|
|
139
|
+
"""
|
|
140
|
+
Determine the pointing option for sim_telarray.
|
|
141
|
+
|
|
142
|
+
Parameters
|
|
143
|
+
----------
|
|
144
|
+
label: str
|
|
145
|
+
Label of the simulation.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
str:
|
|
150
|
+
Pointing option.
|
|
151
|
+
"""
|
|
152
|
+
try:
|
|
153
|
+
return any(pointing in label for pointing in ["divergent", "convergent"])
|
|
154
|
+
except TypeError: # allow for pointing_option to be None
|
|
155
|
+
pass
|
|
156
|
+
return False
|
|
157
|
+
|
|
118
158
|
def _write_multipipe_script(self, multipipe_file):
|
|
119
159
|
"""
|
|
120
160
|
Write script used to call the multipipe_corsika command.
|
|
@@ -124,82 +164,26 @@ class CorsikaSimtelRunner:
|
|
|
124
164
|
multipipe_file: str or Path
|
|
125
165
|
The name of the multipipe file which contains all of the multipipe commands.
|
|
126
166
|
"""
|
|
127
|
-
multipipe_script = Path(self.
|
|
167
|
+
multipipe_script = Path(self.base_corsika_config.config_file_path.parent).joinpath(
|
|
128
168
|
"run_cta_multipipe"
|
|
129
169
|
)
|
|
130
170
|
with open(multipipe_script, "w", encoding="utf-8") as file:
|
|
131
171
|
multipipe_command = Path(self._simtel_path).joinpath(
|
|
132
|
-
f"sim_telarray/bin/multipipe_corsika -c {multipipe_file}
|
|
172
|
+
f"sim_telarray/bin/multipipe_corsika -c {multipipe_file} {self.sequential} "
|
|
173
|
+
"|| echo 'Fan-out failed'"
|
|
133
174
|
)
|
|
134
175
|
file.write(f"{multipipe_command}")
|
|
135
176
|
|
|
136
177
|
multipipe_script.chmod(multipipe_script.stat().st_mode | stat.S_IEXEC)
|
|
137
178
|
|
|
138
|
-
def
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
input_file: str
|
|
147
|
-
Full path of the input CORSIKA file.
|
|
148
|
-
Use '-' to tell sim_telarray to read from standard output
|
|
149
|
-
|
|
150
|
-
Returns
|
|
151
|
-
-------
|
|
152
|
-
str:
|
|
153
|
-
Command to run sim_telarray.
|
|
154
|
-
"""
|
|
155
|
-
try:
|
|
156
|
-
weak_pointing = any(pointing in self.label for pointing in ["divergent", "convergent"])
|
|
157
|
-
except TypeError: # allow for self.label to be None
|
|
158
|
-
weak_pointing = False
|
|
159
|
-
|
|
160
|
-
command = str(self._simtel_path.joinpath("sim_telarray/bin/sim_telarray"))
|
|
161
|
-
command += f" -c {self.corsika_config.array_model.get_config_file()}"
|
|
162
|
-
command += f" -I{self.corsika_config.array_model.get_config_directory()}"
|
|
163
|
-
command += self.simulator_array.get_config_option(
|
|
164
|
-
"telescope_theta", self.corsika_config.zenith_angle, weak_option=weak_pointing
|
|
165
|
-
)
|
|
166
|
-
command += self.simulator_array.get_config_option(
|
|
167
|
-
"telescope_phi", self.corsika_config.azimuth_angle, weak_option=weak_pointing
|
|
168
|
-
)
|
|
169
|
-
command += self.simulator_array.get_config_option(
|
|
170
|
-
"power_law",
|
|
171
|
-
SimulatorArray.get_power_law_for_sim_telarray_histograms(
|
|
172
|
-
self.corsika_config.primary_particle
|
|
173
|
-
),
|
|
174
|
-
)
|
|
175
|
-
command += self.simulator_array.get_config_option(
|
|
176
|
-
"histogram_file",
|
|
177
|
-
self.get_file_name(
|
|
178
|
-
simulation_software="simtel", file_type="histogram", run_number=run_number
|
|
179
|
-
),
|
|
180
|
-
)
|
|
181
|
-
command += self.simulator_array.get_config_option("random_state", "none")
|
|
182
|
-
if self.sim_telarray_seeds:
|
|
183
|
-
command += self.simulator_array.get_config_option(
|
|
184
|
-
"random_seed", self.sim_telarray_seeds
|
|
185
|
-
)
|
|
186
|
-
command += self.simulator_array.get_config_option("show", "all")
|
|
187
|
-
command += self.simulator_array.get_config_option(
|
|
188
|
-
"output_file",
|
|
189
|
-
self.simulator_array.get_file_name(
|
|
190
|
-
simulation_software="simtel", file_type="output", run_number=run_number
|
|
191
|
-
),
|
|
192
|
-
)
|
|
193
|
-
command += f" {input_file}"
|
|
194
|
-
_log_file = self.simulator_array.get_file_name(
|
|
195
|
-
simulation_software="simtel", file_type="log", run_number=run_number
|
|
196
|
-
)
|
|
197
|
-
command += f" | gzip > {_log_file} 2>&1 || exit"
|
|
198
|
-
|
|
199
|
-
# Remove the default sim_telarray configuration directories
|
|
200
|
-
return clear_default_sim_telarray_cfg_directories(command)
|
|
201
|
-
|
|
202
|
-
def get_file_name(self, simulation_software=None, file_type=None, run_number=None, mode=None):
|
|
179
|
+
def get_file_name(
|
|
180
|
+
self,
|
|
181
|
+
simulation_software=None,
|
|
182
|
+
file_type=None,
|
|
183
|
+
run_number=None,
|
|
184
|
+
mode=None,
|
|
185
|
+
model_version_index=0,
|
|
186
|
+
):
|
|
203
187
|
"""
|
|
204
188
|
Get the full path of a file for a given run number.
|
|
205
189
|
|
|
@@ -211,6 +195,12 @@ class CorsikaSimtelRunner:
|
|
|
211
195
|
File type.
|
|
212
196
|
run_number: int
|
|
213
197
|
Run number.
|
|
198
|
+
mode: str
|
|
199
|
+
Mode to use for the file name.
|
|
200
|
+
model_version_index: int
|
|
201
|
+
Index of the model version.
|
|
202
|
+
This is used to select the correct simulator_array instance
|
|
203
|
+
in case multiple array models are simulated.
|
|
214
204
|
|
|
215
205
|
Returns
|
|
216
206
|
-------
|
|
@@ -218,8 +208,12 @@ class CorsikaSimtelRunner:
|
|
|
218
208
|
File name with full path.
|
|
219
209
|
"""
|
|
220
210
|
if simulation_software is None:
|
|
221
|
-
# preference to
|
|
222
|
-
simulation_software = "
|
|
211
|
+
# preference to sim_telarray output (multipipe)
|
|
212
|
+
simulation_software = "sim_telarray" if self.simulator_array else "corsika"
|
|
223
213
|
|
|
224
|
-
runner =
|
|
214
|
+
runner = (
|
|
215
|
+
self.corsika_runner
|
|
216
|
+
if simulation_software == "corsika"
|
|
217
|
+
else self.simulator_array[model_version_index]
|
|
218
|
+
)
|
|
225
219
|
return runner.get_file_name(file_type=file_type, run_number=run_number, mode=mode)
|
|
@@ -52,6 +52,7 @@ class RunnerServices:
|
|
|
52
52
|
"array_name": self.corsika_config.array_model.layout_name,
|
|
53
53
|
"site": self.corsika_config.array_model.site,
|
|
54
54
|
"label": self.label,
|
|
55
|
+
"model_version": self.corsika_config.array_model.model_version,
|
|
55
56
|
"zenith": self.corsika_config.zenith_angle,
|
|
56
57
|
"azimuth": self.corsika_config.azimuth_angle,
|
|
57
58
|
}
|
|
@@ -70,8 +71,8 @@ class RunnerServices:
|
|
|
70
71
|
"""
|
|
71
72
|
software_map = {
|
|
72
73
|
"corsika": ["corsika"],
|
|
73
|
-
"
|
|
74
|
-
"
|
|
74
|
+
"sim_telarray": ["sim_telarray"],
|
|
75
|
+
"corsika_sim_telarray": ["corsika", "sim_telarray"],
|
|
75
76
|
}
|
|
76
77
|
return software_map.get(simulation_software.lower(), [])
|
|
77
78
|
|
|
@@ -137,11 +138,12 @@ class RunnerServices:
|
|
|
137
138
|
file_label = f"_{info_for_file_name['label']}" if info_for_file_name.get("label") else ""
|
|
138
139
|
zenith = self.corsika_config.get_config_parameter("THETAP")[0]
|
|
139
140
|
azimuth = self.corsika_config.azimuth_angle
|
|
140
|
-
|
|
141
|
+
run_number_string = self._get_run_number_string(info_for_file_name["run_number"])
|
|
141
142
|
return (
|
|
142
|
-
f"{
|
|
143
|
+
f"{info_for_file_name['primary']}_{run_number_string}_"
|
|
143
144
|
f"za{round(zenith):02}deg_azm{azimuth:03}deg_"
|
|
144
|
-
f"{info_for_file_name['site']}_{info_for_file_name['array_name']}
|
|
145
|
+
f"{info_for_file_name['site']}_{info_for_file_name['array_name']}_"
|
|
146
|
+
f"{info_for_file_name['model_version']}{file_label}"
|
|
145
147
|
)
|
|
146
148
|
|
|
147
149
|
def _get_log_file_path(self, file_type, file_name):
|
|
@@ -187,8 +189,9 @@ class RunnerServices:
|
|
|
187
189
|
"""
|
|
188
190
|
data_suffixes = {
|
|
189
191
|
"output": ".zst",
|
|
190
|
-
"corsika_output": ".zst",
|
|
192
|
+
"corsika_output": ".corsika.zst",
|
|
191
193
|
"simtel_output": ".simtel.zst",
|
|
194
|
+
"event_data": ".reduced_event_data.hdf5",
|
|
192
195
|
}
|
|
193
196
|
run_dir = self._get_run_number_string(run_number)
|
|
194
197
|
data_run_dir = self.directory["data"].joinpath(run_dir)
|
|
@@ -220,7 +223,13 @@ class RunnerServices:
|
|
|
220
223
|
sub_log_file_dir.mkdir(parents=True, exist_ok=True)
|
|
221
224
|
return sub_log_file_dir.joinpath(f"sub_{file_name}{suffix}")
|
|
222
225
|
|
|
223
|
-
def get_file_name(
|
|
226
|
+
def get_file_name(
|
|
227
|
+
self,
|
|
228
|
+
file_type,
|
|
229
|
+
run_number=None,
|
|
230
|
+
mode=None,
|
|
231
|
+
_model_version_index=0,
|
|
232
|
+
): # pylint: disable=unused-argument
|
|
224
233
|
"""
|
|
225
234
|
Get a CORSIKA/sim_telarray style file name for various log and data file types.
|
|
226
235
|
|
|
@@ -232,6 +241,11 @@ class RunnerServices:
|
|
|
232
241
|
Run number.
|
|
233
242
|
mode: str
|
|
234
243
|
out or err (optional, relevant only for sub_log).
|
|
244
|
+
model_version_index: int
|
|
245
|
+
Index of the model version.
|
|
246
|
+
This is not used here, but in other implementations of this function is
|
|
247
|
+
used to select the correct simulator_array instance in case
|
|
248
|
+
multiple array models are simulated.
|
|
235
249
|
|
|
236
250
|
Returns
|
|
237
251
|
-------
|
|
@@ -248,7 +262,7 @@ class RunnerServices:
|
|
|
248
262
|
if file_type in ["log", "histogram", "corsika_log"]:
|
|
249
263
|
return self._get_log_file_path(file_type, file_name)
|
|
250
264
|
|
|
251
|
-
if file_type in ["output", "corsika_output", "simtel_output"]:
|
|
265
|
+
if file_type in ["output", "corsika_output", "simtel_output", "event_data"]:
|
|
252
266
|
return self._get_data_file_path(file_type, file_name, run_number)
|
|
253
267
|
|
|
254
268
|
if file_type in ("sub_log", "sub_script"):
|
|
@@ -12,7 +12,7 @@ __all__ = ["InvalidOutputFileError", "SimtelExecutionError", "SimtelRunner"]
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class SimtelExecutionError(Exception):
|
|
15
|
-
"""Exception for
|
|
15
|
+
"""Exception for sim_telarray execution error."""
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class InvalidOutputFileError(Exception):
|
|
@@ -21,7 +21,10 @@ class InvalidOutputFileError(Exception):
|
|
|
21
21
|
|
|
22
22
|
class SimtelRunner:
|
|
23
23
|
"""
|
|
24
|
-
Base class for running sim_telarray
|
|
24
|
+
Base class for running simulations based on the sim_telarray software stack.
|
|
25
|
+
|
|
26
|
+
The sim_telarray software stack includes sim_telarray itself and e.g., testeff,
|
|
27
|
+
LightEmission, and other software packages.
|
|
25
28
|
|
|
26
29
|
Parameters
|
|
27
30
|
----------
|
|
@@ -29,6 +32,10 @@ class SimtelRunner:
|
|
|
29
32
|
Location of sim_telarray installation.
|
|
30
33
|
label: str
|
|
31
34
|
Instance label. Important for output file naming.
|
|
35
|
+
corsika_config: CorsikaConfig
|
|
36
|
+
CORSIKA configuration.
|
|
37
|
+
use_multipipe: bool
|
|
38
|
+
Use multipipe to run CORSIKA and sim_telarray.
|
|
32
39
|
"""
|
|
33
40
|
|
|
34
41
|
def __init__(self, simtel_path, label=None, corsika_config=None, use_multipipe=False):
|
|
@@ -43,7 +50,7 @@ class SimtelRunner:
|
|
|
43
50
|
|
|
44
51
|
self.runner_service = RunnerServices(corsika_config, label)
|
|
45
52
|
self._directory = self.runner_service.load_data_directories(
|
|
46
|
-
"
|
|
53
|
+
"corsika_sim_telarray" if use_multipipe else "sim_telarray"
|
|
47
54
|
)
|
|
48
55
|
|
|
49
56
|
def __repr__(self):
|
|
@@ -70,12 +77,8 @@ class SimtelRunner:
|
|
|
70
77
|
Path
|
|
71
78
|
Full path of the run script.
|
|
72
79
|
"""
|
|
73
|
-
self._logger.debug("Creating run bash script")
|
|
74
|
-
|
|
75
80
|
script_file_path = self.get_file_name(file_type="sub_script", run_number=run_number)
|
|
76
|
-
|
|
77
81
|
self._logger.debug(f"Run bash script - {script_file_path}")
|
|
78
|
-
|
|
79
82
|
self._logger.debug(f"Extra commands to be added to the run script {extra_commands}")
|
|
80
83
|
|
|
81
84
|
command = self._make_run_command(run_number=run_number, input_file=input_file)
|
|
@@ -216,7 +219,14 @@ class SimtelRunner:
|
|
|
216
219
|
"""Return computing resources used."""
|
|
217
220
|
return self.runner_service.get_resources(run_number)
|
|
218
221
|
|
|
219
|
-
def get_file_name(
|
|
222
|
+
def get_file_name(
|
|
223
|
+
self,
|
|
224
|
+
simulation_software="sim_telarray",
|
|
225
|
+
file_type=None,
|
|
226
|
+
run_number=None,
|
|
227
|
+
mode="",
|
|
228
|
+
model_version_index=0,
|
|
229
|
+
):
|
|
220
230
|
"""
|
|
221
231
|
Get the full path of a file for a given run number.
|
|
222
232
|
|
|
@@ -228,16 +238,23 @@ class SimtelRunner:
|
|
|
228
238
|
File type.
|
|
229
239
|
run_number: int
|
|
230
240
|
Run number.
|
|
241
|
+
model_version_index: int
|
|
242
|
+
Index of the model version.
|
|
243
|
+
This is used to select the correct simulator_array instance in case
|
|
244
|
+
multiple array models are simulated.
|
|
231
245
|
|
|
232
246
|
Returns
|
|
233
247
|
-------
|
|
234
248
|
str
|
|
235
249
|
File name with full path.
|
|
236
250
|
"""
|
|
237
|
-
if simulation_software.lower() != "
|
|
251
|
+
if simulation_software.lower() != "sim_telarray":
|
|
238
252
|
raise ValueError(
|
|
239
253
|
f"simulation_software ({simulation_software}) is not supported in SimulatorArray"
|
|
240
254
|
)
|
|
241
255
|
return self.runner_service.get_file_name(
|
|
242
|
-
file_type=file_type,
|
|
256
|
+
file_type=file_type,
|
|
257
|
+
run_number=run_number,
|
|
258
|
+
mode=mode,
|
|
259
|
+
_model_version_index=model_version_index,
|
|
243
260
|
)
|