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
|
@@ -115,6 +115,16 @@ def _parse(description=None):
|
|
|
115
115
|
required=False,
|
|
116
116
|
default=False,
|
|
117
117
|
)
|
|
118
|
+
config.parser.add_argument(
|
|
119
|
+
"--save_reduced_event_lists",
|
|
120
|
+
help=(
|
|
121
|
+
"Save reduced event lists with event data on simulated and triggered events. "
|
|
122
|
+
"Saved with the same name as the sim_telarray output file (different extension). "
|
|
123
|
+
),
|
|
124
|
+
action="store_true",
|
|
125
|
+
required=False,
|
|
126
|
+
default=False,
|
|
127
|
+
)
|
|
118
128
|
config.parser.add_argument(
|
|
119
129
|
"--corsika_test_seeds",
|
|
120
130
|
help="Use predefined random seeds for CORSIKA for testing purposes.",
|
|
@@ -123,17 +133,36 @@ def _parse(description=None):
|
|
|
123
133
|
default=False,
|
|
124
134
|
)
|
|
125
135
|
config.parser.add_argument(
|
|
126
|
-
"--
|
|
136
|
+
"--sequential",
|
|
137
|
+
help=(
|
|
138
|
+
"Enables single-core mode (as far as possible); "
|
|
139
|
+
"otherwise, CORSIKA and sim_telarray run in parallel."
|
|
140
|
+
),
|
|
141
|
+
action="store_true",
|
|
142
|
+
default=False,
|
|
143
|
+
)
|
|
144
|
+
sim_telarray_seed_group = config.parser.add_argument_group(
|
|
145
|
+
title="Random seeds for sim_telarray instrument setup",
|
|
146
|
+
)
|
|
147
|
+
sim_telarray_seed_group.add_argument(
|
|
148
|
+
"--sim_telarray_instrument_seeds",
|
|
127
149
|
help=(
|
|
128
|
-
"
|
|
129
|
-
"
|
|
150
|
+
"Random seed used for sim_telarray instrument setup. "
|
|
151
|
+
"If '--sim_telarray_random_instrument_instances is not set: use as sim_telarray seed "
|
|
152
|
+
" ('random_seed' parameter). "
|
|
153
|
+
"Otherwise: use as base seed for the generation of random instrument instance seeds."
|
|
130
154
|
),
|
|
131
155
|
type=str,
|
|
132
156
|
required=False,
|
|
133
157
|
)
|
|
158
|
+
sim_telarray_seed_group.add_argument(
|
|
159
|
+
"--sim_telarray_random_instrument_instances",
|
|
160
|
+
help="Number of random instrument instances initialized in sim_telarray.",
|
|
161
|
+
type=int,
|
|
162
|
+
required=False,
|
|
163
|
+
)
|
|
134
164
|
return config.initialize(
|
|
135
165
|
db_config=True,
|
|
136
|
-
job_submission=True,
|
|
137
166
|
simulation_model=["site", "layout", "telescope", "model_version"],
|
|
138
167
|
simulation_configuration={"software": None, "corsika_configuration": ["all"]},
|
|
139
168
|
)
|
|
@@ -150,24 +179,19 @@ def main(): # noqa: D103
|
|
|
150
179
|
)
|
|
151
180
|
|
|
152
181
|
simulator.simulate()
|
|
182
|
+
simulator.validate_metadata()
|
|
153
183
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
logger.info("Production run submitted to the workload manager")
|
|
166
|
-
if args_dict["pack_for_grid_register"] or args_dict["save_file_lists"]:
|
|
167
|
-
logger.warning(
|
|
168
|
-
"Packing for grid register or saving file lists not supported for "
|
|
169
|
-
f"{simulator.submit_engine}."
|
|
170
|
-
)
|
|
184
|
+
logger.info(
|
|
185
|
+
f"Production run complete for primary {args_dict['primary']} showers "
|
|
186
|
+
f"from {args_dict['azimuth_angle']} azimuth and {args_dict['zenith_angle']} zenith "
|
|
187
|
+
f"at {args_dict['site']} site, using {args_dict['model_version']} model."
|
|
188
|
+
)
|
|
189
|
+
if args_dict["save_reduced_event_lists"]:
|
|
190
|
+
simulator.save_reduced_event_lists()
|
|
191
|
+
if args_dict.get("pack_for_grid_register"):
|
|
192
|
+
simulator.pack_for_register(args_dict["pack_for_grid_register"])
|
|
193
|
+
if args_dict["save_file_lists"]:
|
|
194
|
+
simulator.save_file_lists()
|
|
171
195
|
|
|
172
196
|
|
|
173
197
|
if __name__ == "__main__":
|
|
@@ -76,7 +76,6 @@ def _parse(description=None):
|
|
|
76
76
|
)
|
|
77
77
|
return config.initialize(
|
|
78
78
|
db_config=False,
|
|
79
|
-
job_submission=False,
|
|
80
79
|
simulation_model=["site", "layout", "telescope", "model_version"],
|
|
81
80
|
simulation_configuration={"software": None, "corsika_configuration": ["all"]},
|
|
82
81
|
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Submit array-layouts definition and corresponding metadata and validate list of telescopes.
|
|
5
|
+
|
|
6
|
+
Includes validation that all defined telescope exists.
|
|
7
|
+
|
|
8
|
+
Command line arguments
|
|
9
|
+
----------------------
|
|
10
|
+
array_layouts (str, required)
|
|
11
|
+
Array layouts file.
|
|
12
|
+
updated_parameter_version (str, optional)
|
|
13
|
+
Updated parameter version.
|
|
14
|
+
input_meta (str, optional)
|
|
15
|
+
Input meta data file(s) associated to input data (wildcards or list of files allowed).
|
|
16
|
+
model_version (str, required)
|
|
17
|
+
Model version.
|
|
18
|
+
|
|
19
|
+
Example
|
|
20
|
+
-------
|
|
21
|
+
|
|
22
|
+
Submit a new array layout dictionary:
|
|
23
|
+
|
|
24
|
+
.. code-block:: console
|
|
25
|
+
|
|
26
|
+
simtools-submit-array-layouts \
|
|
27
|
+
--array_layouts array_layouts.json \\
|
|
28
|
+
--model_version 6.0.0 \\
|
|
29
|
+
--updated_parameter_version 0.1.0 \\
|
|
30
|
+
--input_meta array_layouts.metadata.yml
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
import logging
|
|
36
|
+
from pathlib import Path
|
|
37
|
+
|
|
38
|
+
import simtools.utils.general as gen
|
|
39
|
+
from simtools.configuration import configurator
|
|
40
|
+
from simtools.db import db_handler
|
|
41
|
+
from simtools.layout.array_layout_utils import validate_array_layouts_with_db, write_array_layouts
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse(label, description):
|
|
45
|
+
"""Parse command line configuration."""
|
|
46
|
+
config = configurator.Configurator(label=label, description=description)
|
|
47
|
+
|
|
48
|
+
config.parser.add_argument(
|
|
49
|
+
"--array_layouts",
|
|
50
|
+
type=str,
|
|
51
|
+
required=True,
|
|
52
|
+
help="Array layout dictionary file.",
|
|
53
|
+
)
|
|
54
|
+
config.parser.add_argument(
|
|
55
|
+
"--updated_parameter_version",
|
|
56
|
+
help="Updated parameter version.",
|
|
57
|
+
type=str,
|
|
58
|
+
required=False,
|
|
59
|
+
)
|
|
60
|
+
config.parser.add_argument(
|
|
61
|
+
"--input_meta",
|
|
62
|
+
help="meta data file(s) associated to input data (wildcards or list of files allowed)",
|
|
63
|
+
type=str,
|
|
64
|
+
nargs="+",
|
|
65
|
+
required=False,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return config.initialize(output=True, db_config=True, simulation_model=["model_version"])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def main(): # noqa: D103
|
|
72
|
+
args_dict, db_config = _parse(
|
|
73
|
+
label=Path(__file__).stem,
|
|
74
|
+
description="Submit and validate array layouts.",
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
logger = logging.getLogger()
|
|
78
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
79
|
+
|
|
80
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
81
|
+
|
|
82
|
+
array_layouts = validate_array_layouts_with_db(
|
|
83
|
+
production_table=db.read_production_table_from_mongo_db(
|
|
84
|
+
collection_name="telescopes", model_version=args_dict["model_version"]
|
|
85
|
+
),
|
|
86
|
+
array_layouts=gen.collect_data_from_file(args_dict["array_layouts"]),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
write_array_layouts(array_layouts=array_layouts, args_dict=args_dict, db_config=db_config)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
main()
|
|
@@ -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,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Verify simulation model production tables and model parameters for completeness.
|
|
5
|
+
|
|
6
|
+
This application is a utility to be used in the CI pipeline of the SimulationModels
|
|
7
|
+
repository. It checks that all model parameters defined in the production tables
|
|
8
|
+
exist in the simulation models repository.
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
|
|
14
|
+
from simtools.configuration import configurator
|
|
15
|
+
from simtools.model import model_repository
|
|
16
|
+
from simtools.utils import general as gen
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _parse():
|
|
20
|
+
"""Parse command line arguments."""
|
|
21
|
+
config = configurator.Configurator(
|
|
22
|
+
description=(
|
|
23
|
+
"Verify simulation model production tables and model parameters for completeness. "
|
|
24
|
+
"This application checks that all model parameters defined in the production tables "
|
|
25
|
+
"exist in the simulation models repository."
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
config.parser.add_argument(
|
|
29
|
+
"--simulation_models_path",
|
|
30
|
+
help="Path to the simulation models repository.",
|
|
31
|
+
type=str,
|
|
32
|
+
required=True,
|
|
33
|
+
)
|
|
34
|
+
return config.initialize(db_config=False, output=False, paths=False)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def main(): # noqa: D103
|
|
38
|
+
args_dict, _ = _parse()
|
|
39
|
+
|
|
40
|
+
logger = logging.getLogger()
|
|
41
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
42
|
+
|
|
43
|
+
if not model_repository.verify_simulation_model_production_tables(
|
|
44
|
+
simulation_models_path=args_dict["simulation_models_path"]
|
|
45
|
+
):
|
|
46
|
+
raise RuntimeError(
|
|
47
|
+
"Verification failed: Some model parameters are missing in the repository."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
main()
|
|
@@ -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,15 +106,15 @@ 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(
|
|
141
116
|
file_type=(
|
|
142
|
-
"
|
|
117
|
+
"camera_efficiency_table" if label == "results" else "camera_efficiency"
|
|
143
118
|
),
|
|
144
119
|
suffix=suffix,
|
|
145
120
|
site=self.telescope_model.site,
|
|
@@ -151,7 +126,7 @@ class CameraEfficiency:
|
|
|
151
126
|
|
|
152
127
|
_file[label] = self.io_handler.get_output_directory(
|
|
153
128
|
label=self.label,
|
|
154
|
-
sub_dir="
|
|
129
|
+
sub_dir="camera_efficiency",
|
|
155
130
|
).joinpath(file_name)
|
|
156
131
|
return _file
|
|
157
132
|
|
|
@@ -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()
|
|
@@ -317,7 +292,7 @@ class CameraEfficiency:
|
|
|
317
292
|
self._results, self._file["results"], format="basic", overwrite=True
|
|
318
293
|
)
|
|
319
294
|
_results_summary_file = (
|
|
320
|
-
str(self._file["results"]).replace(".ecsv", ".txt").replace("
|
|
295
|
+
str(self._file["results"]).replace(".ecsv", ".txt").replace("_table_", "_summary_")
|
|
321
296
|
)
|
|
322
297
|
self._logger.info(f"Exporting summary results to {_results_summary_file}")
|
|
323
298
|
with open(_results_summary_file, "w", encoding="utf-8") as file:
|
|
@@ -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
|
|
@@ -37,7 +37,6 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
37
37
|
simulation_model=None,
|
|
38
38
|
simulation_configuration=None,
|
|
39
39
|
db_config=False,
|
|
40
|
-
job_submission=False,
|
|
41
40
|
):
|
|
42
41
|
"""
|
|
43
42
|
Initialize default arguments used by all applications (e.g., log level or test flag).
|
|
@@ -50,18 +49,14 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
50
49
|
Add output file configuration to list of args.
|
|
51
50
|
simulation_model: list
|
|
52
51
|
List of simulation model configuration parameters to add to list of args
|
|
53
|
-
(use: '
|
|
52
|
+
(use: 'model_version', 'telescope', 'site')
|
|
54
53
|
simulation_configuration: dict
|
|
55
54
|
Dict of simulation software configuration parameters to add to list of args.
|
|
56
55
|
db_config: bool
|
|
57
56
|
Add database configuration parameters to list of args.
|
|
58
|
-
job_submission: bool
|
|
59
|
-
Add job submission configuration parameters to list of args.
|
|
60
57
|
"""
|
|
61
58
|
self.initialize_simulation_model_arguments(simulation_model)
|
|
62
59
|
self.initialize_simulation_configuration_arguments(simulation_configuration)
|
|
63
|
-
if job_submission:
|
|
64
|
-
self.initialize_job_submission_arguments()
|
|
65
60
|
if db_config:
|
|
66
61
|
self.initialize_db_config_arguments()
|
|
67
62
|
if paths:
|
|
@@ -228,28 +223,6 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
228
223
|
default=None,
|
|
229
224
|
)
|
|
230
225
|
|
|
231
|
-
def initialize_job_submission_arguments(self):
|
|
232
|
-
"""Initialize job submission arguments for simulator."""
|
|
233
|
-
_job_group = self.add_argument_group("job submission")
|
|
234
|
-
_job_group.add_argument(
|
|
235
|
-
"--submit_engine",
|
|
236
|
-
help="job submission command",
|
|
237
|
-
type=str,
|
|
238
|
-
required=True,
|
|
239
|
-
choices=[
|
|
240
|
-
"qsub",
|
|
241
|
-
"htcondor",
|
|
242
|
-
"local",
|
|
243
|
-
],
|
|
244
|
-
default="local",
|
|
245
|
-
)
|
|
246
|
-
_job_group.add_argument(
|
|
247
|
-
"--submit_options",
|
|
248
|
-
help="additional options (comma separated) for submission command",
|
|
249
|
-
type=str,
|
|
250
|
-
required=False,
|
|
251
|
-
)
|
|
252
|
-
|
|
253
226
|
def initialize_simulation_model_arguments(self, model_options):
|
|
254
227
|
"""
|
|
255
228
|
Initialize default arguments for simulation model definition.
|
|
@@ -271,6 +244,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
271
244
|
help="production model version",
|
|
272
245
|
type=str,
|
|
273
246
|
default=None,
|
|
247
|
+
nargs="+",
|
|
274
248
|
)
|
|
275
249
|
if "parameter_version" in model_options:
|
|
276
250
|
_job_group.add_argument(
|
|
@@ -302,7 +276,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
302
276
|
if "layout" in model_options or "layout_file" in model_options:
|
|
303
277
|
_job_group = self._add_model_option_layout(
|
|
304
278
|
job_group=_job_group,
|
|
305
|
-
|
|
279
|
+
model_options=model_options,
|
|
306
280
|
# layout info is always required for layout related tasks with the exception
|
|
307
281
|
# of listing the available layouts in the DB
|
|
308
282
|
required="--list_available_layouts" not in self._option_string_actions,
|
|
@@ -341,9 +315,9 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
341
315
|
"--simulation_software",
|
|
342
316
|
help="Simulation software steps.",
|
|
343
317
|
type=str,
|
|
344
|
-
choices=["corsika", "
|
|
318
|
+
choices=["corsika", "sim_telarray", "corsika_sim_telarray"],
|
|
345
319
|
required=True,
|
|
346
|
-
default="
|
|
320
|
+
default="corsika_sim_telarray",
|
|
347
321
|
)
|
|
348
322
|
|
|
349
323
|
@staticmethod
|
|
@@ -388,8 +362,14 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
388
362
|
"type": int,
|
|
389
363
|
"required": False,
|
|
390
364
|
},
|
|
391
|
-
"
|
|
392
|
-
"help": "
|
|
365
|
+
"run_number_offset": {
|
|
366
|
+
"help": "An offset for the run number to be simulated.",
|
|
367
|
+
"type": int,
|
|
368
|
+
"required": False,
|
|
369
|
+
"default": 0,
|
|
370
|
+
},
|
|
371
|
+
"run_number": {
|
|
372
|
+
"help": "Run number to be simulated.",
|
|
393
373
|
"type": int,
|
|
394
374
|
"required": True,
|
|
395
375
|
"default": 1,
|
|
@@ -476,7 +456,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
476
456
|
pass
|
|
477
457
|
|
|
478
458
|
@staticmethod
|
|
479
|
-
def _add_model_option_layout(job_group,
|
|
459
|
+
def _add_model_option_layout(job_group, model_options, required=True):
|
|
480
460
|
"""
|
|
481
461
|
Add layout option to the job group.
|
|
482
462
|
|
|
@@ -484,8 +464,8 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
484
464
|
----------
|
|
485
465
|
job_group: argparse.ArgumentParser
|
|
486
466
|
Job group
|
|
487
|
-
|
|
488
|
-
|
|
467
|
+
model_options: list
|
|
468
|
+
List of model options.
|
|
489
469
|
|
|
490
470
|
Returns
|
|
491
471
|
-------
|
|
@@ -506,7 +486,7 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
506
486
|
required=False,
|
|
507
487
|
default=None,
|
|
508
488
|
)
|
|
509
|
-
if
|
|
489
|
+
if "layout_file" in model_options:
|
|
510
490
|
_layout_group.add_argument(
|
|
511
491
|
"--array_layout_file",
|
|
512
492
|
help="file(s) with the list of array elements (astropy table format).",
|
|
@@ -515,6 +495,21 @@ class CommandLineParser(argparse.ArgumentParser):
|
|
|
515
495
|
required=False,
|
|
516
496
|
default=None,
|
|
517
497
|
)
|
|
498
|
+
if "layout_parameter_file" in model_options:
|
|
499
|
+
_layout_group.add_argument(
|
|
500
|
+
"--array_layout_parameter_file",
|
|
501
|
+
help="Array layout model parameter file (typically in JSON format).",
|
|
502
|
+
type=str,
|
|
503
|
+
required=False,
|
|
504
|
+
default=None,
|
|
505
|
+
)
|
|
506
|
+
if "plot_all_layouts" in model_options:
|
|
507
|
+
_layout_group.add_argument(
|
|
508
|
+
"--plot_all_layouts",
|
|
509
|
+
help="plot all available layouts",
|
|
510
|
+
action="store_true",
|
|
511
|
+
required=False,
|
|
512
|
+
)
|
|
518
513
|
return job_group
|
|
519
514
|
|
|
520
515
|
def _add_model_option_site(self, job_group):
|
|
@@ -106,7 +106,6 @@ class Configurator:
|
|
|
106
106
|
simulation_model=None,
|
|
107
107
|
simulation_configuration=None,
|
|
108
108
|
db_config=False,
|
|
109
|
-
job_submission=False,
|
|
110
109
|
):
|
|
111
110
|
"""
|
|
112
111
|
Initialize application configuration.
|
|
@@ -134,8 +133,6 @@ class Configurator:
|
|
|
134
133
|
Dict of simulation software configuration parameters to add to list of args.
|
|
135
134
|
db_config: bool
|
|
136
135
|
Add database configuration parameters to list of args.
|
|
137
|
-
job_submission: bool
|
|
138
|
-
Add job submission configuration to list of args.
|
|
139
136
|
|
|
140
137
|
Returns
|
|
141
138
|
-------
|
|
@@ -151,7 +148,6 @@ class Configurator:
|
|
|
151
148
|
simulation_model=simulation_model,
|
|
152
149
|
simulation_configuration=simulation_configuration,
|
|
153
150
|
db_config=db_config,
|
|
154
|
-
job_submission=job_submission,
|
|
155
151
|
)
|
|
156
152
|
|
|
157
153
|
self._fill_from_command_line(require_command_line=require_command_line)
|
|
@@ -163,6 +159,7 @@ class Configurator:
|
|
|
163
159
|
self.config["activity_id"] = str(uuid.uuid4())
|
|
164
160
|
if self.config["label"] is None:
|
|
165
161
|
self.config["label"] = self.label
|
|
162
|
+
self._initialize_model_versions()
|
|
166
163
|
|
|
167
164
|
self._initialize_io_handler()
|
|
168
165
|
if output:
|
|
@@ -329,6 +326,15 @@ class Configurator:
|
|
|
329
326
|
|
|
330
327
|
self._fill_from_config_dict(_env_dict)
|
|
331
328
|
|
|
329
|
+
def _initialize_model_versions(self):
|
|
330
|
+
"""Initialize model versions."""
|
|
331
|
+
if (
|
|
332
|
+
self.config.get("model_version", None)
|
|
333
|
+
and isinstance(self.config["model_version"], list)
|
|
334
|
+
and len(self.config["model_version"]) == 1
|
|
335
|
+
):
|
|
336
|
+
self.config["model_version"] = self.config["model_version"][0]
|
|
337
|
+
|
|
332
338
|
def _initialize_io_handler(self):
|
|
333
339
|
"""Initialize IOHandler with input and output paths."""
|
|
334
340
|
_io_handler = io_handler.IOHandler()
|