gammasimtools 0.17.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.17.0.dist-info → gammasimtools-0.19.0.dist-info}/METADATA +27 -69
- gammasimtools-0.19.0.dist-info/RECORD +393 -0
- {gammasimtools-0.17.0.dist-info → gammasimtools-0.19.0.dist-info}/entry_points.txt +10 -2
- {gammasimtools-0.17.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_simulation_model_from_repository_to_db.py +10 -1
- 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 +18 -12
- 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 +97 -5
- 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 +16 -18
- simtools/applications/plot_array_layout.py +3 -3
- simtools/applications/plot_simtel_events.py +379 -0
- simtools/applications/plot_tabular_data.py +21 -3
- simtools/applications/plot_tabular_data_for_model_parameter.py +104 -0
- simtools/applications/print_version.py +8 -9
- simtools/applications/production_derive_corsika_limits.py +64 -27
- 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 +31 -1
- simtools/configuration/configurator.py +4 -4
- simtools/constants.py +2 -0
- 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 +88 -24
- simtools/data_model/validate_data.py +34 -9
- simtools/db/db_handler.py +48 -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/{io_operations/io_table_handler.py → io/table_handler.py} +1 -1
- simtools/job_execution/htcondor_script_generator.py +15 -4
- simtools/layout/array_layout.py +1 -1
- simtools/layout/array_layout_utils.py +19 -8
- simtools/model/array_model.py +28 -5
- 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/resources/array-element-ids.json +126 -0
- 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 +7 -3
- 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 +42 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +44 -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 +11 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +11 -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 +32 -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 +13 -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 +11 -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 +11 -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 +13 -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 +20 -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 +11 -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 +51 -59
- 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 +16 -43
- simtools/simtel/simtel_io_event_writer.py +46 -10
- simtools/simtel/simtel_io_histogram.py +3 -1
- simtools/simtel/simtel_io_histograms.py +7 -3
- simtools/simtel/simtel_io_metadata.py +99 -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 -257
- simtools/utils/geometry.py +36 -0
- simtools/utils/names.py +72 -3
- simtools/visualization/legend_handlers.py +180 -264
- simtools/visualization/plot_array_layout.py +20 -8
- simtools/visualization/plot_pixels.py +1 -2
- simtools/visualization/plot_tables.py +202 -27
- simtools/visualization/simtel_event_plots.py +816 -0
- simtools/visualization/visualize.py +4 -101
- gammasimtools-0.17.0.dist-info/RECORD +0 -374
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -189
- {gammasimtools-0.17.0.dist-info → gammasimtools-0.19.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.17.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/{schemas → resources}/array_elements.yml +0 -0
|
@@ -9,6 +9,17 @@ Command line arguments
|
|
|
9
9
|
----------------------
|
|
10
10
|
config_file (str, required)
|
|
11
11
|
Configuration file name for plotting.
|
|
12
|
+
output_file (str, required)
|
|
13
|
+
Output file name (without suffix).
|
|
14
|
+
|
|
15
|
+
Example
|
|
16
|
+
-------
|
|
17
|
+
|
|
18
|
+
Plot tabular data using a configuration file.
|
|
19
|
+
|
|
20
|
+
.. code-block:: console
|
|
21
|
+
|
|
22
|
+
simtools-plot-tabular-data --plot_config config_file_name --output_file output_file_name
|
|
12
23
|
|
|
13
24
|
"""
|
|
14
25
|
|
|
@@ -20,7 +31,7 @@ from simtools.configuration import configurator
|
|
|
20
31
|
from simtools.constants import PLOT_CONFIG_SCHEMA
|
|
21
32
|
from simtools.data_model import schema
|
|
22
33
|
from simtools.data_model.metadata_collector import MetadataCollector
|
|
23
|
-
from simtools.
|
|
34
|
+
from simtools.io import ascii_handler, io_handler
|
|
24
35
|
from simtools.visualization import plot_tables
|
|
25
36
|
|
|
26
37
|
|
|
@@ -51,6 +62,12 @@ def _parse(label, description, usage):
|
|
|
51
62
|
required=True,
|
|
52
63
|
default=None,
|
|
53
64
|
)
|
|
65
|
+
config.parser.add_argument(
|
|
66
|
+
"--table_data_path",
|
|
67
|
+
help="Path to the data files (optional). Expect all files to be in the same directory.",
|
|
68
|
+
type=str,
|
|
69
|
+
default=None,
|
|
70
|
+
)
|
|
54
71
|
config.parser.add_argument(
|
|
55
72
|
"--output_file",
|
|
56
73
|
help="Output file name (without suffix)",
|
|
@@ -74,15 +91,16 @@ def main():
|
|
|
74
91
|
|
|
75
92
|
plot_config = gen.convert_keys_in_dict_to_lowercase(
|
|
76
93
|
schema.validate_dict_using_schema(
|
|
77
|
-
|
|
94
|
+
ascii_handler.collect_data_from_file(args_dict["plot_config"]),
|
|
78
95
|
PLOT_CONFIG_SCHEMA,
|
|
79
96
|
)
|
|
80
97
|
)
|
|
81
98
|
|
|
82
99
|
plot_tables.plot(
|
|
83
|
-
config=plot_config["
|
|
100
|
+
config=plot_config["plot"],
|
|
84
101
|
output_file=io_handler_instance.get_output_file(args_dict["output_file"]),
|
|
85
102
|
db_config=db_config_,
|
|
103
|
+
data_path=args_dict.get("table_data_path"),
|
|
86
104
|
)
|
|
87
105
|
|
|
88
106
|
MetadataCollector.dump(
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
r"""
|
|
3
|
+
Plot tabular data for a single model parameter using default plotting configurations.
|
|
4
|
+
|
|
5
|
+
Uses plotting configurations as defined in the model parameters schema files.
|
|
6
|
+
|
|
7
|
+
Command line arguments
|
|
8
|
+
----------------------
|
|
9
|
+
parameter (str, required)
|
|
10
|
+
Model parameter to plot (e.g., 'atmospheric_profile').
|
|
11
|
+
parameter_version (str, required)
|
|
12
|
+
Version of the model parameter to plot (e.g., '1.0.0').
|
|
13
|
+
site (str, required)
|
|
14
|
+
Site for which the model parameter is defined (e.g., 'North').
|
|
15
|
+
telescope (str, optional)
|
|
16
|
+
Telescope for which the model parameter is defined (e.g., 'LSTN-01').
|
|
17
|
+
output_file (str, required)
|
|
18
|
+
Output file name (without suffix).
|
|
19
|
+
plot_type (str, optional)
|
|
20
|
+
Type of plot as defined in the schema file.
|
|
21
|
+
Use '--plot_type all' to plot all types defined in the schema.
|
|
22
|
+
|
|
23
|
+
Example
|
|
24
|
+
-------
|
|
25
|
+
|
|
26
|
+
Plot tabular data for a specific type defined in the schema file:
|
|
27
|
+
|
|
28
|
+
.. code-block:: console
|
|
29
|
+
|
|
30
|
+
simtools-plot-tabular-data-for-model-parameter \\
|
|
31
|
+
--parameter atmospheric_profile \\
|
|
32
|
+
--parameter_version 1.0.0 \\
|
|
33
|
+
--site North \\
|
|
34
|
+
--plot_type refractive_index_vs_altitude
|
|
35
|
+
|
|
36
|
+
Plot tabular data for all types defined in the schema file:
|
|
37
|
+
|
|
38
|
+
.. code-block:: console
|
|
39
|
+
|
|
40
|
+
simtools-plot-tabular-data-for-model-parameter \\
|
|
41
|
+
--parameter fadc_pulse_shape
|
|
42
|
+
--parameter_version 1.0.0 \\
|
|
43
|
+
--site North \\
|
|
44
|
+
--telescope LSTN-01 \\
|
|
45
|
+
--plot_type all
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
import logging
|
|
50
|
+
from pathlib import Path
|
|
51
|
+
|
|
52
|
+
import simtools.utils.general as gen
|
|
53
|
+
from simtools.configuration import configurator
|
|
54
|
+
from simtools.data_model.metadata_collector import MetadataCollector
|
|
55
|
+
from simtools.io import io_handler
|
|
56
|
+
from simtools.visualization import plot_tables
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _parse(label, description):
|
|
60
|
+
"""Parse command line configuration."""
|
|
61
|
+
config = configurator.Configurator(label=label, description=description)
|
|
62
|
+
|
|
63
|
+
config.parser.add_argument("--parameter", type=str, required=True, help="Parameter name.")
|
|
64
|
+
config.parser.add_argument(
|
|
65
|
+
"--plot_type",
|
|
66
|
+
help="Plot type as defined in the schema file.",
|
|
67
|
+
type=str,
|
|
68
|
+
required=True,
|
|
69
|
+
default=None,
|
|
70
|
+
)
|
|
71
|
+
return config.initialize(db_config=True, simulation_model=["telescope", "parameter_version"])
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def main():
|
|
75
|
+
"""Plot tabular data."""
|
|
76
|
+
args_dict, db_config = _parse(
|
|
77
|
+
label=Path(__file__).stem,
|
|
78
|
+
description="Plots tabular data for a model parameter.",
|
|
79
|
+
)
|
|
80
|
+
logger = logging.getLogger()
|
|
81
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "INFO")))
|
|
82
|
+
io_handler_instance = io_handler.IOHandler()
|
|
83
|
+
|
|
84
|
+
plot_configs, output_files = plot_tables.generate_plot_configurations(
|
|
85
|
+
parameter=args_dict["parameter"],
|
|
86
|
+
parameter_version=args_dict["parameter_version"],
|
|
87
|
+
site=args_dict["site"],
|
|
88
|
+
telescope=args_dict.get("telescope"),
|
|
89
|
+
output_path=io_handler_instance.get_output_directory(),
|
|
90
|
+
plot_type=args_dict["plot_type"],
|
|
91
|
+
db_config=db_config,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
for plot_config, output_file in zip(plot_configs, output_files):
|
|
95
|
+
plot_tables.plot(
|
|
96
|
+
config=plot_config,
|
|
97
|
+
output_file=output_file,
|
|
98
|
+
db_config=db_config,
|
|
99
|
+
)
|
|
100
|
+
MetadataCollector.dump(args_dict, output_file=output_file, add_activity_name=True)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
main()
|
|
@@ -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__":
|
|
@@ -4,34 +4,51 @@ r"""
|
|
|
4
4
|
Derive CORSIKA configuration limits for energy, core distance, and viewcone radius.
|
|
5
5
|
|
|
6
6
|
This tool determines configuration limits based on triggered events from broad-range
|
|
7
|
-
simulations. It supports
|
|
7
|
+
simulations. It supports the derivation of the following CORSIKA configuration parameters:
|
|
8
8
|
|
|
9
|
-
- **ERANGE**:
|
|
10
|
-
- **CSCAT**:
|
|
11
|
-
- **VIEWCONE**:
|
|
9
|
+
- **ERANGE**: lower energy limit
|
|
10
|
+
- **CSCAT**: upper core distance
|
|
11
|
+
- **VIEWCONE**: viewcone radius
|
|
12
12
|
|
|
13
|
+
Broad-range simulations in this context are simulation sets generated with wide-ranging
|
|
14
|
+
definitions for above parameters.
|
|
13
15
|
Limits are computed based on a configurable maximum event loss fraction.
|
|
14
16
|
Results are provided as a table with the following columns:
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
19
|
+
| Field | Data Type | Units | Description |
|
|
20
|
+
+=====================+===========+========+===============================================+
|
|
21
|
+
| primary_particle | string | | Particle type (e.g., gamma, proton). |
|
|
22
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
23
|
+
| array_name | string | | Array name (custom or as defined in |
|
|
24
|
+
| | | | 'array_layouts'). |
|
|
25
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
26
|
+
| telescope_ids | string | | Comma-separated list of telescope IDs |
|
|
27
|
+
| | | | of this array. |
|
|
28
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
29
|
+
| zenith | float64 | deg | Direction of array pointing zenith. |
|
|
30
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
31
|
+
| azimuth | float64 | deg | Direction of array pointing azimuth. |
|
|
32
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
33
|
+
| nsb_level | float64 | | Night sky background level. |
|
|
34
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
35
|
+
| lower_energy_limit | float64 | TeV | Derived lower energy limit (**ERANGE**) |
|
|
36
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
37
|
+
| upper_radius_limit | float64 | m | Derived upper core distance limit (**CSCAT**) |
|
|
38
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
39
|
+
| viewcone_radius | float64 | deg | Derived viewcone radius limit (**VIEWCONE**) |
|
|
40
|
+
+---------------------+-----------+--------+-----------------------------------------------+
|
|
25
41
|
|
|
26
42
|
The input event data files are generated using the application simtools-generate-simtel-event-data
|
|
27
|
-
and are required for each point in the
|
|
43
|
+
and are required for each point in the observational parameter space (e.g., array pointing
|
|
44
|
+
directions, level of night sky background, etc.).
|
|
28
45
|
|
|
29
46
|
Command line arguments
|
|
30
47
|
----------------------
|
|
31
|
-
|
|
32
|
-
Path to
|
|
33
|
-
telescope_ids (str,
|
|
34
|
-
|
|
48
|
+
event_data_file (str, required)
|
|
49
|
+
Path to reduced event data file.
|
|
50
|
+
telescope_ids (str, optional)
|
|
51
|
+
Custom array layout file containing telescope IDs.
|
|
35
52
|
loss_fraction (float, required)
|
|
36
53
|
Maximum event-loss fraction for limit computation.
|
|
37
54
|
plot_histograms (bool, optional)
|
|
@@ -41,12 +58,24 @@ output_file (str, optional)
|
|
|
41
58
|
|
|
42
59
|
Example
|
|
43
60
|
-------
|
|
44
|
-
|
|
61
|
+
|
|
62
|
+
Derive limits for a list of array layouts (use 'all' to derive limits for all layouts):
|
|
45
63
|
|
|
46
64
|
.. code-block:: console
|
|
47
65
|
|
|
48
66
|
simtools-production-derive-corsika-limits \\
|
|
49
|
-
--
|
|
67
|
+
--event_data_file event_dat_file.hdf5 \\
|
|
68
|
+
--array_layout_name alpha,beta \\
|
|
69
|
+
--loss_fraction 1e-6 \\
|
|
70
|
+
--plot_histograms \\
|
|
71
|
+
--output_file corsika_simulation_limits_lookup.ecsv
|
|
72
|
+
|
|
73
|
+
Derive limits for a given file for custom defined array layouts:
|
|
74
|
+
|
|
75
|
+
.. code-block:: console
|
|
76
|
+
|
|
77
|
+
simtools-production-derive-corsika-limits \\
|
|
78
|
+
--event_data_file event_dat_file.hdf5 \\
|
|
50
79
|
--telescope_ids path/to/telescope_configs.yaml \\
|
|
51
80
|
--loss_fraction 1e-6 \\
|
|
52
81
|
--plot_histograms \\
|
|
@@ -57,7 +86,7 @@ import logging
|
|
|
57
86
|
|
|
58
87
|
import simtools.utils.general as gen
|
|
59
88
|
from simtools.configuration import configurator
|
|
60
|
-
from simtools.production_configuration.
|
|
89
|
+
from simtools.production_configuration.derive_corsika_limits import (
|
|
61
90
|
generate_corsika_limits_grid,
|
|
62
91
|
)
|
|
63
92
|
|
|
@@ -68,15 +97,15 @@ def _parse():
|
|
|
68
97
|
description="Derive limits for energy, radial distance, and viewcone."
|
|
69
98
|
)
|
|
70
99
|
config.parser.add_argument(
|
|
71
|
-
"--
|
|
100
|
+
"--event_data_file",
|
|
72
101
|
type=str,
|
|
73
102
|
required=True,
|
|
74
|
-
help="
|
|
103
|
+
help="Event data file containing reduced event data.",
|
|
75
104
|
)
|
|
76
105
|
config.parser.add_argument(
|
|
77
106
|
"--telescope_ids",
|
|
78
107
|
type=str,
|
|
79
|
-
required=
|
|
108
|
+
required=False,
|
|
80
109
|
help="Path to a file containing telescope configurations.",
|
|
81
110
|
)
|
|
82
111
|
config.parser.add_argument(
|
|
@@ -91,17 +120,25 @@ def _parse():
|
|
|
91
120
|
action="store_true",
|
|
92
121
|
default=False,
|
|
93
122
|
)
|
|
94
|
-
return config.initialize(
|
|
123
|
+
return config.initialize(
|
|
124
|
+
db_config=True,
|
|
125
|
+
output=True,
|
|
126
|
+
simulation_model=[
|
|
127
|
+
"site",
|
|
128
|
+
"model_version",
|
|
129
|
+
"layout",
|
|
130
|
+
],
|
|
131
|
+
)
|
|
95
132
|
|
|
96
133
|
|
|
97
134
|
def main():
|
|
98
135
|
"""Derive limits for energy, radial distance, and viewcone."""
|
|
99
|
-
args_dict,
|
|
136
|
+
args_dict, db_config = _parse()
|
|
100
137
|
|
|
101
138
|
logger = logging.getLogger()
|
|
102
139
|
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "info")))
|
|
103
140
|
|
|
104
|
-
generate_corsika_limits_grid(args_dict)
|
|
141
|
+
generate_corsika_limits_grid(args_dict, db_config)
|
|
105
142
|
|
|
106
143
|
|
|
107
144
|
if __name__ == "__main__":
|
|
@@ -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()
|