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
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
r"""
|
|
4
|
-
|
|
4
|
+
Derive CORSIKA configuration limits for energy, core distance, and viewcone radius.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
This tool determines configuration limits based on triggered events from broad-range
|
|
7
|
+
simulations. It supports setting:
|
|
8
|
+
|
|
9
|
+
- **ERANGE**: Derives the lower energy limit; upper limit is user-defined.
|
|
10
|
+
- **CSCAT**: Derives the upper core distance; lower limit is user-defined.
|
|
11
|
+
- **VIEWCONE**: Derives the viewcone radius; lower limit is user-defined.
|
|
12
|
+
|
|
13
|
+
Limits are computed based on a configurable maximum event loss fraction.
|
|
14
|
+
Results are provided as a table with the following columns:
|
|
15
|
+
|
|
16
|
+
- particle_type: Particle type (e.g., gamma, proton, electron).
|
|
17
|
+
- telescope_ids: List of telescope IDs used in the simulation.
|
|
18
|
+
- zenith: Zenith angle.
|
|
19
|
+
- azimuth: Azimuth angle.
|
|
20
|
+
- nsb: Night sky background level
|
|
21
|
+
- layout: Layout of the telescope array used in the simulation.
|
|
22
|
+
- lower_energy_limit: Derived lower energy limit.
|
|
23
|
+
- upper_radius_limit: Derived upper radial distance limit.
|
|
24
|
+
- viewcone_radius: Derived upper viewcone radius limit.
|
|
25
|
+
|
|
26
|
+
The input event data files are generated using the application simtools-generate-simtel-event-data
|
|
27
|
+
and are required for each point in the lookup table.
|
|
7
28
|
|
|
8
29
|
Command line arguments
|
|
9
30
|
----------------------
|
|
10
31
|
event_data_files (str, required)
|
|
11
|
-
Path to a file containing event data
|
|
32
|
+
Path to a file containing event data files derived with 'simtools-generate-simtel-event-data'.
|
|
12
33
|
telescope_ids (str, required)
|
|
13
34
|
Path to a file containing telescope configurations.
|
|
14
35
|
loss_fraction (float, required)
|
|
15
|
-
|
|
36
|
+
Maximum event-loss fraction for limit computation.
|
|
16
37
|
plot_histograms (bool, optional)
|
|
17
38
|
Plot histograms of the event data.
|
|
18
39
|
output_file (str, optional)
|
|
@@ -32,44 +53,17 @@ Derive limits for a given file with a specified loss fraction.
|
|
|
32
53
|
--output_file corsika_simulation_limits_lookup.ecsv
|
|
33
54
|
"""
|
|
34
55
|
|
|
35
|
-
import datetime
|
|
36
56
|
import logging
|
|
37
57
|
|
|
38
|
-
from astropy.table import Table
|
|
39
|
-
|
|
40
58
|
import simtools.utils.general as gen
|
|
41
59
|
from simtools.configuration import configurator
|
|
42
|
-
from simtools.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_logger = logging.getLogger(__name__)
|
|
60
|
+
from simtools.production_configuration.derive_corsika_limits_grid import (
|
|
61
|
+
generate_corsika_limits_grid,
|
|
62
|
+
)
|
|
47
63
|
|
|
48
64
|
|
|
49
65
|
def _parse():
|
|
50
|
-
"""
|
|
51
|
-
Parse command line configuration.
|
|
52
|
-
|
|
53
|
-
Parameters
|
|
54
|
-
----------
|
|
55
|
-
event_data_files: str
|
|
56
|
-
Path to a file listing event data file paths. These files contain the
|
|
57
|
-
simulation data used for deriving the limits.
|
|
58
|
-
loss_fraction: float
|
|
59
|
-
Fraction of events to be excluded during limit computation. Determines
|
|
60
|
-
thresholds for energy, radial distance, and viewcone.
|
|
61
|
-
telescope_ids: str
|
|
62
|
-
Path to a file defining telescope configurations. Specifies telescope
|
|
63
|
-
arrays or IDs used to filter events during processing.
|
|
64
|
-
plot_histograms: bool
|
|
65
|
-
If True, generates and saves histograms of the event data to visualize
|
|
66
|
-
the computed limits and distributions.
|
|
67
|
-
|
|
68
|
-
Returns
|
|
69
|
-
-------
|
|
70
|
-
CommandLineParser
|
|
71
|
-
Command line parser object
|
|
72
|
-
"""
|
|
66
|
+
"""Parse command line configuration."""
|
|
73
67
|
config = configurator.Configurator(
|
|
74
68
|
description="Derive limits for energy, radial distance, and viewcone."
|
|
75
69
|
)
|
|
@@ -86,7 +80,10 @@ def _parse():
|
|
|
86
80
|
help="Path to a file containing telescope configurations.",
|
|
87
81
|
)
|
|
88
82
|
config.parser.add_argument(
|
|
89
|
-
"--loss_fraction",
|
|
83
|
+
"--loss_fraction",
|
|
84
|
+
type=float,
|
|
85
|
+
required=True,
|
|
86
|
+
help="Maximum event-loss fraction for limit computation.",
|
|
90
87
|
)
|
|
91
88
|
config.parser.add_argument(
|
|
92
89
|
"--plot_histograms",
|
|
@@ -94,110 +91,7 @@ def _parse():
|
|
|
94
91
|
action="store_true",
|
|
95
92
|
default=False,
|
|
96
93
|
)
|
|
97
|
-
config.
|
|
98
|
-
"--output_file",
|
|
99
|
-
type=str,
|
|
100
|
-
default="corsika_simulation_limits_lookup.ecsv",
|
|
101
|
-
help="Output file for the derived limits (default: "
|
|
102
|
-
"'corsika_simulation_limits_lookup.ecsv').",
|
|
103
|
-
)
|
|
104
|
-
return config.initialize(db_config=False)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def process_file(file_path, telescope_ids, loss_fraction, plot_histograms):
|
|
108
|
-
"""
|
|
109
|
-
Process a single file and compute limits.
|
|
110
|
-
|
|
111
|
-
Parameters
|
|
112
|
-
----------
|
|
113
|
-
file_path : str
|
|
114
|
-
Path to the event data file.
|
|
115
|
-
telescope_ids : list[int]
|
|
116
|
-
List of telescope IDs to filter the events.
|
|
117
|
-
loss_fraction : float
|
|
118
|
-
Fraction of events to be lost.
|
|
119
|
-
plot_histograms : bool
|
|
120
|
-
Whether to plot histograms.
|
|
121
|
-
|
|
122
|
-
Returns
|
|
123
|
-
-------
|
|
124
|
-
dict
|
|
125
|
-
Dictionary containing the computed limits.
|
|
126
|
-
"""
|
|
127
|
-
calculator = LimitCalculator(file_path, telescope_list=telescope_ids)
|
|
128
|
-
|
|
129
|
-
lower_energy_limit = calculator.compute_lower_energy_limit(loss_fraction)
|
|
130
|
-
upper_radial_distance = calculator.compute_upper_radial_distance(loss_fraction)
|
|
131
|
-
viewcone = calculator.compute_viewcone(loss_fraction)
|
|
132
|
-
|
|
133
|
-
if plot_histograms:
|
|
134
|
-
_logger.info(
|
|
135
|
-
f"Plotting histograms written to {io_handler.IOHandler().get_output_directory()}"
|
|
136
|
-
)
|
|
137
|
-
calculator.plot_data(
|
|
138
|
-
lower_energy_limit,
|
|
139
|
-
upper_radial_distance,
|
|
140
|
-
viewcone,
|
|
141
|
-
io_handler.IOHandler().get_output_directory(),
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
"file_path": file_path,
|
|
146
|
-
"telescope_ids": telescope_ids,
|
|
147
|
-
"lower_energy_threshold": lower_energy_limit,
|
|
148
|
-
"upper_radius_threshold": upper_radial_distance,
|
|
149
|
-
"viewcone_radius": viewcone,
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def create_results_table(results, loss_fraction):
|
|
154
|
-
"""
|
|
155
|
-
Create an Astropy Table from the results.
|
|
156
|
-
|
|
157
|
-
Parameters
|
|
158
|
-
----------
|
|
159
|
-
results : list[dict]
|
|
160
|
-
List of dictionaries containing the computed limits for each file
|
|
161
|
-
and telescope configuration.
|
|
162
|
-
loss_fraction : float
|
|
163
|
-
Fraction of events to be lost, added as metadata to the table.
|
|
164
|
-
|
|
165
|
-
Returns
|
|
166
|
-
-------
|
|
167
|
-
astropy.table.Table
|
|
168
|
-
An Astropy Table containing the results with appropriate units and metadata.
|
|
169
|
-
"""
|
|
170
|
-
table = Table(
|
|
171
|
-
rows=[
|
|
172
|
-
(
|
|
173
|
-
res["file_path"],
|
|
174
|
-
res["telescope_ids"],
|
|
175
|
-
res["lower_energy_threshold"],
|
|
176
|
-
res["upper_radius_threshold"],
|
|
177
|
-
res["viewcone_radius"],
|
|
178
|
-
)
|
|
179
|
-
for res in results
|
|
180
|
-
],
|
|
181
|
-
names=[
|
|
182
|
-
"file_path",
|
|
183
|
-
"telescope_ids",
|
|
184
|
-
"lower_energy_threshold",
|
|
185
|
-
"upper_radius_threshold",
|
|
186
|
-
"viewcone_radius",
|
|
187
|
-
],
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
table["lower_energy_threshold"].unit = "TeV"
|
|
191
|
-
table["upper_radius_threshold"].unit = "m"
|
|
192
|
-
table["viewcone_radius"].unit = "deg"
|
|
193
|
-
|
|
194
|
-
table.meta["created"] = datetime.datetime.now().isoformat()
|
|
195
|
-
table.meta["description"] = (
|
|
196
|
-
"Lookup table for CORSIKA limits computed from gamma-ray shower simulations."
|
|
197
|
-
)
|
|
198
|
-
table.meta["loss_fraction"] = loss_fraction
|
|
199
|
-
|
|
200
|
-
return table
|
|
94
|
+
return config.initialize(db_config=False, output=True)
|
|
201
95
|
|
|
202
96
|
|
|
203
97
|
def main():
|
|
@@ -207,33 +101,7 @@ def main():
|
|
|
207
101
|
logger = logging.getLogger()
|
|
208
102
|
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "info")))
|
|
209
103
|
|
|
210
|
-
|
|
211
|
-
telescope_configs = gen.collect_data_from_file(args_dict["telescope_ids"])["telescope_configs"]
|
|
212
|
-
|
|
213
|
-
results = []
|
|
214
|
-
for file_path in event_data_files:
|
|
215
|
-
for array_name, telescope_ids in telescope_configs.items():
|
|
216
|
-
_logger.info(f"Processing file: {file_path} with telescope config: {array_name}")
|
|
217
|
-
result = process_file(
|
|
218
|
-
file_path,
|
|
219
|
-
telescope_ids,
|
|
220
|
-
args_dict["loss_fraction"],
|
|
221
|
-
args_dict["plot_histograms"],
|
|
222
|
-
)
|
|
223
|
-
result["layout"] = array_name
|
|
224
|
-
results.append(result)
|
|
225
|
-
|
|
226
|
-
table = create_results_table(results, args_dict["loss_fraction"])
|
|
227
|
-
|
|
228
|
-
output_dir = io_handler.IOHandler().get_output_directory("corsika_limits")
|
|
229
|
-
output_file = f"{output_dir}/{args_dict['output_file']}"
|
|
230
|
-
|
|
231
|
-
table.write(output_file, format="ascii.ecsv", overwrite=True)
|
|
232
|
-
_logger.info(f"Results saved to {output_file}")
|
|
233
|
-
|
|
234
|
-
metadata_file = f"{output_dir}/metadata.yml"
|
|
235
|
-
MetadataCollector.dump(args_dict, metadata_file)
|
|
236
|
-
_logger.info(f"Metadata saved to {metadata_file}")
|
|
104
|
+
generate_corsika_limits_grid(args_dict)
|
|
237
105
|
|
|
238
106
|
|
|
239
107
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Derive the required number of events for MC productions for a grid of observational conditions.
|
|
5
|
+
|
|
6
|
+
This application evaluates statistical uncertainties from the analysis of events after the
|
|
7
|
+
application of loose gamma/hadron separation cuts, then interpolates the derived number of required
|
|
8
|
+
events for the specified grid points provided in a file. The resulting grid points will have the
|
|
9
|
+
derived number of required events added.
|
|
10
|
+
|
|
11
|
+
The metric for the required uncertainty is pre-defined and must be configured via the metrics file.
|
|
12
|
+
|
|
13
|
+
Command line arguments
|
|
14
|
+
----------------------
|
|
15
|
+
grid_points_production_file (str, required)
|
|
16
|
+
Path to the file containing grid points. Each grid point should include azimuth, zenith, NSB,
|
|
17
|
+
offset.
|
|
18
|
+
metrics_file (str, optional)
|
|
19
|
+
Path to the metrics definition file. Default: 'production_simulation_config_metrics.yml'.
|
|
20
|
+
base_path (str, required)
|
|
21
|
+
Path to the directory containing the event files for interpolation (after loose gamma/hadron
|
|
22
|
+
cuts).
|
|
23
|
+
file_name_template (str, optional)
|
|
24
|
+
Template for the event file name. Default:
|
|
25
|
+
'prod6_LaPalma-{zenith}deg_gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits'.
|
|
26
|
+
plot_production_statistics (flag, optional)
|
|
27
|
+
If provided, plots the production statistics. Default: False.
|
|
28
|
+
|
|
29
|
+
Example
|
|
30
|
+
-------
|
|
31
|
+
To evaluate statistical uncertainties and perform interpolation, run the command line script:
|
|
32
|
+
|
|
33
|
+
.. code-block:: console
|
|
34
|
+
|
|
35
|
+
simtools-production-derive-statistics \\
|
|
36
|
+
--grid_points_production_file path/to/grid_points_production.json \\
|
|
37
|
+
--metrics_file "path/to/metrics.yaml" \\
|
|
38
|
+
--base_path path/to/production_event_files/ \\
|
|
39
|
+
--file_name_template "prod6_LaPalma-{zenith}deg\\
|
|
40
|
+
_gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits" \\
|
|
41
|
+
--zeniths 20 40 52 60 \\
|
|
42
|
+
--offsets 0 \\
|
|
43
|
+
--azimuths 180 \\
|
|
44
|
+
--nsb 0.0 \\
|
|
45
|
+
--plot_production_statistics
|
|
46
|
+
|
|
47
|
+
Output
|
|
48
|
+
------
|
|
49
|
+
The output will be a file containing the grid points with the derived number of required events
|
|
50
|
+
added.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
import logging
|
|
54
|
+
from pathlib import Path
|
|
55
|
+
|
|
56
|
+
from simtools.configuration import configurator
|
|
57
|
+
from simtools.io_operations import io_handler
|
|
58
|
+
from simtools.production_configuration.derive_production_statistics_handler import (
|
|
59
|
+
ProductionStatisticsHandler,
|
|
60
|
+
)
|
|
61
|
+
from simtools.utils import general as gen
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _parse(label, description):
|
|
65
|
+
"""
|
|
66
|
+
Parse command line arguments for the statistical error evaluator application.
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
-------
|
|
70
|
+
argparse.Namespace
|
|
71
|
+
Parsed command line arguments.
|
|
72
|
+
"""
|
|
73
|
+
config = configurator.Configurator(label=label, description=description)
|
|
74
|
+
|
|
75
|
+
config.parser.add_argument(
|
|
76
|
+
"--grid_points_production_file",
|
|
77
|
+
type=str,
|
|
78
|
+
required=True,
|
|
79
|
+
help="Path to the JSON file containing grid points for a production.",
|
|
80
|
+
)
|
|
81
|
+
config.parser.add_argument(
|
|
82
|
+
"--metrics_file",
|
|
83
|
+
required=True,
|
|
84
|
+
type=str,
|
|
85
|
+
default=None,
|
|
86
|
+
help="Metrics definition file. (default: production_simulation_config_metrics.yml)",
|
|
87
|
+
)
|
|
88
|
+
config.parser.add_argument(
|
|
89
|
+
"--base_path",
|
|
90
|
+
type=str,
|
|
91
|
+
required=True,
|
|
92
|
+
help="Path to the DL2 MC event files for interpolation.",
|
|
93
|
+
)
|
|
94
|
+
config.parser.add_argument(
|
|
95
|
+
"--file_name_template",
|
|
96
|
+
required=False,
|
|
97
|
+
type=str,
|
|
98
|
+
default=("prod6_LaPalma-{zenith}deg_gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits"),
|
|
99
|
+
help=("Template for the DL2 MC event file name."),
|
|
100
|
+
)
|
|
101
|
+
config.parser.add_argument(
|
|
102
|
+
"--zeniths",
|
|
103
|
+
required=True,
|
|
104
|
+
nargs="+",
|
|
105
|
+
type=float,
|
|
106
|
+
help="List of zenith angles in deg that describe the supplied DL2 files.",
|
|
107
|
+
)
|
|
108
|
+
config.parser.add_argument(
|
|
109
|
+
"--azimuths",
|
|
110
|
+
required=True,
|
|
111
|
+
nargs="+",
|
|
112
|
+
type=float,
|
|
113
|
+
help="List of azimuth angles in deg that describe the supplied DL2 files.",
|
|
114
|
+
)
|
|
115
|
+
config.parser.add_argument(
|
|
116
|
+
"--nsb",
|
|
117
|
+
required=True,
|
|
118
|
+
nargs="+",
|
|
119
|
+
type=float,
|
|
120
|
+
help="List of nsb values that describe the supplied DL2 files.",
|
|
121
|
+
)
|
|
122
|
+
config.parser.add_argument(
|
|
123
|
+
"--offsets",
|
|
124
|
+
required=True,
|
|
125
|
+
nargs="+",
|
|
126
|
+
type=float,
|
|
127
|
+
help="List of camera offsets in deg that describe the supplied DL2 files.",
|
|
128
|
+
)
|
|
129
|
+
config.parser.add_argument(
|
|
130
|
+
"--plot_production_statistics",
|
|
131
|
+
required=False,
|
|
132
|
+
action="store_true",
|
|
133
|
+
default=False,
|
|
134
|
+
help="Plot production statistics.",
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
return config.initialize(db_config=False, output=True)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def main():
|
|
141
|
+
"""Run the ProductionStatisticsHandler."""
|
|
142
|
+
label = Path(__file__).stem
|
|
143
|
+
|
|
144
|
+
args_dict, _ = _parse(
|
|
145
|
+
label,
|
|
146
|
+
"Evaluate statistical uncertainties from DL2 MC event files and interpolate results.",
|
|
147
|
+
)
|
|
148
|
+
logger = logging.getLogger()
|
|
149
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
150
|
+
|
|
151
|
+
_io_handler = io_handler.IOHandler()
|
|
152
|
+
output_path = _io_handler.get_output_directory(label, sub_dir="")
|
|
153
|
+
|
|
154
|
+
manager = ProductionStatisticsHandler(args_dict, output_path=output_path)
|
|
155
|
+
manager.run()
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if __name__ == "__main__":
|
|
159
|
+
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()
|
|
@@ -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,
|
|
@@ -330,6 +322,7 @@ def main():
|
|
|
330
322
|
simtel_path=args_dict["simtel_path"],
|
|
331
323
|
light_source_type=args_dict["light_source_type"],
|
|
332
324
|
label=label,
|
|
325
|
+
test=args_dict["test"],
|
|
333
326
|
)
|
|
334
327
|
|
|
335
328
|
if args_dict["light_source_setup"] == "variable":
|