gammasimtools 0.18.0__py3-none-any.whl → 0.19.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.18.0.dist-info → gammasimtools-0.19.0.dist-info}/METADATA +26 -69
- gammasimtools-0.19.0.dist-info/RECORD +393 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/entry_points.txt +9 -2
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +16 -3
- simtools/applications/calculate_trigger_rate.py +1 -1
- simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- simtools/applications/db_add_value_from_json_to_db.py +2 -1
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
- simtools/applications/db_generate_compound_indexes.py +61 -0
- simtools/applications/db_get_file_from_db.py +1 -1
- simtools/applications/db_get_parameter_from_db.py +4 -4
- simtools/applications/db_inspect_databases.py +20 -10
- simtools/applications/derive_mirror_rnda.py +17 -11
- simtools/applications/derive_psf_parameters.py +59 -309
- simtools/applications/docs_produce_array_element_report.py +1 -1
- simtools/applications/docs_produce_calibration_reports.py +1 -1
- simtools/applications/docs_produce_model_parameter_reports.py +1 -1
- simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
- simtools/applications/generate_corsika_histograms.py +1 -1
- simtools/applications/generate_default_metadata.py +8 -24
- simtools/applications/generate_sim_telarray_histograms.py +1 -1
- simtools/applications/generate_simtel_event_data.py +11 -11
- simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
- simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
- simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
- simtools/applications/merge_tables.py +2 -2
- simtools/applications/plot_array_layout.py +3 -3
- simtools/applications/plot_simtel_events.py +379 -0
- simtools/applications/plot_tabular_data.py +9 -2
- simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
- simtools/applications/print_version.py +8 -9
- simtools/applications/production_derive_corsika_limits.py +6 -7
- simtools/applications/production_derive_statistics.py +1 -1
- simtools/applications/production_generate_grid.py +2 -2
- simtools/applications/production_merge_corsika_limits.py +214 -0
- simtools/applications/run_application.py +47 -113
- simtools/applications/simulate_calibration_events.py +166 -0
- simtools/applications/simulate_flasher.py +141 -0
- simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
- simtools/applications/simulate_prod.py +6 -24
- simtools/applications/simulate_prod_htcondor_generator.py +7 -0
- simtools/applications/submit_array_layouts.py +2 -1
- simtools/applications/submit_model_parameter_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +30 -12
- simtools/applications/validate_camera_fov.py +1 -1
- simtools/applications/validate_cumulative_psf.py +1 -1
- simtools/applications/validate_file_using_schema.py +2 -1
- simtools/applications/validate_optics.py +1 -1
- simtools/camera/camera_efficiency.py +61 -45
- simtools/camera/single_photon_electron_spectrum.py +1 -1
- simtools/configuration/commandline_parser.py +29 -0
- simtools/configuration/configurator.py +4 -4
- simtools/corsika/corsika_config.py +45 -25
- simtools/corsika/corsika_histograms.py +6 -5
- simtools/data_model/data_reader.py +2 -3
- simtools/data_model/metadata_collector.py +32 -36
- simtools/data_model/metadata_model.py +15 -12
- simtools/data_model/model_data_writer.py +13 -32
- simtools/data_model/schema.py +74 -24
- simtools/data_model/validate_data.py +34 -9
- simtools/db/db_handler.py +43 -37
- simtools/db/db_model_upload.py +3 -3
- simtools/dependencies.py +88 -25
- simtools/io/ascii_handler.py +279 -0
- simtools/{io_operations → io}/io_handler.py +25 -3
- simtools/job_execution/htcondor_script_generator.py +15 -4
- simtools/layout/array_layout.py +1 -1
- simtools/layout/array_layout_utils.py +14 -7
- simtools/model/array_model.py +23 -4
- simtools/model/flasher_model.py +106 -0
- simtools/model/model_parameter.py +4 -4
- simtools/model/model_repository.py +197 -2
- simtools/model/telescope_model.py +3 -1
- simtools/production_configuration/derive_corsika_limits.py +361 -427
- simtools/production_configuration/derive_production_statistics_handler.py +7 -6
- simtools/production_configuration/generate_production_grid.py +9 -11
- simtools/production_configuration/merge_corsika_limits.py +528 -0
- simtools/ray_tracing/mirror_panel_psf.py +1 -0
- simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
- simtools/ray_tracing/ray_tracing.py +6 -2
- simtools/reporting/docs_read_parameters.py +150 -62
- simtools/runners/corsika_runner.py +1 -1
- simtools/runners/corsika_simtel_runner.py +14 -5
- simtools/runners/runner_services.py +10 -5
- simtools/runners/simtools_runner.py +267 -0
- simtools/schemas/application_workflow.metaschema.yml +101 -68
- simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
- simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
- simtools/schemas/metadata.metaschema.yml +577 -3
- simtools/schemas/model_parameter.metaschema.yml +6 -6
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +2 -2
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/array_window.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/stars.schema.yml +1 -1
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/schemas/plot_configuration.metaschema.yml +5 -2
- simtools/schemas/production_configuration_metrics.schema.yml +12 -2
- simtools/schemas/production_tables.schema.yml +2 -2
- simtools/simtel/simtel_config_reader.py +2 -2
- simtools/simtel/simtel_config_writer.py +16 -4
- simtools/simtel/simtel_io_event_histograms.py +746 -0
- simtools/simtel/simtel_io_event_reader.py +15 -42
- simtools/simtel/simtel_io_event_writer.py +9 -9
- simtools/simtel/simtel_io_histogram.py +3 -1
- simtools/simtel/simtel_io_histograms.py +7 -3
- simtools/simtel/simtel_table_reader.py +92 -10
- simtools/simtel/simulator_array.py +138 -10
- simtools/simtel/simulator_camera_efficiency.py +32 -23
- simtools/simtel/simulator_light_emission.py +437 -271
- simtools/simtel/simulator_ray_tracing.py +1 -1
- simtools/simulator.py +105 -147
- simtools/testing/configuration.py +24 -26
- simtools/testing/helpers.py +2 -2
- simtools/testing/log_inspector.py +50 -0
- simtools/testing/validate_output.py +87 -37
- simtools/utils/general.py +125 -255
- simtools/utils/geometry.py +36 -0
- simtools/utils/names.py +1 -1
- simtools/visualization/legend_handlers.py +180 -264
- simtools/visualization/plot_array_layout.py +20 -8
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_tables.py +133 -37
- simtools/visualization/simtel_event_plots.py +816 -0
- simtools/visualization/visualize.py +4 -101
- gammasimtools-0.18.0.dist-info/RECORD +0 -376
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/top_level.txt +0 -0
- /simtools/{io_operations → io}/hdf5_handler.py +0 -0
- /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
- /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
|
@@ -6,13 +6,12 @@ The versions of simtools, the DB, sim_telarray, and CORSIKA are printed.
|
|
|
6
6
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
import json
|
|
10
9
|
import logging
|
|
11
10
|
from pathlib import Path
|
|
12
11
|
|
|
13
12
|
from simtools import dependencies, version
|
|
14
13
|
from simtools.configuration import configurator
|
|
15
|
-
from simtools.
|
|
14
|
+
from simtools.io import ascii_handler, io_handler
|
|
16
15
|
from simtools.utils import general as gen
|
|
17
16
|
|
|
18
17
|
|
|
@@ -66,15 +65,15 @@ def main():
|
|
|
66
65
|
|
|
67
66
|
version_list = version_string.strip().split("\n")
|
|
68
67
|
for version_entry in version_list:
|
|
69
|
-
key, value = version_entry.split(": ")
|
|
68
|
+
key, value = version_entry.split(": ", 1)
|
|
70
69
|
version_dict[key] = value
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
ascii_handler.write_data_to_file(
|
|
72
|
+
data=version_dict,
|
|
73
|
+
output_file=io_handler_instance.get_output_file(
|
|
74
|
+
args_dict.get("output_file", "simtools_version.json"), label=label
|
|
75
|
+
),
|
|
76
|
+
)
|
|
78
77
|
|
|
79
78
|
|
|
80
79
|
if __name__ == "__main__":
|
|
@@ -45,7 +45,7 @@ directions, level of night sky background, etc.).
|
|
|
45
45
|
|
|
46
46
|
Command line arguments
|
|
47
47
|
----------------------
|
|
48
|
-
|
|
48
|
+
event_data_file (str, required)
|
|
49
49
|
Path to reduced event data file.
|
|
50
50
|
telescope_ids (str, optional)
|
|
51
51
|
Custom array layout file containing telescope IDs.
|
|
@@ -64,7 +64,7 @@ Derive limits for a list of array layouts (use 'all' to derive limits for all la
|
|
|
64
64
|
.. code-block:: console
|
|
65
65
|
|
|
66
66
|
simtools-production-derive-corsika-limits \\
|
|
67
|
-
--
|
|
67
|
+
--event_data_file event_dat_file.hdf5 \\
|
|
68
68
|
--array_layout_name alpha,beta \\
|
|
69
69
|
--loss_fraction 1e-6 \\
|
|
70
70
|
--plot_histograms \\
|
|
@@ -75,7 +75,7 @@ Derive limits for a given file for custom defined array layouts:
|
|
|
75
75
|
.. code-block:: console
|
|
76
76
|
|
|
77
77
|
simtools-production-derive-corsika-limits \\
|
|
78
|
-
--
|
|
78
|
+
--event_data_file event_dat_file.hdf5 \\
|
|
79
79
|
--telescope_ids path/to/telescope_configs.yaml \\
|
|
80
80
|
--loss_fraction 1e-6 \\
|
|
81
81
|
--plot_histograms \\
|
|
@@ -86,7 +86,7 @@ import logging
|
|
|
86
86
|
|
|
87
87
|
import simtools.utils.general as gen
|
|
88
88
|
from simtools.configuration import configurator
|
|
89
|
-
from simtools.production_configuration.
|
|
89
|
+
from simtools.production_configuration.derive_corsika_limits import (
|
|
90
90
|
generate_corsika_limits_grid,
|
|
91
91
|
)
|
|
92
92
|
|
|
@@ -97,11 +97,10 @@ def _parse():
|
|
|
97
97
|
description="Derive limits for energy, radial distance, and viewcone."
|
|
98
98
|
)
|
|
99
99
|
config.parser.add_argument(
|
|
100
|
-
"--
|
|
100
|
+
"--event_data_file",
|
|
101
101
|
type=str,
|
|
102
|
-
nargs="+",
|
|
103
102
|
required=True,
|
|
104
|
-
help="
|
|
103
|
+
help="Event data file containing reduced event data.",
|
|
105
104
|
)
|
|
106
105
|
config.parser.add_argument(
|
|
107
106
|
"--telescope_ids",
|
|
@@ -54,7 +54,7 @@ import logging
|
|
|
54
54
|
from pathlib import Path
|
|
55
55
|
|
|
56
56
|
from simtools.configuration import configurator
|
|
57
|
-
from simtools.
|
|
57
|
+
from simtools.io import io_handler
|
|
58
58
|
from simtools.production_configuration.derive_production_statistics_handler import (
|
|
59
59
|
ProductionStatisticsHandler,
|
|
60
60
|
)
|
|
@@ -49,10 +49,10 @@ from astropy.coordinates import EarthLocation
|
|
|
49
49
|
from astropy.time import Time
|
|
50
50
|
|
|
51
51
|
from simtools.configuration import configurator
|
|
52
|
-
from simtools.
|
|
52
|
+
from simtools.io import io_handler
|
|
53
|
+
from simtools.io.ascii_handler import collect_data_from_file
|
|
53
54
|
from simtools.model.site_model import SiteModel
|
|
54
55
|
from simtools.production_configuration.generate_production_grid import GridGeneration
|
|
55
|
-
from simtools.utils.general import collect_data_from_file
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
def _parse(label, description):
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Merge CORSIKA limit tables from multiple grid points and check grid completeness.
|
|
5
|
+
|
|
6
|
+
The corsika limit tables are first generated by the application
|
|
7
|
+
'simtools-production-derive-corsika-limits' and contain derived limits for
|
|
8
|
+
energy, radial distance, and viewcone for different observational conditions.
|
|
9
|
+
The individual tables are merged into a single table for each grid point by
|
|
10
|
+
the application 'merge_tables'. This tool finalizes the merging process and
|
|
11
|
+
checks the completeness of the grid against a provided grid definition file.
|
|
12
|
+
|
|
13
|
+
This tool supports three main use cases:
|
|
14
|
+
|
|
15
|
+
1. Merge multiple CORSIKA limit tables into a single file and optionally generate
|
|
16
|
+
plots of the derived limits.
|
|
17
|
+
2. Merge tables and also check for grid completeness against a provided grid
|
|
18
|
+
definition file. This requires the --grid_definition parameter. Coverage plots
|
|
19
|
+
can also be generated.
|
|
20
|
+
3. Check grid completeness of an already merged table file. This requires both
|
|
21
|
+
the --merged_table and --grid_definition parameters.
|
|
22
|
+
|
|
23
|
+
Command line arguments
|
|
24
|
+
----------------------
|
|
25
|
+
input_files (str)
|
|
26
|
+
Directory containing corsika_simulation_limits_lookup*.ecsv files to be merged,
|
|
27
|
+
or a list of specific files to merge. Not used if --merged_table is provided.
|
|
28
|
+
input_files_list (str)
|
|
29
|
+
Path to a text file containing a list of input files (one file path per line)
|
|
30
|
+
to be merged. Not used if --merged_table is provided.
|
|
31
|
+
merged_table (str)
|
|
32
|
+
Path to an already merged table file. Used for checking grid completeness.
|
|
33
|
+
grid_definition (str)
|
|
34
|
+
Path to a YAML file defining the expected grid points. Required for grid
|
|
35
|
+
completeness checks and coverage plots.
|
|
36
|
+
output_file (str, optional)
|
|
37
|
+
Name of the output file for the merged limits table.
|
|
38
|
+
Default is "merged_corsika_limits.ecsv".
|
|
39
|
+
plot_grid_coverage (bool, optional)
|
|
40
|
+
Flag to generate plots showing grid coverage. Requires --grid_definition.
|
|
41
|
+
plot_limits (bool, optional)
|
|
42
|
+
Flag to generate plots showing the derived limits.
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
1. Merge CORSIKA limit tables from a directory:
|
|
47
|
+
|
|
48
|
+
.. code-block:: console
|
|
49
|
+
|
|
50
|
+
simtools-production-merge-corsika-limits \\
|
|
51
|
+
--input_files "simtools-output/corsika_limits/" \\
|
|
52
|
+
--output_file merged_limits.ecsv --plot_limits
|
|
53
|
+
|
|
54
|
+
2. Merge tables and check grid completeness:
|
|
55
|
+
|
|
56
|
+
.. code-block:: console
|
|
57
|
+
|
|
58
|
+
simtools-production-merge-corsika-limits \\
|
|
59
|
+
--input_files "simtools-output/corsika_limits/" \\
|
|
60
|
+
--grid_definition grid_definition.yaml \\
|
|
61
|
+
--output_file merged_limits.ecsv --plot_grid_coverage
|
|
62
|
+
|
|
63
|
+
3. Check grid completeness of an existing merged table:
|
|
64
|
+
|
|
65
|
+
.. code-block:: console
|
|
66
|
+
|
|
67
|
+
simtools-production-merge-corsika-limits \\
|
|
68
|
+
--merged_table merged_limits.ecsv \\
|
|
69
|
+
--grid_definition grid_definition.yaml --plot_grid_coverage
|
|
70
|
+
|
|
71
|
+
4. Merge tables using a list of files from a text file:
|
|
72
|
+
|
|
73
|
+
.. code-block:: console
|
|
74
|
+
|
|
75
|
+
simtools-production-merge-corsika-limits \\
|
|
76
|
+
--input_files_list file_list.txt \\
|
|
77
|
+
--output_file merged_limits.ecsv
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
import logging
|
|
81
|
+
from pathlib import Path
|
|
82
|
+
|
|
83
|
+
import simtools.utils.general as gen
|
|
84
|
+
from simtools.configuration import configurator
|
|
85
|
+
from simtools.data_model import data_reader
|
|
86
|
+
from simtools.io import ascii_handler
|
|
87
|
+
from simtools.production_configuration.merge_corsika_limits import CorsikaMergeLimits
|
|
88
|
+
|
|
89
|
+
_logger = logging.getLogger(__name__)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _parse():
|
|
93
|
+
"""Parse command line configuration."""
|
|
94
|
+
config = configurator.Configurator(
|
|
95
|
+
description="Merge CORSIKA limit tables and check grid completeness."
|
|
96
|
+
)
|
|
97
|
+
config.parser.add_argument(
|
|
98
|
+
"--input_files",
|
|
99
|
+
type=str,
|
|
100
|
+
default=None,
|
|
101
|
+
nargs="+",
|
|
102
|
+
help=(
|
|
103
|
+
"A list of input files to be merged, or a single directory "
|
|
104
|
+
"containing the files (*.ecsv)."
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
config.parser.add_argument(
|
|
108
|
+
"--input_files_list",
|
|
109
|
+
type=str,
|
|
110
|
+
default=None,
|
|
111
|
+
help=(
|
|
112
|
+
"Path to a text file containing a list of input files (one file path per line) "
|
|
113
|
+
"to be merged."
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
config.parser.add_argument(
|
|
117
|
+
"--merged_table",
|
|
118
|
+
type=str,
|
|
119
|
+
default=None,
|
|
120
|
+
help="Path to an already merged table file.",
|
|
121
|
+
)
|
|
122
|
+
config.parser.add_argument(
|
|
123
|
+
"--grid_definition",
|
|
124
|
+
type=str,
|
|
125
|
+
default=None,
|
|
126
|
+
help="Path to YAML file defining the expected grid points.",
|
|
127
|
+
)
|
|
128
|
+
config.parser.add_argument(
|
|
129
|
+
"--plot_grid_coverage",
|
|
130
|
+
help="Generate plots showing grid coverage.",
|
|
131
|
+
action="store_true",
|
|
132
|
+
default=False,
|
|
133
|
+
)
|
|
134
|
+
config.parser.add_argument(
|
|
135
|
+
"--plot_limits",
|
|
136
|
+
help="Generate plots showing the derived limits.",
|
|
137
|
+
action="store_true",
|
|
138
|
+
default=False,
|
|
139
|
+
)
|
|
140
|
+
return config.initialize(output=True)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def main():
|
|
144
|
+
"""Merge CORSIKA limit tables and check grid completeness."""
|
|
145
|
+
args_dict, _ = _parse()
|
|
146
|
+
logger = logging.getLogger()
|
|
147
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "info")))
|
|
148
|
+
|
|
149
|
+
merger = CorsikaMergeLimits()
|
|
150
|
+
grid_definition = (
|
|
151
|
+
ascii_handler.collect_data_from_file(args_dict["grid_definition"])
|
|
152
|
+
if args_dict.get("grid_definition")
|
|
153
|
+
else None
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if args_dict.get("merged_table"):
|
|
157
|
+
# Case 3: Check coverage on an existing merged table
|
|
158
|
+
merged_table_path = Path(args_dict["merged_table"]).expanduser()
|
|
159
|
+
merged_table = data_reader.read_table_from_file(merged_table_path)
|
|
160
|
+
input_files = [merged_table_path]
|
|
161
|
+
elif args_dict.get("input_files") or args_dict.get("input_files_list"):
|
|
162
|
+
# Case 1 & 2: Merge files
|
|
163
|
+
input_files = []
|
|
164
|
+
|
|
165
|
+
# Process input_files argument
|
|
166
|
+
if args_dict.get("input_files"):
|
|
167
|
+
raw_paths = args_dict.get("input_files")
|
|
168
|
+
if len(raw_paths) == 1 and Path(raw_paths[0]).expanduser().is_dir():
|
|
169
|
+
input_dir = Path(raw_paths[0]).expanduser()
|
|
170
|
+
input_files.extend(input_dir.glob("*.ecsv"))
|
|
171
|
+
else:
|
|
172
|
+
input_files.extend(Path(f).expanduser() for f in raw_paths)
|
|
173
|
+
|
|
174
|
+
# Process input_files_list argument
|
|
175
|
+
if args_dict.get("input_files_list"):
|
|
176
|
+
files_from_list = merger.read_file_list(args_dict["input_files_list"])
|
|
177
|
+
input_files.extend(files_from_list)
|
|
178
|
+
|
|
179
|
+
if not input_files:
|
|
180
|
+
raise FileNotFoundError(
|
|
181
|
+
"No input files found. Check --input_files or --input_files_list arguments."
|
|
182
|
+
)
|
|
183
|
+
merged_table = merger.merge_tables(input_files)
|
|
184
|
+
else:
|
|
185
|
+
raise ValueError(
|
|
186
|
+
"Either --input_files, --input_files_list, or --merged_table must be provided."
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
is_complete, grid_completeness = merger.check_grid_completeness(merged_table, grid_definition)
|
|
190
|
+
|
|
191
|
+
if args_dict.get("plot_grid_coverage"):
|
|
192
|
+
merger.plot_grid_coverage(merged_table, grid_definition)
|
|
193
|
+
|
|
194
|
+
if args_dict.get("plot_limits"):
|
|
195
|
+
merger.plot_limits(merged_table)
|
|
196
|
+
|
|
197
|
+
if not args_dict.get("merged_table"):
|
|
198
|
+
# Write output file only when merging
|
|
199
|
+
output_file = merger.output_dir / args_dict["output_file"]
|
|
200
|
+
merger.write_merged_table(
|
|
201
|
+
merged_table,
|
|
202
|
+
output_file,
|
|
203
|
+
input_files,
|
|
204
|
+
{
|
|
205
|
+
"is_complete": is_complete,
|
|
206
|
+
"expected": grid_completeness.get("expected", 0),
|
|
207
|
+
"found": grid_completeness.get("found", 0),
|
|
208
|
+
"missing": grid_completeness.get("missing", []),
|
|
209
|
+
},
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
if __name__ == "__main__":
|
|
214
|
+
main()
|
|
@@ -8,36 +8,66 @@ both the name of the simtools application and the configuration for the applicat
|
|
|
8
8
|
|
|
9
9
|
This application is used for model parameter setting workflows.
|
|
10
10
|
Strong assumptions are applied on the directory structure for input and output files of
|
|
11
|
-
applications
|
|
11
|
+
applications, for details see the CTAO Simulation Model Parameter Setting
|
|
12
|
+
`repository <https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/\
|
|
13
|
+
simulation-model-parameter-setting>`_.
|
|
14
|
+
|
|
15
|
+
.. tip::
|
|
16
|
+
Browse the CTAO Simulation Model Parameter Setting
|
|
17
|
+
`repository <https://gitlab.cta-observatory.org/cta-science/simulations/simulation-model/\
|
|
18
|
+
simulation-model-parameter-setting>`_
|
|
19
|
+
for a list of examples and templates for configuration files.
|
|
20
|
+
|
|
21
|
+
For simplified configuration, a placeholder called ``__SETTING_WORKFLOW__`` can be used in the
|
|
22
|
+
configuration file. This placeholder will be replaced with the directory below ``input``
|
|
23
|
+
(example: configuration file is in ``input/LSTN-design/num_gains/20250214T134800/config.yml``,
|
|
24
|
+
then the placeholder will be replaced with ``LSTN-design/num_gains/20250214T134800``).
|
|
25
|
+
This will also be the directory for any output generated by the application.
|
|
26
|
+
|
|
27
|
+
Run time environments can be defined in the configuration file using the ``runtime_environment``
|
|
28
|
+
block. The following example shows how to define a runtime environment:
|
|
29
|
+
|
|
30
|
+
.. code-block:: yaml
|
|
31
|
+
|
|
32
|
+
runtime_environment:
|
|
33
|
+
image: ghcr.io/gammasim/simtools-prod-sim-telarray-240927-corsika-77550-bernlohr-1.68-\
|
|
34
|
+
prod6-baseline-qgs2-no_opt:20250716-122341
|
|
35
|
+
network: simtools-mongo-network
|
|
36
|
+
environment_file: ./.env
|
|
37
|
+
container_engine: podman
|
|
38
|
+
options:
|
|
39
|
+
- '--arch amd64'
|
|
40
|
+
|
|
41
|
+
If the ``ignore_runtime_environment`` flag is set, the application will run in the current
|
|
42
|
+
environment, ignoring any definitions in the configuration file.
|
|
43
|
+
|
|
44
|
+
The database configuration and setting of other environment variables is done as
|
|
45
|
+
described in :ref:`environment-variables`.
|
|
12
46
|
|
|
13
47
|
Example
|
|
14
48
|
-------
|
|
15
49
|
|
|
16
|
-
Run the application with the configuration file
|
|
50
|
+
Run the application with the configuration file ``config_file_name``:
|
|
17
51
|
|
|
18
52
|
.. code-block:: console
|
|
19
53
|
|
|
20
|
-
|
|
54
|
+
simtools-run-application --configuration_file config_file_name
|
|
21
55
|
|
|
22
|
-
Run the application with the configuration file
|
|
56
|
+
Run the application with the configuration file ``config_file_name``, but skipping all steps except
|
|
23
57
|
step 2 and 3 (useful for debugging):
|
|
24
58
|
|
|
25
59
|
.. code-block:: console
|
|
26
60
|
|
|
27
|
-
|
|
61
|
+
simtools-run-application --configuration_file config_file_name --steps 2 3
|
|
28
62
|
|
|
29
63
|
"""
|
|
30
64
|
|
|
31
65
|
import logging
|
|
32
|
-
import subprocess
|
|
33
|
-
import tempfile
|
|
34
66
|
from pathlib import Path
|
|
35
67
|
|
|
36
|
-
import yaml
|
|
37
|
-
|
|
38
68
|
import simtools.utils.general as gen
|
|
39
|
-
from simtools import dependencies
|
|
40
69
|
from simtools.configuration import configurator
|
|
70
|
+
from simtools.runners import simtools_runner
|
|
41
71
|
|
|
42
72
|
|
|
43
73
|
def _parse(label, description, usage):
|
|
@@ -73,91 +103,15 @@ def _parse(label, description, usage):
|
|
|
73
103
|
nargs="+",
|
|
74
104
|
help="List of steps to be execution (e.g., '--steps 7 8 9'; do not specify to run all).",
|
|
75
105
|
)
|
|
106
|
+
config.parser.add_argument(
|
|
107
|
+
"--ignore_runtime_environment",
|
|
108
|
+
action="store_true",
|
|
109
|
+
help="Ignore the runtime environment and run the application in the current environment.",
|
|
110
|
+
default=False,
|
|
111
|
+
)
|
|
76
112
|
return config.initialize(db_config=True)
|
|
77
113
|
|
|
78
114
|
|
|
79
|
-
def run_application(application, configuration, logger):
|
|
80
|
-
"""Run a simtools application and return stdout and stderr."""
|
|
81
|
-
with tempfile.NamedTemporaryFile(mode="w", delete=True, suffix=".yml") as temp_config:
|
|
82
|
-
yaml.dump(configuration, temp_config, default_flow_style=False)
|
|
83
|
-
temp_config.flush()
|
|
84
|
-
configuration_file = Path(temp_config.name)
|
|
85
|
-
try:
|
|
86
|
-
result = subprocess.run(
|
|
87
|
-
[application, "--config", configuration_file],
|
|
88
|
-
check=True,
|
|
89
|
-
capture_output=True,
|
|
90
|
-
text=True,
|
|
91
|
-
)
|
|
92
|
-
except subprocess.CalledProcessError as exc:
|
|
93
|
-
logger.error(f"Error running application {application}: {exc.stderr}")
|
|
94
|
-
raise exc
|
|
95
|
-
return result.stdout, result.stderr
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def get_subdirectory_name(path):
|
|
99
|
-
"""Get the first subdirectory name under 'input'."""
|
|
100
|
-
path = Path(path).resolve()
|
|
101
|
-
try:
|
|
102
|
-
input_index = path.parts.index("input")
|
|
103
|
-
return path.parts[input_index], path.parts[input_index + 1]
|
|
104
|
-
except (ValueError, IndexError) as exc:
|
|
105
|
-
raise ValueError(f"Could not find subdirectory under 'input': {exc}") from exc
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def read_application_configuration(configuration_file, steps, logger):
|
|
109
|
-
"""
|
|
110
|
-
Read application configuration from file and modify for setting workflows.
|
|
111
|
-
|
|
112
|
-
Strong assumptions on the structure of input and output files:
|
|
113
|
-
|
|
114
|
-
- configuration file is expected to be in './input/<workflow directory>/<yaml file>'
|
|
115
|
-
- output files will be written out to './output/<workflow directory>/'
|
|
116
|
-
|
|
117
|
-
Replaces the placeholders in the configuration file with the actual values.
|
|
118
|
-
Sets 'USE_PLAIN_OUTPUT_PATH' to True for all applications.
|
|
119
|
-
|
|
120
|
-
Parameters
|
|
121
|
-
----------
|
|
122
|
-
configuration_file : str
|
|
123
|
-
Configuration file name.
|
|
124
|
-
steps : list
|
|
125
|
-
List of steps to be executed (None: all steps).
|
|
126
|
-
logger : Logger
|
|
127
|
-
Logger object.
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
dict
|
|
132
|
-
Application configuration.
|
|
133
|
-
Path
|
|
134
|
-
Path to the log file.
|
|
135
|
-
|
|
136
|
-
"""
|
|
137
|
-
application_config = gen.collect_data_from_file(configuration_file).get("CTA_SIMPIPE")
|
|
138
|
-
place_holder = "__SETTING_WORKFLOW__"
|
|
139
|
-
workflow_dir, setting_workflow = get_subdirectory_name(configuration_file)
|
|
140
|
-
output_path = Path(str(workflow_dir).replace("input", "output")) / Path(setting_workflow)
|
|
141
|
-
output_path.mkdir(parents=True, exist_ok=True)
|
|
142
|
-
logger.info(f"Setting workflow output path to {output_path}")
|
|
143
|
-
log_file = output_path / "simtools.log"
|
|
144
|
-
configurations = application_config.get("APPLICATIONS")
|
|
145
|
-
for step_count, config in enumerate(configurations, start=1):
|
|
146
|
-
config["RUN_APPLICATION"] = step_count in steps if steps else True
|
|
147
|
-
for key, value in config.get("CONFIGURATION", {}).items():
|
|
148
|
-
if isinstance(value, str):
|
|
149
|
-
config["CONFIGURATION"][key] = value.replace(place_holder, setting_workflow)
|
|
150
|
-
if isinstance(value, list):
|
|
151
|
-
config["CONFIGURATION"][key] = [
|
|
152
|
-
item.replace(place_holder, setting_workflow) if isinstance(item, str) else item
|
|
153
|
-
for item in value
|
|
154
|
-
]
|
|
155
|
-
config["CONFIGURATION"]["USE_PLAIN_OUTPUT_PATH"] = True
|
|
156
|
-
config["CONFIGURATION"]["OUTPUT_PATH"] = str(output_path)
|
|
157
|
-
|
|
158
|
-
return configurations, log_file
|
|
159
|
-
|
|
160
|
-
|
|
161
115
|
def main(): # noqa: D103
|
|
162
116
|
args_dict, db_config = _parse(
|
|
163
117
|
Path(__file__).stem,
|
|
@@ -167,27 +121,7 @@ def main(): # noqa: D103
|
|
|
167
121
|
logger = logging.getLogger()
|
|
168
122
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
169
123
|
|
|
170
|
-
|
|
171
|
-
args_dict["configuration_file"], args_dict["steps"], logger
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
with log_file.open("w", encoding="utf-8") as file:
|
|
175
|
-
file.write("Running simtools applications\n")
|
|
176
|
-
file.write(dependencies.get_version_string(db_config))
|
|
177
|
-
for config in configurations:
|
|
178
|
-
if config.get("RUN_APPLICATION"):
|
|
179
|
-
logger.info(f"Running application: {config.get('APPLICATION')}")
|
|
180
|
-
else:
|
|
181
|
-
logger.info(f"Skipping application: {config.get('APPLICATION')}")
|
|
182
|
-
continue
|
|
183
|
-
config = gen.change_dict_keys_case(config, False)
|
|
184
|
-
stdout, stderr = run_application(
|
|
185
|
-
config.get("APPLICATION"), config.get("CONFIGURATION"), logger
|
|
186
|
-
)
|
|
187
|
-
file.write("=" * 80 + "\n")
|
|
188
|
-
file.write(f"Application: {config.get('APPLICATION')}\n")
|
|
189
|
-
file.write("STDOUT:\n" + stdout)
|
|
190
|
-
file.write("STDERR:\n" + stderr)
|
|
124
|
+
simtools_runner.run_applications(args_dict, db_config, logger)
|
|
191
125
|
|
|
192
126
|
|
|
193
127
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Simulate calibration events like pedestal or flasher events.
|
|
5
|
+
|
|
6
|
+
Use sim_telarray to simulate calibration events for an array of telescopes.
|
|
7
|
+
The following types of calibration events are supported:
|
|
8
|
+
|
|
9
|
+
* Pedestal events (includes night-sky background and camera noise)
|
|
10
|
+
* Dark pedestal events (closed camera lid, camera noise only)
|
|
11
|
+
* Flasher events (simulated flasher light source)
|
|
12
|
+
|
|
13
|
+
Example
|
|
14
|
+
-------
|
|
15
|
+
|
|
16
|
+
Simulate pedestal events for alpha North. The assumed level night-sky background is 2.0 times the
|
|
17
|
+
nominal value. A list of stars can be provided to simulate additional contributions.
|
|
18
|
+
|
|
19
|
+
.. code-block:: console
|
|
20
|
+
|
|
21
|
+
simtools-simulate-calibration-events --run_mode=pedestals \\
|
|
22
|
+
--run_number 10 --number_of_events 1000 \\
|
|
23
|
+
--array_layout_name alpha --site North \\
|
|
24
|
+
--model_version 6.0.0 \\
|
|
25
|
+
--zenith_angle 20 --azimuth_angle 0 \\
|
|
26
|
+
--nsb_scaling_factor 2.0
|
|
27
|
+
|
|
28
|
+
Simulate flasher events for alpha South. Note that the same flasher configuration is used
|
|
29
|
+
for all telescopes.
|
|
30
|
+
|
|
31
|
+
.. code-block:: console
|
|
32
|
+
|
|
33
|
+
simtools-simulate-calibration-events --run_mode=flasher \\
|
|
34
|
+
--run_number 10 --number_of_events 1000 \\
|
|
35
|
+
--array_layout_name subsystem_msts --site South \\
|
|
36
|
+
--model_version 6.0.0 \\
|
|
37
|
+
--zenith_angle 20 --azimuth_angle 0 \\
|
|
38
|
+
--flasher_photons 500 --flasher_var_photons 0.05 \\
|
|
39
|
+
--flasher_exp_time 1.59 --flasher_sig_time 0.4
|
|
40
|
+
|
|
41
|
+
Command Line Arguments
|
|
42
|
+
----------------------
|
|
43
|
+
run_mode (str, required)
|
|
44
|
+
Run mode, e.g. "pedestals" or "flasher".
|
|
45
|
+
run_number (int, required)
|
|
46
|
+
Run number for the simulation.
|
|
47
|
+
number_of_events (int, required)
|
|
48
|
+
Number of calibration events to simulate.
|
|
49
|
+
array_layout_name (str, required)
|
|
50
|
+
Array layout name, e.g. "alpha".
|
|
51
|
+
site (str, required)
|
|
52
|
+
Site name.
|
|
53
|
+
model_version (str, optional)
|
|
54
|
+
Version of the simulation model.
|
|
55
|
+
nsb_scaling_factor (float, optional)
|
|
56
|
+
Scaling factor for the night-sky background rate. Default is 1.0, which
|
|
57
|
+
corresponds to the nominal (dark sky) NSB rate.
|
|
58
|
+
stars (str, optional)
|
|
59
|
+
Path to a file containing a list of stars (azimuth, zenith, weighting factor
|
|
60
|
+
separated by whitespace). If provided, the stars will be used to simulate
|
|
61
|
+
additional contributions to the night-sky background. For details on the
|
|
62
|
+
parameters, see the sim_telarray manual.
|
|
63
|
+
zenith_angle (float, optional)
|
|
64
|
+
Zenith angle in degrees.
|
|
65
|
+
azimuth_angle (float, optional)
|
|
66
|
+
Azimuth angle in degrees.
|
|
67
|
+
flasher_photons (float, optional)
|
|
68
|
+
Number of photons in the flasher pulse at each photodetector.
|
|
69
|
+
flasher_var_photons (float, optional)
|
|
70
|
+
Relative variance of the number of photons in the flasher pulse.
|
|
71
|
+
flasher_exp_time (float, optional)
|
|
72
|
+
Exponential decay time of the flasher pulse in nano-seconds.
|
|
73
|
+
flasher_sig_time (float, optional)
|
|
74
|
+
Sigma of Gaussian-shaped flasher pulse in nano-seconds.
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
import logging
|
|
79
|
+
from pathlib import Path
|
|
80
|
+
|
|
81
|
+
import simtools.utils.general as gen
|
|
82
|
+
from simtools.configuration import configurator
|
|
83
|
+
from simtools.simulator import Simulator
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _parse(label):
|
|
87
|
+
"""Parse command line configuration."""
|
|
88
|
+
config = configurator.Configurator(label=label, description="Simulate calibration events.")
|
|
89
|
+
config.parser.add_argument(
|
|
90
|
+
"--run_mode",
|
|
91
|
+
help="Calibration run mode",
|
|
92
|
+
type=str,
|
|
93
|
+
required=True,
|
|
94
|
+
choices=["pedestals", "dark_pedestals", "nsb_only_pedestals", "flasher"],
|
|
95
|
+
)
|
|
96
|
+
config.parser.add_argument(
|
|
97
|
+
"--number_of_events",
|
|
98
|
+
help="Number of calibration events to simulate",
|
|
99
|
+
type=int,
|
|
100
|
+
required=True,
|
|
101
|
+
)
|
|
102
|
+
config.parser.add_argument(
|
|
103
|
+
"--nsb_scaling_factor",
|
|
104
|
+
help=(
|
|
105
|
+
"Scaling factor for the NSB rate. "
|
|
106
|
+
"Default is 1.0, which corresponds to the nominal (dark sky) NSB rate."
|
|
107
|
+
),
|
|
108
|
+
type=float,
|
|
109
|
+
required=False,
|
|
110
|
+
default=1.0,
|
|
111
|
+
)
|
|
112
|
+
config.parser.add_argument(
|
|
113
|
+
"--stars",
|
|
114
|
+
help="List of stars (azimuth, zenith, weighting factor).",
|
|
115
|
+
type=str,
|
|
116
|
+
default=None,
|
|
117
|
+
)
|
|
118
|
+
flasher_args = config.parser.add_argument_group("Flasher configuration")
|
|
119
|
+
flasher_args.add_argument(
|
|
120
|
+
"--flasher_photons",
|
|
121
|
+
help="Number of photons in the flasher pulse at each photodetector.",
|
|
122
|
+
type=float,
|
|
123
|
+
default=500.0,
|
|
124
|
+
)
|
|
125
|
+
flasher_args.add_argument(
|
|
126
|
+
"--flasher_var_photons",
|
|
127
|
+
help="Relative variance of the number of photons in the flasher pulse.",
|
|
128
|
+
type=float,
|
|
129
|
+
default=0.05,
|
|
130
|
+
)
|
|
131
|
+
flasher_args.add_argument(
|
|
132
|
+
"--flasher_exp_time",
|
|
133
|
+
help="Exponential decay time of the flasher pulse in nanoseconds.",
|
|
134
|
+
type=float,
|
|
135
|
+
default=0.0,
|
|
136
|
+
)
|
|
137
|
+
flasher_args.add_argument(
|
|
138
|
+
"--flasher_sig_time",
|
|
139
|
+
help="Sigma of Gaussian-shaped flasher pulse in nanoseconds.",
|
|
140
|
+
type=float,
|
|
141
|
+
default=0.0,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return config.initialize(
|
|
145
|
+
db_config=True,
|
|
146
|
+
simulation_model=["site", "layout", "telescope", "model_version"],
|
|
147
|
+
simulation_configuration={
|
|
148
|
+
"corsika_configuration": ["run_number", "azimuth_angle", "zenith_angle"],
|
|
149
|
+
"sim_telarray_configuration": ["all"],
|
|
150
|
+
},
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def main(): # noqa: D103
|
|
155
|
+
label = Path(__file__).stem
|
|
156
|
+
args_dict, db_config = _parse(label)
|
|
157
|
+
|
|
158
|
+
logger = logging.getLogger()
|
|
159
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
160
|
+
|
|
161
|
+
simulator = Simulator(label=args_dict.get("label"), args_dict=args_dict, db_config=db_config)
|
|
162
|
+
simulator.simulate()
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
if __name__ == "__main__":
|
|
166
|
+
main()
|