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
|
@@ -5,7 +5,7 @@ from collections import namedtuple
|
|
|
5
5
|
|
|
6
6
|
import astropy.units as u
|
|
7
7
|
|
|
8
|
-
from simtools.
|
|
8
|
+
from simtools.io import io_handler
|
|
9
9
|
from simtools.runners.simtel_runner import SimtelRunner
|
|
10
10
|
from simtools.utils import names
|
|
11
11
|
from simtools.utils.general import clear_default_sim_telarray_cfg_directories
|
simtools/simulator.py
CHANGED
|
@@ -4,7 +4,6 @@ import gzip
|
|
|
4
4
|
import logging
|
|
5
5
|
import re
|
|
6
6
|
import shutil
|
|
7
|
-
import tarfile
|
|
8
7
|
from collections import defaultdict
|
|
9
8
|
from pathlib import Path
|
|
10
9
|
|
|
@@ -12,7 +11,7 @@ import numpy as np
|
|
|
12
11
|
|
|
13
12
|
import simtools.utils.general as gen
|
|
14
13
|
from simtools.corsika.corsika_config import CorsikaConfig
|
|
15
|
-
from simtools.
|
|
14
|
+
from simtools.io import io_handler, table_handler
|
|
16
15
|
from simtools.job_execution.job_manager import JobManager
|
|
17
16
|
from simtools.model.array_model import ArrayModel
|
|
18
17
|
from simtools.runners.corsika_runner import CorsikaRunner
|
|
@@ -49,8 +48,8 @@ class Simulator:
|
|
|
49
48
|
Instance label.
|
|
50
49
|
extra_commands: str or list of str
|
|
51
50
|
Extra commands to be added to the run script before the run command.
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
db_config: dict
|
|
52
|
+
Database configuration.
|
|
54
53
|
"""
|
|
55
54
|
|
|
56
55
|
def __init__(
|
|
@@ -58,15 +57,18 @@ class Simulator:
|
|
|
58
57
|
args_dict,
|
|
59
58
|
label=None,
|
|
60
59
|
extra_commands=None,
|
|
61
|
-
|
|
60
|
+
db_config=None,
|
|
62
61
|
):
|
|
63
62
|
"""Initialize Simulator class."""
|
|
64
|
-
self.
|
|
63
|
+
self.logger = logging.getLogger(__name__)
|
|
64
|
+
self.label = label
|
|
65
|
+
|
|
65
66
|
self.args_dict = args_dict
|
|
67
|
+
self.db_config = db_config
|
|
66
68
|
|
|
67
|
-
self.simulation_software = self.args_dict
|
|
68
|
-
self.
|
|
69
|
-
self.
|
|
69
|
+
self.simulation_software = self.args_dict.get("simulation_software", "corsika_sim_telarray")
|
|
70
|
+
self.run_mode = self.args_dict.get("run_mode")
|
|
71
|
+
self.logger.debug(f"Init Simulator {self.simulation_software}")
|
|
70
72
|
|
|
71
73
|
self.io_handler = io_handler.IOHandler()
|
|
72
74
|
|
|
@@ -82,8 +84,8 @@ class Simulator:
|
|
|
82
84
|
),
|
|
83
85
|
"seed_file_name": "sim_telarray_instrument_seeds.txt", # name only; no directory
|
|
84
86
|
}
|
|
85
|
-
self.array_models = self._initialize_array_models(
|
|
86
|
-
self._simulation_runner = self._initialize_simulation_runner(
|
|
87
|
+
self.array_models = self._initialize_array_models()
|
|
88
|
+
self._simulation_runner = self._initialize_simulation_runner()
|
|
87
89
|
|
|
88
90
|
@property
|
|
89
91
|
def simulation_software(self):
|
|
@@ -103,37 +105,30 @@ class Simulator:
|
|
|
103
105
|
|
|
104
106
|
Raises
|
|
105
107
|
------
|
|
106
|
-
|
|
108
|
+
ValueError
|
|
107
109
|
|
|
108
110
|
"""
|
|
109
111
|
if simulation_software not in ["sim_telarray", "corsika", "corsika_sim_telarray"]:
|
|
110
|
-
|
|
111
|
-
raise gen.InvalidConfigDataError
|
|
112
|
+
raise ValueError(f"Invalid simulation software: {simulation_software}")
|
|
112
113
|
self._simulation_software = simulation_software.lower()
|
|
113
114
|
|
|
114
|
-
def _initialize_array_models(self
|
|
115
|
+
def _initialize_array_models(self):
|
|
115
116
|
"""
|
|
116
117
|
Initialize array simulation models.
|
|
117
118
|
|
|
118
|
-
Parameters
|
|
119
|
-
----------
|
|
120
|
-
mongo_db_config: dict
|
|
121
|
-
Database configuration.
|
|
122
|
-
|
|
123
119
|
Returns
|
|
124
120
|
-------
|
|
125
121
|
list
|
|
126
122
|
List of ArrayModel objects.
|
|
127
123
|
"""
|
|
128
|
-
|
|
129
|
-
versions = [model_version] if not isinstance(model_version, list) else model_version
|
|
124
|
+
versions = gen.ensure_iterable(self.args_dict.get("model_version", []))
|
|
130
125
|
|
|
131
126
|
return [
|
|
132
127
|
ArrayModel(
|
|
133
128
|
label=self.label,
|
|
134
129
|
site=self.args_dict.get("site"),
|
|
135
130
|
layout_name=self.args_dict.get("array_layout_name"),
|
|
136
|
-
mongo_db_config=
|
|
131
|
+
mongo_db_config=self.db_config,
|
|
137
132
|
model_version=version,
|
|
138
133
|
sim_telarray_seeds={
|
|
139
134
|
"seed": self._get_seed_for_random_instrument_instances(
|
|
@@ -188,35 +183,24 @@ class Simulator:
|
|
|
188
183
|
-------
|
|
189
184
|
list
|
|
190
185
|
List of run numbers.
|
|
191
|
-
|
|
192
|
-
Raises
|
|
193
|
-
------
|
|
194
|
-
KeyError
|
|
195
|
-
If 'run_number', 'run_number_offset' and 'number_of_runs' are
|
|
196
|
-
not found in the configuration.
|
|
197
186
|
"""
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return self._validate_run_list_and_range(
|
|
206
|
-
run_list=None,
|
|
207
|
-
run_range=[
|
|
208
|
-
offset_run_number,
|
|
209
|
-
offset_run_number + self.args_dict["number_of_runs"],
|
|
210
|
-
],
|
|
211
|
-
)
|
|
212
|
-
except KeyError as exc:
|
|
213
|
-
self._logger.error(
|
|
214
|
-
"Error in initializing run list "
|
|
215
|
-
"(missing 'run_number', 'run_number_offset' or 'number_of_runs')."
|
|
187
|
+
offset_run_number = self.args_dict.get("run_number_offset", 0) + self.args_dict.get(
|
|
188
|
+
"run_number", 1
|
|
189
|
+
)
|
|
190
|
+
if self.args_dict.get("number_of_runs", 1) <= 1:
|
|
191
|
+
return self._prepare_run_list_and_range(
|
|
192
|
+
run_list=offset_run_number,
|
|
193
|
+
run_range=None,
|
|
216
194
|
)
|
|
217
|
-
|
|
195
|
+
return self._prepare_run_list_and_range(
|
|
196
|
+
run_list=None,
|
|
197
|
+
run_range=[
|
|
198
|
+
offset_run_number,
|
|
199
|
+
offset_run_number + self.args_dict["number_of_runs"],
|
|
200
|
+
],
|
|
201
|
+
)
|
|
218
202
|
|
|
219
|
-
def
|
|
203
|
+
def _prepare_run_list_and_range(self, run_list, run_range):
|
|
220
204
|
"""
|
|
221
205
|
Prepare list of run numbers from a list or from a range.
|
|
222
206
|
|
|
@@ -233,49 +217,40 @@ class Simulator:
|
|
|
233
217
|
-------
|
|
234
218
|
list
|
|
235
219
|
list of unique run numbers (integers)
|
|
236
|
-
|
|
237
220
|
"""
|
|
238
221
|
if run_list is None and run_range is None:
|
|
239
|
-
self.
|
|
222
|
+
self.logger.debug("Nothing to prepare - run_list and run_range not given.")
|
|
240
223
|
return None
|
|
241
224
|
|
|
242
225
|
validated_runs = []
|
|
243
226
|
if run_list is not None:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
msg = "run_list must contain only integers."
|
|
248
|
-
self._logger.error(msg)
|
|
249
|
-
raise InvalidRunsToSimulateError
|
|
250
|
-
validated_runs = list(run_list)
|
|
227
|
+
validated_runs = gen.ensure_iterable(run_list)
|
|
228
|
+
if not all(isinstance(r, int) for r in validated_runs):
|
|
229
|
+
raise InvalidRunsToSimulateError(f"Run list must contain only integers: {run_list}")
|
|
251
230
|
|
|
252
231
|
if run_range is not None:
|
|
253
232
|
if not all(isinstance(r, int) for r in run_range) or len(run_range) != 2:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
233
|
+
raise InvalidRunsToSimulateError(
|
|
234
|
+
f"Run_range must contain two integers only: {run_range}"
|
|
235
|
+
)
|
|
258
236
|
run_range = np.arange(run_range[0], run_range[1])
|
|
259
|
-
self._logger.debug(f"run_range: {run_range}")
|
|
260
237
|
validated_runs.extend(list(run_range))
|
|
261
238
|
|
|
262
239
|
validated_runs_unique = sorted(set(validated_runs))
|
|
263
|
-
self.
|
|
264
|
-
return
|
|
240
|
+
self.logger.info(f"Runlist: {validated_runs_unique}")
|
|
241
|
+
return validated_runs_unique
|
|
265
242
|
|
|
266
|
-
def
|
|
243
|
+
def _corsika_configuration(self):
|
|
267
244
|
"""
|
|
268
|
-
|
|
245
|
+
Define CORSIKA configurations based on the simulation model.
|
|
269
246
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
db_config: dict
|
|
273
|
-
Database configuration.
|
|
247
|
+
For 'corsika_sim_telarray', this is a list since multiple configurations
|
|
248
|
+
might be defined to run in a single job using multipipe.
|
|
274
249
|
|
|
275
250
|
Returns
|
|
276
251
|
-------
|
|
277
|
-
|
|
278
|
-
|
|
252
|
+
CorsikaConfig or list of CorsikaConfig
|
|
253
|
+
CORSIKA configuration(s) based on the simulation model.
|
|
279
254
|
"""
|
|
280
255
|
corsika_configurations = []
|
|
281
256
|
for array_model in self.array_models:
|
|
@@ -284,9 +259,26 @@ class Simulator:
|
|
|
284
259
|
array_model=array_model,
|
|
285
260
|
label=self.label,
|
|
286
261
|
args_dict=self.args_dict,
|
|
287
|
-
db_config=db_config,
|
|
262
|
+
db_config=self.db_config,
|
|
263
|
+
dummy_simulations=self._is_calibration_run(),
|
|
288
264
|
)
|
|
289
265
|
)
|
|
266
|
+
return (
|
|
267
|
+
corsika_configurations
|
|
268
|
+
if self.simulation_software == "corsika_sim_telarray"
|
|
269
|
+
else corsika_configurations[0]
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
def _initialize_simulation_runner(self):
|
|
273
|
+
"""
|
|
274
|
+
Initialize corsika configuration and simulation runners.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
CorsikaRunner or SimulatorArray or CorsikaSimtelRunner
|
|
279
|
+
Simulation runner object.
|
|
280
|
+
"""
|
|
281
|
+
corsika_configurations = self._corsika_configuration()
|
|
290
282
|
|
|
291
283
|
runner_class = {
|
|
292
284
|
"corsika": CorsikaRunner,
|
|
@@ -294,16 +286,9 @@ class Simulator:
|
|
|
294
286
|
"corsika_sim_telarray": CorsikaSimtelRunner,
|
|
295
287
|
}.get(self.simulation_software)
|
|
296
288
|
|
|
297
|
-
# In case of CorsikaSimtelRunner we should pass all corsika_configurations
|
|
298
|
-
# to the runner, since we define multiple configurations to run in a single job
|
|
299
|
-
# using multipipe. In other cases we pass only the first one (there's only one anyway).
|
|
300
289
|
runner_args = {
|
|
301
290
|
"label": self.label,
|
|
302
|
-
"corsika_config":
|
|
303
|
-
corsika_configurations
|
|
304
|
-
if runner_class is CorsikaSimtelRunner
|
|
305
|
-
else corsika_configurations[0]
|
|
306
|
-
),
|
|
291
|
+
"corsika_config": corsika_configurations,
|
|
307
292
|
"simtel_path": self.args_dict.get("simtel_path"),
|
|
308
293
|
"use_multipipe": runner_class is CorsikaSimtelRunner,
|
|
309
294
|
}
|
|
@@ -314,6 +299,8 @@ class Simulator:
|
|
|
314
299
|
runner_args["sim_telarray_seeds"] = self.sim_telarray_seeds
|
|
315
300
|
if runner_class is CorsikaSimtelRunner:
|
|
316
301
|
runner_args["sequential"] = self.args_dict.get("sequential", False)
|
|
302
|
+
if self._is_calibration_run():
|
|
303
|
+
runner_args["calibration_runner_args"] = self.args_dict
|
|
317
304
|
|
|
318
305
|
return runner_class(**runner_args)
|
|
319
306
|
|
|
@@ -326,9 +313,7 @@ class Simulator:
|
|
|
326
313
|
input_file_list: str or list of str
|
|
327
314
|
Single file or list of files of shower simulations.
|
|
328
315
|
"""
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
for file in input_file_list:
|
|
316
|
+
for file in gen.ensure_iterable(input_file_list):
|
|
332
317
|
run = self._guess_run_from_file(file)
|
|
333
318
|
self._fill_results(file, run)
|
|
334
319
|
if run not in self.runs:
|
|
@@ -346,7 +331,7 @@ class Simulator:
|
|
|
346
331
|
runs_and_files_to_submit = self._get_runs_and_files_to_submit(
|
|
347
332
|
input_file_list=input_file_list
|
|
348
333
|
)
|
|
349
|
-
self.
|
|
334
|
+
self.logger.info(
|
|
350
335
|
f"Starting submission for {len(runs_and_files_to_submit)} "
|
|
351
336
|
f"run{'s' if len(runs_and_files_to_submit) > 1 else ''}"
|
|
352
337
|
)
|
|
@@ -373,7 +358,7 @@ class Simulator:
|
|
|
373
358
|
"""
|
|
374
359
|
Return a dictionary with run numbers and simulation files.
|
|
375
360
|
|
|
376
|
-
The latter are expected to be given for the
|
|
361
|
+
The latter are expected to be given for the sim_telarray simulator.
|
|
377
362
|
|
|
378
363
|
Parameters
|
|
379
364
|
----------
|
|
@@ -390,39 +375,19 @@ class Simulator:
|
|
|
390
375
|
------
|
|
391
376
|
ValueError
|
|
392
377
|
If no runs are to be submitted.
|
|
393
|
-
|
|
394
378
|
"""
|
|
395
379
|
_runs_and_files = {}
|
|
396
|
-
self.
|
|
380
|
+
self.logger.debug(f"Getting runs and files to submit ({input_file_list})")
|
|
397
381
|
|
|
398
|
-
if self.simulation_software == "sim_telarray":
|
|
399
|
-
input_file_list =
|
|
382
|
+
if self.simulation_software == "sim_telarray" and self.run_mode is None:
|
|
383
|
+
input_file_list = gen.ensure_iterable(input_file_list)
|
|
400
384
|
_runs_and_files = {self._guess_run_from_file(file): file for file in input_file_list}
|
|
401
|
-
|
|
385
|
+
else:
|
|
402
386
|
_runs_and_files = dict.fromkeys(self._get_runs_to_simulate())
|
|
403
387
|
if len(_runs_and_files) == 0:
|
|
404
388
|
raise ValueError("No runs to submit.")
|
|
405
389
|
return _runs_and_files
|
|
406
390
|
|
|
407
|
-
@staticmethod
|
|
408
|
-
def _enforce_list_type(input_file_list):
|
|
409
|
-
"""
|
|
410
|
-
Enforce the input list to be a list.
|
|
411
|
-
|
|
412
|
-
Parameters
|
|
413
|
-
----------
|
|
414
|
-
input_file_list: str or list of str
|
|
415
|
-
Single file or list of files of shower simulations.
|
|
416
|
-
|
|
417
|
-
Returns
|
|
418
|
-
-------
|
|
419
|
-
list
|
|
420
|
-
List of input files.
|
|
421
|
-
"""
|
|
422
|
-
if not input_file_list:
|
|
423
|
-
return []
|
|
424
|
-
return input_file_list if isinstance(input_file_list, list) else [input_file_list]
|
|
425
|
-
|
|
426
391
|
def _guess_run_from_file(self, file):
|
|
427
392
|
"""
|
|
428
393
|
Extract the run number from the given file name.
|
|
@@ -446,7 +411,7 @@ class Simulator:
|
|
|
446
411
|
run_str = re.search(r"run\d*", file_name).group()
|
|
447
412
|
return int(run_str[3:])
|
|
448
413
|
except (ValueError, AttributeError):
|
|
449
|
-
self.
|
|
414
|
+
self.logger.warning(f"Run number could not be guessed from {file_name} using run = 1")
|
|
450
415
|
return 1
|
|
451
416
|
|
|
452
417
|
def _fill_results(self, file, run_number):
|
|
@@ -535,25 +500,9 @@ class Simulator:
|
|
|
535
500
|
List with the full path of all output files.
|
|
536
501
|
|
|
537
502
|
"""
|
|
538
|
-
self.
|
|
503
|
+
self.logger.info(f"Getting list of {file_type} files")
|
|
539
504
|
return self._results[file_type]
|
|
540
505
|
|
|
541
|
-
def print_list_of_files(self, file_type="simtel_output"):
|
|
542
|
-
"""
|
|
543
|
-
Print list of output files generated by simulations.
|
|
544
|
-
|
|
545
|
-
Options are "input", "simtel_output", "hist", "log".
|
|
546
|
-
|
|
547
|
-
Parameters
|
|
548
|
-
----------
|
|
549
|
-
file_type : str
|
|
550
|
-
File type to be listed.
|
|
551
|
-
|
|
552
|
-
"""
|
|
553
|
-
self._logger.info(f"Printing list of {file_type} files")
|
|
554
|
-
for file in self._results[file_type]:
|
|
555
|
-
print(file)
|
|
556
|
-
|
|
557
506
|
def _make_resources_report(self, input_file_list):
|
|
558
507
|
"""
|
|
559
508
|
Prepare a simple report on computing wall clock time used in the simulations.
|
|
@@ -632,7 +581,7 @@ class Simulator:
|
|
|
632
581
|
"""
|
|
633
582
|
if run_list is None and run_range is None:
|
|
634
583
|
return [] if self.runs is None else self.runs
|
|
635
|
-
return self.
|
|
584
|
+
return self._prepare_run_list_and_range(run_list, run_range)
|
|
636
585
|
|
|
637
586
|
def save_file_lists(self):
|
|
638
587
|
"""Save files lists for output and log files."""
|
|
@@ -642,12 +591,12 @@ class Simulator:
|
|
|
642
591
|
)
|
|
643
592
|
file_list = self.get_file_list(file_type=file_type)
|
|
644
593
|
if all(element is not None for element in file_list) and len(file_list) > 0:
|
|
645
|
-
self.
|
|
594
|
+
self.logger.info(f"Saving list of {file_type} files to {file_name}")
|
|
646
595
|
with open(file_name, "w", encoding="utf-8") as f:
|
|
647
596
|
for line in self.get_file_list(file_type=file_type):
|
|
648
597
|
f.write(f"{line}\n")
|
|
649
598
|
else:
|
|
650
|
-
self.
|
|
599
|
+
self.logger.debug(f"No files to save for {file_type} files.")
|
|
651
600
|
|
|
652
601
|
def save_reduced_event_lists(self):
|
|
653
602
|
"""
|
|
@@ -657,7 +606,7 @@ class Simulator:
|
|
|
657
606
|
but with a 'hdf5' extension.
|
|
658
607
|
"""
|
|
659
608
|
if "sim_telarray" not in self.simulation_software:
|
|
660
|
-
self.
|
|
609
|
+
self.logger.warning(
|
|
661
610
|
"Reduced event lists can only be saved for sim_telarray simulations."
|
|
662
611
|
)
|
|
663
612
|
return
|
|
@@ -666,7 +615,7 @@ class Simulator:
|
|
|
666
615
|
output_files = self.get_file_list(file_type="event_data")
|
|
667
616
|
for input_file, output_file in zip(input_files, output_files):
|
|
668
617
|
generator = SimtelIOEventDataWriter([input_file])
|
|
669
|
-
|
|
618
|
+
table_handler.write_tables(
|
|
670
619
|
tables=generator.process_files(),
|
|
671
620
|
output_file=Path(output_file),
|
|
672
621
|
overwrite_existing=True,
|
|
@@ -684,7 +633,7 @@ class Simulator:
|
|
|
684
633
|
Directory for the tarball with output files.
|
|
685
634
|
|
|
686
635
|
"""
|
|
687
|
-
self.
|
|
636
|
+
self.logger.info(
|
|
688
637
|
f"Packing the output files for registering on the grid ({directory_for_grid_upload})"
|
|
689
638
|
)
|
|
690
639
|
output_files = self.get_file_list(file_type="simtel_output")
|
|
@@ -714,6 +663,7 @@ class Simulator:
|
|
|
714
663
|
# Group files by model version
|
|
715
664
|
for model in self.array_models:
|
|
716
665
|
model_version = model.model_version
|
|
666
|
+
model_files = gen.ensure_iterable(model.pack_model_files())
|
|
717
667
|
|
|
718
668
|
# Filter files for this model version
|
|
719
669
|
model_logs = [f for f in log_files if model_version in f]
|
|
@@ -723,37 +673,34 @@ class Simulator:
|
|
|
723
673
|
if model_logs:
|
|
724
674
|
tar_file_name = Path(model_logs[0]).name.replace("log.gz", "log_hist.tar.gz")
|
|
725
675
|
tar_file_path = directory_for_grid_upload.joinpath(tar_file_name)
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
files_to_tar = model_logs + model_hists + model_corsika_logs
|
|
730
|
-
for file_to_tar in files_to_tar:
|
|
731
|
-
tar.add(file_to_tar, arcname=Path(file_to_tar).name)
|
|
676
|
+
# Add all relevant model, log, histogram, and CORSIKA log files to the tarball
|
|
677
|
+
files_to_tar = model_logs + model_hists + model_corsika_logs + model_files
|
|
678
|
+
gen.pack_tar_file(tar_file_path, files_to_tar)
|
|
732
679
|
|
|
733
680
|
for file_to_move in output_files + reduced_event_files:
|
|
734
681
|
source_file = Path(file_to_move)
|
|
735
682
|
destination_file = directory_for_grid_upload / source_file.name
|
|
736
683
|
if destination_file.exists():
|
|
737
|
-
self.
|
|
684
|
+
self.logger.warning(f"Overwriting existing file: {destination_file}")
|
|
738
685
|
shutil.move(source_file, destination_file)
|
|
739
686
|
|
|
740
|
-
self.
|
|
687
|
+
self.logger.info(f"Output files for the grid placed in {directory_for_grid_upload!s}")
|
|
741
688
|
|
|
742
689
|
def validate_metadata(self):
|
|
743
690
|
"""Validate metadata in the sim_telarray output files."""
|
|
744
691
|
if "sim_telarray" not in self.simulation_software:
|
|
745
|
-
self.
|
|
692
|
+
self.logger.info("No sim_telarray files to validate.")
|
|
746
693
|
return
|
|
747
694
|
|
|
748
695
|
for model in self.array_models:
|
|
749
696
|
files = self.get_file_list(file_type="simtel_output")
|
|
750
697
|
output_file = next((f for f in files if model.model_version in f), None)
|
|
751
698
|
if output_file:
|
|
752
|
-
self.
|
|
699
|
+
self.logger.info(f"Validating metadata for {output_file}")
|
|
753
700
|
assert_sim_telarray_metadata(output_file, model)
|
|
754
|
-
self.
|
|
701
|
+
self.logger.info(f"Metadata for sim_telarray file {output_file} is valid.")
|
|
755
702
|
else:
|
|
756
|
-
self.
|
|
703
|
+
self.logger.warning(
|
|
757
704
|
f"No sim_telarray file found for model version {model.model_version}: {files}"
|
|
758
705
|
)
|
|
759
706
|
|
|
@@ -804,3 +751,14 @@ class Simulator:
|
|
|
804
751
|
new_file.write(line)
|
|
805
752
|
|
|
806
753
|
corsika_log_files.append(str(new_log))
|
|
754
|
+
|
|
755
|
+
def _is_calibration_run(self):
|
|
756
|
+
"""
|
|
757
|
+
Check if this simulation is a calibration run.
|
|
758
|
+
|
|
759
|
+
Returns
|
|
760
|
+
-------
|
|
761
|
+
bool
|
|
762
|
+
True if it is a calibration run, False otherwise.
|
|
763
|
+
"""
|
|
764
|
+
return self.run_mode in ["pedestals", "dark_pedestals", "nsb_only_pedestals", "flasher"]
|
|
@@ -4,9 +4,8 @@ import logging
|
|
|
4
4
|
import os
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
-
import yaml
|
|
8
|
-
|
|
9
7
|
import simtools.utils.general as gen
|
|
8
|
+
from simtools.io import ascii_handler
|
|
10
9
|
|
|
11
10
|
_logger = logging.getLogger(__name__)
|
|
12
11
|
|
|
@@ -43,24 +42,24 @@ def get_list_of_test_configurations(config_files):
|
|
|
43
42
|
|
|
44
43
|
# list of all applications
|
|
45
44
|
# (needs to be sorted for pytest-xdist, see Known Limitations in their website)
|
|
46
|
-
_applications = sorted({item["
|
|
45
|
+
_applications = sorted({item["application"] for item in configs if "application" in item})
|
|
47
46
|
for app in _applications:
|
|
48
47
|
configs.extend(
|
|
49
48
|
[
|
|
50
|
-
{"
|
|
49
|
+
{"application": app, "test_name": "auto-help", "configuration": {"help": True}},
|
|
51
50
|
{
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
51
|
+
"application": app,
|
|
52
|
+
"test_name": "auto-version",
|
|
53
|
+
"configuration": {"version": True},
|
|
55
54
|
},
|
|
56
|
-
{"
|
|
55
|
+
{"application": app, "test_name": "auto-no_config"},
|
|
57
56
|
]
|
|
58
57
|
)
|
|
59
58
|
|
|
60
59
|
return (
|
|
61
60
|
configs,
|
|
62
61
|
[
|
|
63
|
-
f"{item.get('
|
|
62
|
+
f"{item.get('application', 'no-app-name')}_{item.get('test_name', 'no-test-name')}"
|
|
64
63
|
for item in configs
|
|
65
64
|
],
|
|
66
65
|
)
|
|
@@ -74,9 +73,9 @@ def _read_configs_from_files(config_files):
|
|
|
74
73
|
# remove new line characters from config - otherwise issues
|
|
75
74
|
# with especially long file names
|
|
76
75
|
_dict = gen.remove_substring_recursively_from_dict(
|
|
77
|
-
|
|
76
|
+
ascii_handler.collect_data_from_file(file_name=config_file), substring="\n"
|
|
78
77
|
)
|
|
79
|
-
for application in _dict.get("
|
|
78
|
+
for application in _dict.get("applications", []):
|
|
80
79
|
configs.append(application)
|
|
81
80
|
return configs
|
|
82
81
|
|
|
@@ -108,12 +107,12 @@ def configure(config, tmp_test_directory, request):
|
|
|
108
107
|
if isinstance(model_version_requested, list) and len(model_version_requested) == 1:
|
|
109
108
|
model_version_requested = model_version_requested[0]
|
|
110
109
|
|
|
111
|
-
if "
|
|
110
|
+
if "configuration" in config:
|
|
112
111
|
_skip_test_for_model_version(config, model_version_requested)
|
|
113
112
|
_skip_test_for_production_db(config)
|
|
114
113
|
|
|
115
114
|
config_file, config_string, config_file_model_version = _prepare_test_options(
|
|
116
|
-
config["
|
|
115
|
+
config["configuration"],
|
|
117
116
|
output_path=tmp_output_path,
|
|
118
117
|
model_version=model_version_requested,
|
|
119
118
|
)
|
|
@@ -123,7 +122,7 @@ def configure(config, tmp_test_directory, request):
|
|
|
123
122
|
config_file_model_version = None
|
|
124
123
|
|
|
125
124
|
cmd = get_application_command(
|
|
126
|
-
app=config.get("
|
|
125
|
+
app=config.get("application", None),
|
|
127
126
|
config_file=config_file,
|
|
128
127
|
config_string=config_string,
|
|
129
128
|
)
|
|
@@ -132,9 +131,9 @@ def configure(config, tmp_test_directory, request):
|
|
|
132
131
|
|
|
133
132
|
def _skip_test_for_model_version(config, model_version_requested):
|
|
134
133
|
"""Skip test if model version requested is not supported."""
|
|
135
|
-
if config.get("
|
|
134
|
+
if config.get("model_version_use_current") is None or model_version_requested is None:
|
|
136
135
|
return
|
|
137
|
-
model_version_config = config["
|
|
136
|
+
model_version_config = config["configuration"]["model_version"]
|
|
138
137
|
if model_version_requested != model_version_config:
|
|
139
138
|
raise VersionError(
|
|
140
139
|
f"Model version requested {model_version_requested} not supported for this test"
|
|
@@ -143,7 +142,7 @@ def _skip_test_for_model_version(config, model_version_requested):
|
|
|
143
142
|
|
|
144
143
|
def _skip_test_for_production_db(config):
|
|
145
144
|
"""Skip test if production db is used."""
|
|
146
|
-
if not config.get("
|
|
145
|
+
if not config.get("skip_for_production_db"):
|
|
147
146
|
return
|
|
148
147
|
|
|
149
148
|
if "db.zeuthen.desy.de" in os.getenv("SIMTOOLS_DB_SERVER", ""):
|
|
@@ -184,19 +183,18 @@ def _prepare_test_options(config, output_path, model_version=None):
|
|
|
184
183
|
return None, "--" + next(iter(config.keys())).lower(), None
|
|
185
184
|
|
|
186
185
|
tmp_config_file = output_path / "tmp_config.yml"
|
|
187
|
-
config_file_model_version = config.get("
|
|
188
|
-
if model_version and "
|
|
189
|
-
config.update({"
|
|
186
|
+
config_file_model_version = config.get("model_version")
|
|
187
|
+
if model_version and "model_version" in config:
|
|
188
|
+
config.update({"model_version": model_version})
|
|
190
189
|
|
|
191
|
-
for key in ["
|
|
190
|
+
for key in ["output_path", "data_directory", "pack_for_grid_register"]:
|
|
192
191
|
if key in config:
|
|
193
192
|
config[key] = str(Path(output_path).joinpath(config[key]))
|
|
194
|
-
if key == "
|
|
195
|
-
config["
|
|
193
|
+
if key == "output_path":
|
|
194
|
+
config["use_plain_output_path"] = True
|
|
196
195
|
|
|
197
196
|
_logger.info(f"Writing config file: {tmp_config_file}")
|
|
198
|
-
|
|
199
|
-
yaml.safe_dump(config, file, sort_keys=False)
|
|
197
|
+
ascii_handler.write_data_to_file(data=config, output_file=tmp_config_file, sort_keys=False)
|
|
200
198
|
|
|
201
199
|
return tmp_config_file, None, config_file_model_version
|
|
202
200
|
|
|
@@ -245,7 +243,7 @@ def create_tmp_output_path(tmp_test_directory, config):
|
|
|
245
243
|
"""
|
|
246
244
|
try:
|
|
247
245
|
tmp_output_path = Path(tmp_test_directory).joinpath(
|
|
248
|
-
config["
|
|
246
|
+
config["application"] + "-" + config["test_name"]
|
|
249
247
|
)
|
|
250
248
|
except KeyError as exc:
|
|
251
249
|
raise KeyError(f"No application defined in configuration {config}.") from exc
|
simtools/testing/helpers.py
CHANGED
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
def skip_camera_efficiency(config):
|
|
8
8
|
"""Skip camera efficiency tests if the old version of testeff is used."""
|
|
9
|
-
if "camera-efficiency" in config["
|
|
9
|
+
if "camera-efficiency" in config["application"] and not _new_testeff_version():
|
|
10
10
|
return (
|
|
11
11
|
"Any applications calling the old version of testeff are skipped "
|
|
12
12
|
"due to a limitation of the old testeff not allowing to specify "
|
|
@@ -42,7 +42,7 @@ def skip_multiple_version_test(config, model_version):
|
|
|
42
42
|
if not isinstance(model_version, list):
|
|
43
43
|
return None
|
|
44
44
|
|
|
45
|
-
config_model_version = config.get("
|
|
45
|
+
config_model_version = config.get("configuration", {}).get("model_version", [])
|
|
46
46
|
|
|
47
47
|
if not isinstance(config_model_version, list):
|
|
48
48
|
config_model_version = [config_model_version]
|