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,125 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Application to run the StatisticalErrorEvaluator and interpolate results.
|
|
5
|
+
|
|
6
|
+
This application evaluates statistical uncertainties from DL2 MC event files
|
|
7
|
+
based on input parameters like zenith angles and camera offsets, and performs interpolation
|
|
8
|
+
for a specified query point.
|
|
9
|
+
|
|
10
|
+
Command line arguments
|
|
11
|
+
----------------------
|
|
12
|
+
base_path (str, required)
|
|
13
|
+
Path to the directory containing the DL2 MC event file for interpolation.
|
|
14
|
+
zeniths (list of int, required)
|
|
15
|
+
List of zenith angles to consider.
|
|
16
|
+
camera_offsets (list of int, required)
|
|
17
|
+
List of offsets in degrees.
|
|
18
|
+
query_point (list of float, required)
|
|
19
|
+
Query point for interpolation. The query point must contain exactly 5 values:
|
|
20
|
+
- Energy (TeV)
|
|
21
|
+
- Azimuth (degrees)
|
|
22
|
+
- Zenith (degrees)
|
|
23
|
+
- NSB (MHz)
|
|
24
|
+
- Offset (degrees)
|
|
25
|
+
output_file (str, optional)
|
|
26
|
+
Output file to store the results. Default: 'interpolated_production_statistics.json'.
|
|
27
|
+
metrics_file (str, optional)
|
|
28
|
+
Path to the metrics definition file. Default: 'production_simulation_config_metrics.yml'.
|
|
29
|
+
file_name_template (str, optional)
|
|
30
|
+
Template for the file name. Default:
|
|
31
|
+
'prod6_LaPalma-{zenith}deg_gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits'.
|
|
32
|
+
|
|
33
|
+
Example
|
|
34
|
+
-------
|
|
35
|
+
To evaluate statistical uncertainties and perform interpolation, run the command line script:
|
|
36
|
+
|
|
37
|
+
.. code-block:: console
|
|
38
|
+
|
|
39
|
+
simtools-production-derive-statistics --base_path tests/resources/production_dl2_fits/ \\
|
|
40
|
+
--zeniths 20 40 52 60 --camera_offsets 0 --query_point 1 180 30 0 0 \\
|
|
41
|
+
--metrics_file "path/to/metrics.yaml" \\
|
|
42
|
+
--output_path simtools-output/derived_events \\
|
|
43
|
+
--output_file derived_events.json
|
|
44
|
+
|
|
45
|
+
The output will display the production statistics for the specified query point and save
|
|
46
|
+
the results to the specified output file.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
|
|
51
|
+
from simtools.configuration import configurator
|
|
52
|
+
from simtools.production_configuration.derive_production_statistics_handler import (
|
|
53
|
+
ProductionStatisticsHandler,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _parse(label, description):
|
|
58
|
+
"""
|
|
59
|
+
Parse command line arguments for the statistical error evaluator application.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
argparse.Namespace
|
|
64
|
+
Parsed command line arguments.
|
|
65
|
+
"""
|
|
66
|
+
config = configurator.Configurator(label=label, description=description)
|
|
67
|
+
|
|
68
|
+
config.parser.add_argument(
|
|
69
|
+
"--base_path",
|
|
70
|
+
type=str,
|
|
71
|
+
required=True,
|
|
72
|
+
help="Path to the DL2 MC event files for interpolation.",
|
|
73
|
+
)
|
|
74
|
+
config.parser.add_argument(
|
|
75
|
+
"--zeniths",
|
|
76
|
+
required=True,
|
|
77
|
+
nargs="+",
|
|
78
|
+
type=float,
|
|
79
|
+
help="List of zenith angles.",
|
|
80
|
+
)
|
|
81
|
+
config.parser.add_argument(
|
|
82
|
+
"--camera_offsets",
|
|
83
|
+
required=True,
|
|
84
|
+
nargs="+",
|
|
85
|
+
type=float,
|
|
86
|
+
help="List of camera offsets in degrees.",
|
|
87
|
+
)
|
|
88
|
+
config.parser.add_argument(
|
|
89
|
+
"--query_point",
|
|
90
|
+
required=True,
|
|
91
|
+
nargs=5,
|
|
92
|
+
type=float,
|
|
93
|
+
help="Grid point for interpolation (energy, azimuth, zenith, NSB, offset).",
|
|
94
|
+
)
|
|
95
|
+
config.parser.add_argument(
|
|
96
|
+
"--metrics_file",
|
|
97
|
+
required=False,
|
|
98
|
+
type=str,
|
|
99
|
+
default="production_simulation_config_metrics.yml",
|
|
100
|
+
help="Metrics definition file. (default: production_simulation_config_metrics.yml)",
|
|
101
|
+
)
|
|
102
|
+
config.parser.add_argument(
|
|
103
|
+
"--file_name_template",
|
|
104
|
+
required=False,
|
|
105
|
+
type=str,
|
|
106
|
+
default=("prod6_LaPalma-{zenith}deg_gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits"),
|
|
107
|
+
help=("Template for the DL2 MC event file name."),
|
|
108
|
+
)
|
|
109
|
+
return config.initialize(db_config=False, output=True)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def main():
|
|
113
|
+
"""Run the ProductionStatisticsHandler."""
|
|
114
|
+
label = Path(__file__).stem
|
|
115
|
+
args_dict, _ = _parse(
|
|
116
|
+
label,
|
|
117
|
+
"Evaluate statistical uncertainties from DL2 MC event files and interpolate results.",
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
manager = ProductionStatisticsHandler(args_dict)
|
|
121
|
+
manager.run()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
main()
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Generate a grid of simulation points using flexible axes definitions.
|
|
5
|
+
|
|
6
|
+
This application generates a grid of simulation points based on the provided axes
|
|
7
|
+
definitions. The axes definitions (range, binning) are specified in a file.
|
|
8
|
+
The viewcone, radius and energy thresholds are provided as a lookup table and
|
|
9
|
+
are interpolated based on the generated grid points. The generated grid points are
|
|
10
|
+
filtered based on the specified telescope IDs and the limits from the lookup table.
|
|
11
|
+
The generated grid points are saved to a file.
|
|
12
|
+
It can also convert the generated points to RA/Dec coordinates if the selected
|
|
13
|
+
coordinate system is 'ra_dec'.
|
|
14
|
+
|
|
15
|
+
Command line arguments
|
|
16
|
+
----------------------
|
|
17
|
+
axes (str, required)
|
|
18
|
+
Path to a YAML or JSON file defining the axes of the grid.
|
|
19
|
+
coordinate_system (str, optional, default='zenith_azimuth')
|
|
20
|
+
The coordinate system for the grid generation ('zenith_azimuth' or 'ra_dec').
|
|
21
|
+
observing_time (str, optional, default=now)
|
|
22
|
+
Time of the observation (format: 'YYYY-MM-DD HH:MM:SS').
|
|
23
|
+
lookup_table (str, required)
|
|
24
|
+
Path to the lookup table for simulation limits. The table should contain
|
|
25
|
+
varying azimuth and/or zenith angles.
|
|
26
|
+
telescope_ids (list of int, optional)
|
|
27
|
+
List of telescope IDs as used in sim_telarray to filter the events.
|
|
28
|
+
output_file (str, optional, default='grid_output.json')
|
|
29
|
+
Output file for the generated grid points (default: 'grid_output.json').
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Example
|
|
33
|
+
-------
|
|
34
|
+
To generate a grid of simulation points, execute the script as follows:
|
|
35
|
+
|
|
36
|
+
.. code-block:: console
|
|
37
|
+
|
|
38
|
+
simtools-production-generate-grid --site North --model_version 6.0.0 \
|
|
39
|
+
--axes tests/resources/production_grid_generation_axes_definition.yml \
|
|
40
|
+
--coordinate_system ra_dec --observing_time "2017-09-16 00:00:00" \
|
|
41
|
+
--lookup_table tests/resources/corsika_simulation_limits_lookup.ecsv \
|
|
42
|
+
--telescope_ids 1
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
import logging
|
|
46
|
+
from pathlib import Path
|
|
47
|
+
|
|
48
|
+
from astropy.coordinates import EarthLocation
|
|
49
|
+
from astropy.time import Time
|
|
50
|
+
|
|
51
|
+
from simtools.configuration import configurator
|
|
52
|
+
from simtools.io_operations import io_handler
|
|
53
|
+
from simtools.model.site_model import SiteModel
|
|
54
|
+
from simtools.production_configuration.generate_production_grid import GridGeneration
|
|
55
|
+
from simtools.utils.general import collect_data_from_file
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _parse(label, description):
|
|
59
|
+
"""
|
|
60
|
+
Parse command line configuration.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
axes (str, required)
|
|
65
|
+
Path to a YAML or JSON file defining the axes of the grid.
|
|
66
|
+
coordinate_system (str, optional, default='zenith_azimuth')
|
|
67
|
+
The coordinate system for the grid generation ('zenith_azimuth' or 'ra_dec').
|
|
68
|
+
observing_time (str, optional, default=now)
|
|
69
|
+
Time of the observation (format: 'YYYY-MM-DD HH:MM:SS').
|
|
70
|
+
lookup_table (str, required)
|
|
71
|
+
Path to the lookup table for simulation limits. The table should contain
|
|
72
|
+
varying azimuth and/or zenith angles.
|
|
73
|
+
telescope_ids (list of int, optional)
|
|
74
|
+
List of telescope IDs as used in sim_telarray to filter the events.
|
|
75
|
+
output_file (str, optional, default='grid_output.json')
|
|
76
|
+
Output file for the generated grid points (default: 'grid_output.json').
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
CommandLineParser
|
|
82
|
+
Command line parser object.
|
|
83
|
+
"""
|
|
84
|
+
config = configurator.Configurator(label=label, description=description)
|
|
85
|
+
|
|
86
|
+
config.parser.add_argument(
|
|
87
|
+
"--axes",
|
|
88
|
+
type=str,
|
|
89
|
+
required=True,
|
|
90
|
+
help="Path to a file defining the grid axes.",
|
|
91
|
+
)
|
|
92
|
+
config.parser.add_argument(
|
|
93
|
+
"--coordinate_system",
|
|
94
|
+
type=str,
|
|
95
|
+
default="zenith_azimuth",
|
|
96
|
+
help="Coordinate system ('zenith_azimuth' or 'ra_dec').",
|
|
97
|
+
)
|
|
98
|
+
config.parser.add_argument(
|
|
99
|
+
"--observing_time",
|
|
100
|
+
type=str,
|
|
101
|
+
required=False,
|
|
102
|
+
help="Time of the observation (format: 'YYYY-MM-DD HH:MM:SS').",
|
|
103
|
+
)
|
|
104
|
+
config.parser.add_argument(
|
|
105
|
+
"--output_file",
|
|
106
|
+
type=str,
|
|
107
|
+
default="grid_output.json",
|
|
108
|
+
help="Output file for the generated grid points (default: 'grid_output.json').",
|
|
109
|
+
)
|
|
110
|
+
config.parser.add_argument(
|
|
111
|
+
"--telescope_ids",
|
|
112
|
+
type=int,
|
|
113
|
+
nargs="*",
|
|
114
|
+
default=None,
|
|
115
|
+
help="List of telescope IDs as used in sim_telarray to get the specific limits from the "
|
|
116
|
+
"lookup table.",
|
|
117
|
+
)
|
|
118
|
+
config.parser.add_argument(
|
|
119
|
+
"--lookup_table",
|
|
120
|
+
type=str,
|
|
121
|
+
required=True,
|
|
122
|
+
help="Path to the lookup table for simulation limits. "
|
|
123
|
+
"Table required with varying azimuth and or zenith angle. ",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
return config.initialize(db_config=True, simulation_model=["version", "site", "model_version"])
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def load_axes(file_path: str):
|
|
130
|
+
"""
|
|
131
|
+
Load axes definitions from a YAML or JSON file.
|
|
132
|
+
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
file_path : str
|
|
136
|
+
Path to the axes YAML or JSON file.
|
|
137
|
+
|
|
138
|
+
Returns
|
|
139
|
+
-------
|
|
140
|
+
list[dict]
|
|
141
|
+
List of axes definitions with Quantity values.
|
|
142
|
+
"""
|
|
143
|
+
if not Path(file_path).exists():
|
|
144
|
+
raise FileNotFoundError(f"Axes file {file_path} not found.")
|
|
145
|
+
|
|
146
|
+
return collect_data_from_file(file_path)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def main():
|
|
150
|
+
"""Run the Grid Generation application."""
|
|
151
|
+
label = Path(__file__).stem
|
|
152
|
+
args_dict, db_config = _parse(
|
|
153
|
+
label,
|
|
154
|
+
"Generate a grid of simulation points using flexible axes definitions.",
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
_logger = logging.getLogger()
|
|
158
|
+
_logger.setLevel(logging.INFO)
|
|
159
|
+
|
|
160
|
+
output_path = io_handler.IOHandler().get_output_directory(label)
|
|
161
|
+
output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
|
|
162
|
+
|
|
163
|
+
axes = load_axes(args_dict["axes"])
|
|
164
|
+
site_model = SiteModel(
|
|
165
|
+
mongo_db_config=db_config,
|
|
166
|
+
model_version=args_dict["model_version"],
|
|
167
|
+
site=args_dict["site"],
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
ref_lat = site_model.get_parameter_value_with_unit("reference_point_latitude")
|
|
171
|
+
ref_long = site_model.get_parameter_value_with_unit("reference_point_longitude")
|
|
172
|
+
altitude = site_model.get_parameter_value_with_unit("reference_point_altitude")
|
|
173
|
+
|
|
174
|
+
observing_location = EarthLocation(lat=ref_lat, lon=ref_long, height=altitude)
|
|
175
|
+
|
|
176
|
+
observing_time = (
|
|
177
|
+
Time(args_dict["observing_time"]) if args_dict.get("observing_time") else Time.now()
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
grid_gen = GridGeneration(
|
|
181
|
+
axes=axes,
|
|
182
|
+
coordinate_system=args_dict["coordinate_system"],
|
|
183
|
+
observing_location=observing_location,
|
|
184
|
+
observing_time=observing_time,
|
|
185
|
+
lookup_table=args_dict["lookup_table"],
|
|
186
|
+
telescope_ids=args_dict["telescope_ids"],
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
grid_points = grid_gen.generate_grid()
|
|
190
|
+
|
|
191
|
+
if args_dict["coordinate_system"] == "ra_dec":
|
|
192
|
+
grid_points = grid_gen.convert_coordinates(grid_points)
|
|
193
|
+
grid_gen.serialize_grid_points(grid_points, output_file=output_filepath)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
if __name__ == "__main__":
|
|
197
|
+
main()
|
|
@@ -31,8 +31,6 @@ nsb (float, required)
|
|
|
31
31
|
file_path (str, required)
|
|
32
32
|
Path to file with MC events at CTAO DL2 data level.
|
|
33
33
|
Used for statistical uncertainty evaluation.
|
|
34
|
-
file_type (str, required)
|
|
35
|
-
Type of the DL2 MC event file ('point-like' or 'cone').
|
|
36
34
|
metrics (str, required)
|
|
37
35
|
Path to a YAML file containing metrics for evaluation.
|
|
38
36
|
site (str, required)
|
|
@@ -46,7 +44,6 @@ To run the simulation configuration, execute the script as follows:
|
|
|
46
44
|
|
|
47
45
|
simtools-production-generate-simulation-config --azimuth 60.0 --elevation 45.0 \
|
|
48
46
|
--nsb 0.3 --file_path tests/resources/production_dl2_fits/dl2_mc_events_file.fits \
|
|
49
|
-
--file_type "point-like" \
|
|
50
47
|
--metrics_file tests/resources/production_simulation_config_metrics.yml --site North
|
|
51
48
|
|
|
52
49
|
The output will show the derived simulation parameters.
|
|
@@ -85,12 +82,6 @@ def _parse(label):
|
|
|
85
82
|
config.parser.add_argument(
|
|
86
83
|
"--file_path", type=str, required=True, help="Path to MC event file in DL2 format."
|
|
87
84
|
)
|
|
88
|
-
config.parser.add_argument(
|
|
89
|
-
"--file_type",
|
|
90
|
-
type=str,
|
|
91
|
-
required=True,
|
|
92
|
-
help="Type of the DL2 MC event file ('point-like' or 'cone').",
|
|
93
|
-
)
|
|
94
85
|
config.parser.add_argument(
|
|
95
86
|
"--metrics_file",
|
|
96
87
|
required=True,
|
|
@@ -138,7 +129,6 @@ def main():
|
|
|
138
129
|
simulation_config = SimulationConfig(
|
|
139
130
|
grid_point=grid_point_config,
|
|
140
131
|
file_path=args_dict["file_path"],
|
|
141
|
-
file_type=args_dict["file_type"],
|
|
142
132
|
metrics=metrics,
|
|
143
133
|
)
|
|
144
134
|
|
|
@@ -45,7 +45,7 @@ model_version (str, optional)
|
|
|
45
45
|
Version of the simulation model.
|
|
46
46
|
light_source_type (str, optional)
|
|
47
47
|
Select calibration light source type: led (default) or laser.
|
|
48
|
-
This changes the pre-compiled (
|
|
48
|
+
This changes the pre-compiled (sim_telarray) application that is used to run the
|
|
49
49
|
light emission package with. Currently we use xyzls (laser), and ls-beam can be
|
|
50
50
|
accessed by using the laser option.
|
|
51
51
|
off_axis_angle (float, optional)
|
|
@@ -116,8 +116,7 @@ import astropy.units as u
|
|
|
116
116
|
import simtools.utils.general as gen
|
|
117
117
|
from simtools.configuration import configurator
|
|
118
118
|
from simtools.model.calibration_model import CalibrationModel
|
|
119
|
-
from simtools.model.
|
|
120
|
-
from simtools.model.telescope_model import TelescopeModel
|
|
119
|
+
from simtools.model.model_utils import initialize_simulation_models
|
|
121
120
|
from simtools.simtel.simulator_light_emission import SimulatorLightEmission
|
|
122
121
|
|
|
123
122
|
|
|
@@ -298,12 +297,12 @@ def main():
|
|
|
298
297
|
logger = logging.getLogger()
|
|
299
298
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
300
299
|
|
|
301
|
-
telescope_model =
|
|
300
|
+
telescope_model, site_model = initialize_simulation_models(
|
|
301
|
+
label=label,
|
|
302
|
+
db_config=db_config,
|
|
302
303
|
site=args_dict["site"],
|
|
303
304
|
telescope_name=args_dict["telescope"],
|
|
304
|
-
mongo_db_config=db_config,
|
|
305
305
|
model_version=args_dict["model_version"],
|
|
306
|
-
label=label,
|
|
307
306
|
)
|
|
308
307
|
|
|
309
308
|
calibration_model = CalibrationModel(
|
|
@@ -314,13 +313,6 @@ def main():
|
|
|
314
313
|
label=label,
|
|
315
314
|
)
|
|
316
315
|
|
|
317
|
-
site_model = SiteModel(
|
|
318
|
-
site=args_dict["site"],
|
|
319
|
-
mongo_db_config=db_config,
|
|
320
|
-
model_version=args_dict["model_version"],
|
|
321
|
-
label=label,
|
|
322
|
-
)
|
|
323
|
-
|
|
324
316
|
light_source = SimulatorLightEmission(
|
|
325
317
|
telescope_model=telescope_model,
|
|
326
318
|
calibration_model=calibration_model,
|
|
@@ -122,15 +122,26 @@ def _parse(description=None):
|
|
|
122
122
|
required=False,
|
|
123
123
|
default=False,
|
|
124
124
|
)
|
|
125
|
-
config.parser.
|
|
126
|
-
"
|
|
125
|
+
sim_telarray_seed_group = config.parser.add_argument_group(
|
|
126
|
+
title="Random seeds for sim_telarray instrument setup",
|
|
127
|
+
)
|
|
128
|
+
sim_telarray_seed_group.add_argument(
|
|
129
|
+
"--sim_telarray_instrument_seeds",
|
|
127
130
|
help=(
|
|
128
|
-
"
|
|
129
|
-
"
|
|
131
|
+
"Random seed used for sim_telarray instrument setup. "
|
|
132
|
+
"If '--sim_telarray_random_instrument_instances is not set: use as sim_telarray seed "
|
|
133
|
+
" ('random_seed' parameter). "
|
|
134
|
+
"Otherwise: use as base seed for the generation of random instrument instance seeds."
|
|
130
135
|
),
|
|
131
136
|
type=str,
|
|
132
137
|
required=False,
|
|
133
138
|
)
|
|
139
|
+
sim_telarray_seed_group.add_argument(
|
|
140
|
+
"--sim_telarray_random_instrument_instances",
|
|
141
|
+
help="Number of random instrument instances initialized in sim_telarray.",
|
|
142
|
+
type=int,
|
|
143
|
+
required=False,
|
|
144
|
+
)
|
|
134
145
|
return config.initialize(
|
|
135
146
|
db_config=True,
|
|
136
147
|
job_submission=True,
|
|
@@ -150,6 +161,7 @@ def main(): # noqa: D103
|
|
|
150
161
|
)
|
|
151
162
|
|
|
152
163
|
simulator.simulate()
|
|
164
|
+
simulator.validate_metadata()
|
|
153
165
|
|
|
154
166
|
if simulator.submit_engine == "local":
|
|
155
167
|
logger.info(
|
|
@@ -80,7 +80,7 @@ import numpy as np
|
|
|
80
80
|
import simtools.utils.general as gen
|
|
81
81
|
from simtools.configuration import configurator
|
|
82
82
|
from simtools.io_operations import io_handler
|
|
83
|
-
from simtools.model.
|
|
83
|
+
from simtools.model.model_utils import initialize_simulation_models
|
|
84
84
|
from simtools.ray_tracing.ray_tracing import RayTracing
|
|
85
85
|
from simtools.visualization import visualize
|
|
86
86
|
|
|
@@ -136,18 +136,20 @@ def main(): # noqa: D103
|
|
|
136
136
|
_io_handler = io_handler.IOHandler()
|
|
137
137
|
output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
|
|
138
138
|
|
|
139
|
-
tel_model =
|
|
139
|
+
tel_model, site_model = initialize_simulation_models(
|
|
140
|
+
label=label,
|
|
141
|
+
db_config=db_config,
|
|
140
142
|
site=args_dict["site"],
|
|
141
143
|
telescope_name=args_dict["telescope"],
|
|
142
|
-
mongo_db_config=db_config,
|
|
143
144
|
model_version=args_dict["model_version"],
|
|
144
|
-
label=label,
|
|
145
145
|
)
|
|
146
|
+
|
|
146
147
|
if args_dict.get("telescope_model_file"):
|
|
147
148
|
tel_model.change_multiple_parameters_from_file(args_dict["telescope_model_file"])
|
|
148
149
|
|
|
149
150
|
ray = RayTracing(
|
|
150
151
|
telescope_model=tel_model,
|
|
152
|
+
site_model=site_model,
|
|
151
153
|
simtel_path=args_dict["simtel_path"],
|
|
152
154
|
zenith_angle=args_dict["zenith"] * u.deg,
|
|
153
155
|
source_distance=args_dict["src_distance"] * u.km,
|
|
@@ -131,6 +131,7 @@ def validate_dict_using_schema(args_dict, logger):
|
|
|
131
131
|
"""
|
|
132
132
|
Validate a schema file (or several files) given in yaml or json format.
|
|
133
133
|
|
|
134
|
+
This function validate all documents in a multi-document YAML file.
|
|
134
135
|
Schema is either given as command line argument, read from the meta_schema_url or from
|
|
135
136
|
the metadata section of the data dictionary.
|
|
136
137
|
|
|
@@ -141,9 +142,12 @@ def validate_dict_using_schema(args_dict, logger):
|
|
|
141
142
|
try:
|
|
142
143
|
data = gen.collect_data_from_file(file_name=file_name)
|
|
143
144
|
except FileNotFoundError as exc:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
raise FileNotFoundError(f"Error reading schema file from {file_name}") from exc
|
|
146
|
+
data = data if isinstance(data, list) else [data]
|
|
147
|
+
for data_dict in data:
|
|
148
|
+
schema.validate_dict_using_schema(
|
|
149
|
+
data_dict, _get_schema_file_name(args_dict, data_dict)
|
|
150
|
+
)
|
|
147
151
|
logger.info(f"Successful validation of file {file_name}")
|
|
148
152
|
|
|
149
153
|
|
|
@@ -76,7 +76,7 @@ from matplotlib.backends.backend_pdf import PdfPages
|
|
|
76
76
|
import simtools.utils.general as gen
|
|
77
77
|
from simtools.configuration import configurator
|
|
78
78
|
from simtools.io_operations import io_handler
|
|
79
|
-
from simtools.model.
|
|
79
|
+
from simtools.model.model_utils import initialize_simulation_models
|
|
80
80
|
from simtools.ray_tracing.ray_tracing import RayTracing
|
|
81
81
|
from simtools.visualization import visualize
|
|
82
82
|
|
|
@@ -128,12 +128,12 @@ def main(): # noqa: D103
|
|
|
128
128
|
_io_handler = io_handler.IOHandler()
|
|
129
129
|
output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
|
|
130
130
|
|
|
131
|
-
tel_model =
|
|
131
|
+
tel_model, site_model = initialize_simulation_models(
|
|
132
|
+
label=label,
|
|
133
|
+
db_config=db_config,
|
|
132
134
|
site=args_dict["site"],
|
|
133
135
|
telescope_name=args_dict["telescope"],
|
|
134
136
|
model_version=args_dict["model_version"],
|
|
135
|
-
label=label,
|
|
136
|
-
mongo_db_config=db_config,
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
######################################################################
|
|
@@ -151,6 +151,7 @@ def main(): # noqa: D103
|
|
|
151
151
|
|
|
152
152
|
ray = RayTracing(
|
|
153
153
|
telescope_model=tel_model,
|
|
154
|
+
site_model=site_model,
|
|
154
155
|
simtel_path=args_dict["simtel_path"],
|
|
155
156
|
zenith_angle=args_dict["zenith"] * u.deg,
|
|
156
157
|
source_distance=args_dict["src_distance"] * u.km,
|
|
@@ -9,8 +9,7 @@ import numpy as np
|
|
|
9
9
|
from astropy.table import Table
|
|
10
10
|
|
|
11
11
|
from simtools.io_operations import io_handler
|
|
12
|
-
from simtools.model.
|
|
13
|
-
from simtools.model.telescope_model import TelescopeModel
|
|
12
|
+
from simtools.model.model_utils import initialize_simulation_models
|
|
14
13
|
from simtools.simtel.simulator_camera_efficiency import SimulatorCameraEfficiency
|
|
15
14
|
from simtools.utils import names
|
|
16
15
|
from simtools.visualization import visualize
|
|
@@ -52,8 +51,12 @@ class CameraEfficiency:
|
|
|
52
51
|
self.test = test
|
|
53
52
|
|
|
54
53
|
self.io_handler = io_handler.IOHandler()
|
|
55
|
-
self.telescope_model, self.
|
|
56
|
-
|
|
54
|
+
self.telescope_model, self.site_model = initialize_simulation_models(
|
|
55
|
+
self.label,
|
|
56
|
+
db_config,
|
|
57
|
+
config_data["site"],
|
|
58
|
+
config_data["telescope"],
|
|
59
|
+
config_data["model_version"],
|
|
57
60
|
)
|
|
58
61
|
self.output_dir = self.io_handler.get_output_directory(self.label, sub_dir="plots")
|
|
59
62
|
|
|
@@ -67,34 +70,6 @@ class CameraEfficiency:
|
|
|
67
70
|
"""Return string representation of the CameraEfficiency instance."""
|
|
68
71
|
return f"CameraEfficiency(label={self.label})\n"
|
|
69
72
|
|
|
70
|
-
def _initialize_simulation_models(self, config_data, db_config):
|
|
71
|
-
"""
|
|
72
|
-
Initialize site and telescope models.
|
|
73
|
-
|
|
74
|
-
Parameters
|
|
75
|
-
----------
|
|
76
|
-
config_data: dict
|
|
77
|
-
Dict containing the configurable parameters.
|
|
78
|
-
|
|
79
|
-
Returns
|
|
80
|
-
-------
|
|
81
|
-
tuple
|
|
82
|
-
Tuple containing the site and telescope models.
|
|
83
|
-
"""
|
|
84
|
-
tel_model = TelescopeModel(
|
|
85
|
-
site=config_data["site"],
|
|
86
|
-
telescope_name=config_data["telescope"],
|
|
87
|
-
mongo_db_config=db_config,
|
|
88
|
-
model_version=config_data["model_version"],
|
|
89
|
-
label=self.label,
|
|
90
|
-
)
|
|
91
|
-
site_model = SiteModel(
|
|
92
|
-
site=config_data["site"],
|
|
93
|
-
model_version=config_data["model_version"],
|
|
94
|
-
mongo_db_config=db_config,
|
|
95
|
-
)
|
|
96
|
-
return tel_model, site_model
|
|
97
|
-
|
|
98
73
|
def _configuration_from_args_dict(self, config_data):
|
|
99
74
|
"""
|
|
100
75
|
Extract the configuration data from the args_dict.
|
|
@@ -131,10 +106,10 @@ class CameraEfficiency:
|
|
|
131
106
|
}
|
|
132
107
|
|
|
133
108
|
def _load_files(self):
|
|
134
|
-
"""Define
|
|
109
|
+
"""Define variables used for file names, including results, sim_telarray and log files."""
|
|
135
110
|
_file = {}
|
|
136
111
|
for label, suffix in zip(
|
|
137
|
-
["results", "
|
|
112
|
+
["results", "sim_telarray", "log"],
|
|
138
113
|
[".ecsv", ".dat", ".log"],
|
|
139
114
|
):
|
|
140
115
|
file_name = names.generate_file_name(
|
|
@@ -164,8 +139,9 @@ class CameraEfficiency:
|
|
|
164
139
|
simtel = SimulatorCameraEfficiency(
|
|
165
140
|
simtel_path=self._simtel_path,
|
|
166
141
|
telescope_model=self.telescope_model,
|
|
142
|
+
site_model=self.site_model,
|
|
167
143
|
zenith_angle=self.config["zenith_angle"],
|
|
168
|
-
file_simtel=self._file["
|
|
144
|
+
file_simtel=self._file["sim_telarray"],
|
|
169
145
|
file_log=self._file["log"],
|
|
170
146
|
label=self.label,
|
|
171
147
|
nsb_spectrum=self.config["nsb_spectrum"],
|
|
@@ -177,8 +153,7 @@ class CameraEfficiency:
|
|
|
177
153
|
|
|
178
154
|
def export_model_files(self):
|
|
179
155
|
"""Export model and config files to the output directory."""
|
|
180
|
-
self.telescope_model.
|
|
181
|
-
self.telescope_model.export_model_files()
|
|
156
|
+
self.telescope_model.write_sim_telarray_config_file()
|
|
182
157
|
if not self.config.get("skip_correction_to_nsb_spectrum", False):
|
|
183
158
|
self.telescope_model.export_nsb_spectrum_to_telescope_altitude_correction_file(
|
|
184
159
|
model_directory=self.telescope_model.config_file_directory
|
|
@@ -237,7 +212,7 @@ class CameraEfficiency:
|
|
|
237
212
|
|
|
238
213
|
# Search for at least 5 consecutive numbers to see that we are in the table
|
|
239
214
|
re_table = re.compile("{0}{0}{0}{0}{0}".format(r"[-+]?[0-9]*\.?[0-9]+\s+"))
|
|
240
|
-
with open(self._file["
|
|
215
|
+
with open(self._file["sim_telarray"], encoding="utf-8") as file:
|
|
241
216
|
for line in file:
|
|
242
217
|
if re_table.match(line):
|
|
243
218
|
words = line.split()
|
|
@@ -442,7 +417,7 @@ class CameraEfficiency:
|
|
|
442
417
|
nsb_integral = 0.0001 * (n1_sum - 0.5 * n1_integral_edges_sum)
|
|
443
418
|
nsb_rate_ref_conditions = (
|
|
444
419
|
nsb_rate_provided_spectrum
|
|
445
|
-
* self.
|
|
420
|
+
* self.site_model.get_parameter_value("nsb_reference_value")
|
|
446
421
|
/ nsb_integral
|
|
447
422
|
)
|
|
448
423
|
return nsb_rate_provided_spectrum, nsb_rate_ref_conditions
|
|
@@ -50,7 +50,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
50
50
|
Add output file configuration to list of args.
|
|
51
51
|
simulation_model: list
|
|
52
52
|
List of simulation model configuration parameters to add to list of args
|
|
53
|
-
(use: '
|
|
53
|
+
(use: 'model_version', 'telescope', 'site')
|
|
54
54
|
simulation_configuration: dict
|
|
55
55
|
Dict of simulation software configuration parameters to add to list of args.
|
|
56
56
|
db_config: bool
|
|
@@ -271,6 +271,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
271
271
|
help="production model version",
|
|
272
272
|
type=str,
|
|
273
273
|
default=None,
|
|
274
|
+
nargs="+",
|
|
274
275
|
)
|
|
275
276
|
if "parameter_version" in model_options:
|
|
276
277
|
_job_group.add_argument(
|
|
@@ -341,9 +342,9 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
341
342
|
"--simulation_software",
|
|
342
343
|
help="Simulation software steps.",
|
|
343
344
|
type=str,
|
|
344
|
-
choices=["corsika", "
|
|
345
|
+
choices=["corsika", "sim_telarray", "corsika_sim_telarray"],
|
|
345
346
|
required=True,
|
|
346
|
-
default="
|
|
347
|
+
default="corsika_sim_telarray",
|
|
347
348
|
)
|
|
348
349
|
|
|
349
350
|
@staticmethod
|