gammasimtools 0.14.0__py3-none-any.whl → 0.16.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.14.0.dist-info → gammasimtools-0.16.0.dist-info}/METADATA +2 -32
- {gammasimtools-0.14.0.dist-info → gammasimtools-0.16.0.dist-info}/RECORD +222 -214
- {gammasimtools-0.14.0.dist-info → gammasimtools-0.16.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.14.0.dist-info → gammasimtools-0.16.0.dist-info}/entry_points.txt +5 -2
- 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_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/production_derive_corsika_limits.py +63 -10
- simtools/applications/production_derive_statistics.py +125 -0
- simtools/applications/production_generate_grid.py +197 -0
- simtools/applications/production_generate_simulation_config.py +0 -10
- simtools/applications/simulate_light_emission.py +5 -13
- simtools/applications/simulate_prod.py +16 -4
- 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/camera/camera_efficiency.py +14 -39
- simtools/configuration/commandline_parser.py +4 -3
- simtools/configuration/configurator.py +10 -0
- simtools/corsika/corsika_config.py +103 -5
- simtools/data_model/format_checkers.py +9 -0
- 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 +10 -4
- simtools/layout/array_layout.py +1 -0
- simtools/model/array_model.py +63 -29
- simtools/model/model_parameter.py +76 -51
- 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 +0 -4
- simtools/production_configuration/{event_scaler.py → derive_production_statistics.py} +24 -20
- simtools/production_configuration/derive_production_statistics_handler.py +119 -0
- simtools/production_configuration/generate_production_grid.py +364 -0
- simtools/production_configuration/generate_simulation_config.py +9 -9
- simtools/production_configuration/interpolation_handler.py +16 -11
- simtools/ray_tracing/mirror_panel_psf.py +16 -20
- simtools/ray_tracing/psf_analysis.py +2 -2
- simtools/ray_tracing/ray_tracing.py +5 -1
- simtools/reporting/docs_read_parameters.py +361 -58
- simtools/runners/corsika_runner.py +11 -1
- simtools/runners/corsika_simtel_runner.py +80 -89
- simtools/runners/runner_services.py +17 -4
- 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 +3 -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/simtel/simtel_config_reader.py +21 -17
- simtools/simtel/simtel_config_writer.py +237 -65
- simtools/simtel/simtel_io_file_info.py +57 -0
- simtools/simtel/simtel_io_histogram.py +10 -14
- simtools/simtel/simtel_io_histograms.py +2 -2
- simtools/simtel/simtel_io_metadata.py +91 -0
- simtools/simtel/simulator_array.py +26 -12
- simtools/simtel/simulator_camera_efficiency.py +12 -6
- simtools/simtel/simulator_light_emission.py +6 -11
- simtools/simtel/simulator_ray_tracing.py +14 -4
- simtools/simulator.py +230 -66
- simtools/testing/configuration.py +12 -6
- simtools/testing/helpers.py +18 -0
- simtools/testing/sim_telarray_metadata.py +212 -0
- simtools/testing/validate_output.py +12 -5
- simtools/utils/general.py +18 -27
- simtools/utils/names.py +27 -5
- simtools/visualization/visualize.py +2 -2
- simtools/applications/production_scale_events.py +0 -185
- {gammasimtools-0.14.0.dist-info → gammasimtools-0.16.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.14.0.dist-info → gammasimtools-0.16.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
"""Read metadata from sim_telarray files."""
|
|
3
|
+
|
|
4
|
+
from functools import cache
|
|
5
|
+
|
|
6
|
+
from eventio import EventIOFile
|
|
7
|
+
from eventio.simtel import HistoryMeta
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@cache
|
|
11
|
+
def read_sim_telarray_metadata(file, encoding="utf8"):
|
|
12
|
+
"""
|
|
13
|
+
Return global and per-telescope metadata from sim_telarray file.
|
|
14
|
+
|
|
15
|
+
Cached to avoid re-reading the file multiple times.
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
file: str
|
|
20
|
+
Path to the sim_telarray file.
|
|
21
|
+
encoding: str
|
|
22
|
+
Encoding to use for decoding metadata. Default is 'utf8'.
|
|
23
|
+
|
|
24
|
+
Returns
|
|
25
|
+
-------
|
|
26
|
+
global_meta: dict
|
|
27
|
+
Global metadata dictionary.
|
|
28
|
+
telescope_meta: dict
|
|
29
|
+
Dictionary of telescope metadata, keyed by telescope ID.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def decode(meta):
|
|
33
|
+
return {k.decode(encoding): v.decode(encoding) for k, v in meta.items()}
|
|
34
|
+
|
|
35
|
+
global_meta = None
|
|
36
|
+
telescope_meta = {}
|
|
37
|
+
|
|
38
|
+
with EventIOFile(file) as f:
|
|
39
|
+
found_meta = False
|
|
40
|
+
for o in f:
|
|
41
|
+
if isinstance(o, HistoryMeta):
|
|
42
|
+
found_meta = True
|
|
43
|
+
else:
|
|
44
|
+
if found_meta:
|
|
45
|
+
break
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
meta = decode(o.parse())
|
|
49
|
+
if o.header.id == -1:
|
|
50
|
+
global_meta = meta
|
|
51
|
+
else:
|
|
52
|
+
telescope_meta[o.header.id] = meta
|
|
53
|
+
|
|
54
|
+
def clean_meta(meta):
|
|
55
|
+
"""Clean metadata dictionary."""
|
|
56
|
+
meta = {k.lower().lstrip("*"): v for k, v in meta.items()}
|
|
57
|
+
return {k: v.strip() if isinstance(v, str) else v for k, v in meta.items()}
|
|
58
|
+
|
|
59
|
+
# keys to lower case and strip leading '*', trailing spaces
|
|
60
|
+
return clean_meta(global_meta), {
|
|
61
|
+
tel_id: clean_meta(meta) for tel_id, meta in telescope_meta.items()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_sim_telarray_telescope_id(telescope_name, file):
|
|
66
|
+
"""
|
|
67
|
+
Return the telescope ID for a given telescope name in a sim_telarray file.
|
|
68
|
+
|
|
69
|
+
Translates e.g. 'LSTN-01' to the corresponding telescope ID.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
telescope_name: str
|
|
74
|
+
Name of the telescope.
|
|
75
|
+
file: str
|
|
76
|
+
Path to the sim_telarray file.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
int, None
|
|
81
|
+
Telescope ID. Returns None if not found.
|
|
82
|
+
"""
|
|
83
|
+
_, telescope_meta = read_sim_telarray_metadata(file)
|
|
84
|
+
telescope_name_to_sim_telarray_id = {}
|
|
85
|
+
for tel_id in telescope_meta.keys():
|
|
86
|
+
_optics_name = telescope_meta[tel_id].get("optics_config_name", None)
|
|
87
|
+
_camera_name = telescope_meta[tel_id].get("camera_config_name", None)
|
|
88
|
+
if _optics_name == _camera_name and _optics_name == telescope_name:
|
|
89
|
+
telescope_name_to_sim_telarray_id[telescope_name] = tel_id
|
|
90
|
+
|
|
91
|
+
return telescope_name_to_sim_telarray_id.get(telescope_name, None)
|
|
@@ -23,6 +23,8 @@ class SimulatorArray(SimtelRunner):
|
|
|
23
23
|
Instance label.
|
|
24
24
|
use_multipipe: bool
|
|
25
25
|
Use multipipe to run CORSIKA and sim_telarray.
|
|
26
|
+
sim_telarray_seeds: dict
|
|
27
|
+
Dictionary with configuration for sim_telarray random instrument setup.
|
|
26
28
|
"""
|
|
27
29
|
|
|
28
30
|
def __init__(
|
|
@@ -48,9 +50,9 @@ class SimulatorArray(SimtelRunner):
|
|
|
48
50
|
self.io_handler = io_handler.IOHandler()
|
|
49
51
|
self._log_file = None
|
|
50
52
|
|
|
51
|
-
def
|
|
53
|
+
def make_run_command(self, run_number=None, input_file=None, weak_pointing=None):
|
|
52
54
|
"""
|
|
53
|
-
Build and return the command to run
|
|
55
|
+
Build and return the command to run sim_telarray.
|
|
54
56
|
|
|
55
57
|
Parameters
|
|
56
58
|
----------
|
|
@@ -58,22 +60,29 @@ class SimulatorArray(SimtelRunner):
|
|
|
58
60
|
Full path of the input CORSIKA file
|
|
59
61
|
run_number: int (optional)
|
|
60
62
|
run number
|
|
63
|
+
weak_pointing: bool (optional)
|
|
64
|
+
Specify weak pointing option for sim_telarray.
|
|
61
65
|
|
|
62
66
|
Returns
|
|
63
67
|
-------
|
|
64
68
|
str
|
|
65
69
|
Command to run sim_telarray.
|
|
66
70
|
"""
|
|
71
|
+
config_dir = self.corsika_config.array_model.get_config_directory()
|
|
67
72
|
self._log_file = self.get_file_name(file_type="log", run_number=run_number)
|
|
68
73
|
histogram_file = self.get_file_name(file_type="histogram", run_number=run_number)
|
|
69
74
|
output_file = self.get_file_name(file_type="output", run_number=run_number)
|
|
75
|
+
self.corsika_config.array_model.export_all_simtel_config_files()
|
|
70
76
|
|
|
71
|
-
# Array
|
|
72
77
|
command = str(self._simtel_path.joinpath("sim_telarray/bin/sim_telarray"))
|
|
73
|
-
command += f" -c {self.corsika_config.array_model.
|
|
74
|
-
command += f" -I{
|
|
75
|
-
command += super().get_config_option(
|
|
76
|
-
|
|
78
|
+
command += f" -c {self.corsika_config.array_model.config_file_path}"
|
|
79
|
+
command += f" -I{config_dir}"
|
|
80
|
+
command += super().get_config_option(
|
|
81
|
+
"telescope_theta", self.corsika_config.zenith_angle, weak_pointing
|
|
82
|
+
)
|
|
83
|
+
command += super().get_config_option(
|
|
84
|
+
"telescope_phi", self.corsika_config.azimuth_angle, weak_pointing
|
|
85
|
+
)
|
|
77
86
|
command += super().get_config_option(
|
|
78
87
|
"power_law",
|
|
79
88
|
SimulatorArray.get_power_law_for_sim_telarray_histograms(
|
|
@@ -81,13 +90,18 @@ class SimulatorArray(SimtelRunner):
|
|
|
81
90
|
),
|
|
82
91
|
)
|
|
83
92
|
command += super().get_config_option("histogram_file", histogram_file)
|
|
84
|
-
command += super().get_config_option("output_file", output_file)
|
|
85
93
|
command += super().get_config_option("random_state", "none")
|
|
86
|
-
if self.sim_telarray_seeds:
|
|
87
|
-
command += super().get_config_option(
|
|
94
|
+
if self.sim_telarray_seeds and self.sim_telarray_seeds.get("random_instrument_instances"):
|
|
95
|
+
command += super().get_config_option(
|
|
96
|
+
"random_seed",
|
|
97
|
+
f"file-by-run:{config_dir}/{self.sim_telarray_seeds['seed_file_name']},auto",
|
|
98
|
+
)
|
|
99
|
+
elif self.sim_telarray_seeds and self.sim_telarray_seeds.get("seed"):
|
|
100
|
+
command += super().get_config_option("random_seed", self.sim_telarray_seeds["seed"])
|
|
88
101
|
command += super().get_config_option("show", "all")
|
|
102
|
+
command += super().get_config_option("output_file", output_file)
|
|
89
103
|
command += f" {input_file}"
|
|
90
|
-
command += f" > {self._log_file} 2>&1 || exit"
|
|
104
|
+
command += f" | gzip > {self._log_file} 2>&1 || exit"
|
|
91
105
|
|
|
92
106
|
return clear_default_sim_telarray_cfg_directories(command)
|
|
93
107
|
|
|
@@ -115,7 +129,7 @@ class SimulatorArray(SimtelRunner):
|
|
|
115
129
|
msg = f"sim_telarray output file {output_file} does not exist."
|
|
116
130
|
self._logger.error(msg)
|
|
117
131
|
raise InvalidOutputFileError(msg)
|
|
118
|
-
self._logger.debug(f"
|
|
132
|
+
self._logger.debug(f"sim_telarray output file {output_file} exists.")
|
|
119
133
|
return True
|
|
120
134
|
|
|
121
135
|
@staticmethod
|
|
@@ -16,8 +16,10 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
16
16
|
|
|
17
17
|
Parameters
|
|
18
18
|
----------
|
|
19
|
-
telescope_model:
|
|
19
|
+
telescope_model: TelescopeModel
|
|
20
20
|
Instance of TelescopeModel class.
|
|
21
|
+
site_model: SiteModel
|
|
22
|
+
Instance of SiteModel class.
|
|
21
23
|
label: str
|
|
22
24
|
Instance label. Important for output file naming.
|
|
23
25
|
simtel_path: str or Path
|
|
@@ -28,11 +30,14 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
28
30
|
Zenith angle given in the config to CameraEfficiency.
|
|
29
31
|
nsb_spectrum: str or Path
|
|
30
32
|
Path to the nsb spectrum file.
|
|
33
|
+
skip_correction_to_nsb_spectrum: bool
|
|
34
|
+
If True, skip the correction to the original altitude where the NSB spectrum was derived.
|
|
31
35
|
"""
|
|
32
36
|
|
|
33
37
|
def __init__(
|
|
34
38
|
self,
|
|
35
39
|
telescope_model,
|
|
40
|
+
site_model,
|
|
36
41
|
label=None,
|
|
37
42
|
simtel_path=None,
|
|
38
43
|
file_simtel=None,
|
|
@@ -48,6 +53,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
48
53
|
super().__init__(label=label, simtel_path=simtel_path)
|
|
49
54
|
|
|
50
55
|
self._telescope_model = telescope_model
|
|
56
|
+
self._site_model = site_model
|
|
51
57
|
self.label = label if label is not None else self._telescope_model.label
|
|
52
58
|
|
|
53
59
|
self._file_simtel = file_simtel
|
|
@@ -68,8 +74,8 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
68
74
|
self._nsb_spectrum = self._validate_or_fix_nsb_spectrum_file_format(nsb_spectrum)
|
|
69
75
|
else:
|
|
70
76
|
self._nsb_spectrum = (
|
|
71
|
-
self.
|
|
72
|
-
/ Path(self.
|
|
77
|
+
self._site_model.config_file_directory
|
|
78
|
+
/ Path(self._site_model.get_parameter_value("nsb_reference_spectrum")).name
|
|
73
79
|
)
|
|
74
80
|
|
|
75
81
|
def _make_run_command(self, run_number=None, input_file=None): # pylint: disable=unused-argument
|
|
@@ -127,8 +133,8 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
127
133
|
if self.nsb_spectrum is not None:
|
|
128
134
|
command += f" -fnsb {self.nsb_spectrum}"
|
|
129
135
|
command += " -nm -nsb-extra"
|
|
130
|
-
command += f" -alt {self.
|
|
131
|
-
command += f" -fatm {self.
|
|
136
|
+
command += f" -alt {self._site_model.get_parameter_value('corsika_observation_level')}"
|
|
137
|
+
command += f" -fatm {self._site_model.get_parameter_value('atmospheric_transmission')}"
|
|
132
138
|
command += f" -flen {focal_length}"
|
|
133
139
|
command += f" {pixel_shape_cmd} {pixel_diameter}"
|
|
134
140
|
if mirror_class == 0:
|
|
@@ -152,7 +158,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
152
158
|
command += f" -fqe {self._telescope_model.get_parameter_value('quantum_efficiency')}"
|
|
153
159
|
command += " 200 1000" # lmin and lmax
|
|
154
160
|
command += " 300" # Xmax
|
|
155
|
-
command += f" {self.
|
|
161
|
+
command += f" {self._site_model.get_parameter_value('atmospheric_profile')}"
|
|
156
162
|
command += f" {self.zenith_angle}"
|
|
157
163
|
|
|
158
164
|
# Remove the default sim_telarray configuration directories
|
|
@@ -63,7 +63,7 @@ class SimulatorLightEmission(SimtelRunner):
|
|
|
63
63
|
self.light_emission_config = light_emission_config
|
|
64
64
|
self.distance = None
|
|
65
65
|
self.light_source_type = light_source_type
|
|
66
|
-
self._telescope_model.
|
|
66
|
+
self._telescope_model.write_sim_telarray_config_file(additional_model=site_model)
|
|
67
67
|
self.test = test
|
|
68
68
|
|
|
69
69
|
@staticmethod
|
|
@@ -244,12 +244,12 @@ class SimulatorLightEmission(SimtelRunner):
|
|
|
244
244
|
|
|
245
245
|
def _make_simtel_script(self):
|
|
246
246
|
"""
|
|
247
|
-
Return the command to run
|
|
247
|
+
Return the command to run sim_telarray using the output from the previous step.
|
|
248
248
|
|
|
249
249
|
Returns
|
|
250
250
|
-------
|
|
251
251
|
str
|
|
252
|
-
The command to run
|
|
252
|
+
The command to run sim_telarray
|
|
253
253
|
"""
|
|
254
254
|
# LightEmission
|
|
255
255
|
_, angles = self.calibration_pointing_direction()
|
|
@@ -257,14 +257,9 @@ class SimulatorLightEmission(SimtelRunner):
|
|
|
257
257
|
command = f"{self._simtel_path.joinpath('sim_telarray/bin/sim_telarray/')}"
|
|
258
258
|
command += " -I"
|
|
259
259
|
command += f" -I{self._telescope_model.config_file_directory}"
|
|
260
|
-
command += f" -c {self._telescope_model.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
self._telescope_model.get_config_file(no_export=True), "array_triggers"
|
|
264
|
-
)
|
|
265
|
-
self._remove_line_from_config(
|
|
266
|
-
self._telescope_model.get_config_file(no_export=True), "axes_offsets"
|
|
267
|
-
)
|
|
260
|
+
command += f" -c {self._telescope_model.config_file_path}"
|
|
261
|
+
self._remove_line_from_config(self._telescope_model.config_file_path, "array_triggers")
|
|
262
|
+
self._remove_line_from_config(self._telescope_model.config_file_path, "axes_offsets")
|
|
268
263
|
|
|
269
264
|
command += " -DNUM_TELESCOPES=1"
|
|
270
265
|
|
|
@@ -25,6 +25,8 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
25
25
|
----------
|
|
26
26
|
telescope_model: TelescopeModel
|
|
27
27
|
telescope model
|
|
28
|
+
site_model: SiteModel
|
|
29
|
+
site model
|
|
28
30
|
label: str
|
|
29
31
|
label used for output file naming.
|
|
30
32
|
simtel_path: str or Path
|
|
@@ -41,6 +43,7 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
41
43
|
def __init__(
|
|
42
44
|
self,
|
|
43
45
|
telescope_model,
|
|
46
|
+
site_model,
|
|
44
47
|
label=None,
|
|
45
48
|
simtel_path=None,
|
|
46
49
|
config_data=None,
|
|
@@ -54,6 +57,7 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
54
57
|
super().__init__(label=label, simtel_path=simtel_path)
|
|
55
58
|
|
|
56
59
|
self.telescope_model = telescope_model
|
|
60
|
+
self.site_model = site_model
|
|
57
61
|
self.label = label if label is not None else self.telescope_model.label
|
|
58
62
|
|
|
59
63
|
self.io_handler = io_handler.IOHandler()
|
|
@@ -115,7 +119,7 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
115
119
|
file.write(f"#{50 * '='}\n")
|
|
116
120
|
file.write("# List of photons for RayTracing simulations\n")
|
|
117
121
|
file.write(f"#{50 * '='}\n")
|
|
118
|
-
file.write(f"# config_file = {self.telescope_model.
|
|
122
|
+
file.write(f"# config_file = {self.telescope_model.config_file_path}\n")
|
|
119
123
|
file.write(f"# zenith_angle [deg] = {self.config.zenith_angle}\n")
|
|
120
124
|
file.write(f"# off_axis_angle [deg] = {self.config.off_axis_angle}\n")
|
|
121
125
|
file.write(f"# source_distance [km] = {self.config.source_distance}\n")
|
|
@@ -137,7 +141,13 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
137
141
|
self._write_out_single_pixel_camera_file()
|
|
138
142
|
|
|
139
143
|
def _make_run_command(self, run_number=None, input_file=None): # pylint: disable=unused-argument
|
|
140
|
-
"""
|
|
144
|
+
"""
|
|
145
|
+
Generate sim_telarray run command. Export sim_telarray configuration file(s).
|
|
146
|
+
|
|
147
|
+
The run_number and input_file parameters are not relevant for the ray tracing simulation.
|
|
148
|
+
"""
|
|
149
|
+
self.telescope_model.write_sim_telarray_config_file(additional_model=self.site_model)
|
|
150
|
+
|
|
141
151
|
if self.config.single_mirror_mode:
|
|
142
152
|
# Note: no mirror length defined for dual-mirror telescopes
|
|
143
153
|
_mirror_focal_length = float(
|
|
@@ -146,13 +156,13 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
146
156
|
|
|
147
157
|
# RayTracing
|
|
148
158
|
command = str(self._simtel_path.joinpath("sim_telarray/bin/sim_telarray"))
|
|
149
|
-
command += f" -c {self.telescope_model.
|
|
159
|
+
command += f" -c {self.telescope_model.config_file_path}"
|
|
150
160
|
command += f" -I{self.telescope_model.config_file_directory}"
|
|
151
161
|
command += super().get_config_option("random_state", "none")
|
|
152
162
|
command += super().get_config_option("IMAGING_LIST", str(self._photons_file))
|
|
153
163
|
command += super().get_config_option("stars", str(self._stars_file))
|
|
154
164
|
command += super().get_config_option(
|
|
155
|
-
"altitude", self.
|
|
165
|
+
"altitude", self.site_model.get_parameter_value("corsika_observation_level")
|
|
156
166
|
)
|
|
157
167
|
command += super().get_config_option(
|
|
158
168
|
"telescope_theta",
|