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
|
@@ -17,6 +17,16 @@ r"""
|
|
|
17
17
|
the Root Mean Squared Deviation between data and simulations. The range in which the \
|
|
18
18
|
parameter are drawn uniformly are defined based on the previous value on the telescope model.
|
|
19
19
|
|
|
20
|
+
The optimization workflow includes:
|
|
21
|
+
|
|
22
|
+
* Loading and preprocessing PSF data from measurement files
|
|
23
|
+
* Generating random parameter combinations for optimization
|
|
24
|
+
* Running ray-tracing simulations for each parameter set
|
|
25
|
+
* Calculating RMSD between measured and simulated PSF curves
|
|
26
|
+
* Identifying the best-fit parameters with minimum RMSD
|
|
27
|
+
* Creating comprehensive plots and D80 vs off-axis angle analysis
|
|
28
|
+
* Optionally exporting optimized parameters as simulation model files
|
|
29
|
+
|
|
20
30
|
The assumption are:
|
|
21
31
|
|
|
22
32
|
a) mirror_align_random_horizontal and mirror_align_random_vertical are the same.
|
|
@@ -37,6 +47,8 @@ r"""
|
|
|
37
47
|
Telescope model name (e.g. LST-1, SST-D, ...).
|
|
38
48
|
model_version (str, optional)
|
|
39
49
|
Model version.
|
|
50
|
+
parameter_version (str, optional)
|
|
51
|
+
Parameter version for model parameter file export.
|
|
40
52
|
src_distance (float, optional)
|
|
41
53
|
Source distance in km.
|
|
42
54
|
zenith (float, optional)
|
|
@@ -49,6 +61,12 @@ r"""
|
|
|
49
61
|
Keep the first entry of mirror_reflection_random_angle fixed.
|
|
50
62
|
test (activation mode, optional)
|
|
51
63
|
If activated, application will be faster by simulating fewer photons.
|
|
64
|
+
write_psf_parameters (activation mode, optional)
|
|
65
|
+
Write the optimized PSF parameters as simulation model parameter files.
|
|
66
|
+
random_seed (int, optional)
|
|
67
|
+
Random seed for parameter generation.
|
|
68
|
+
n_runs (int, optional)
|
|
69
|
+
Number of parameter combinations to test.
|
|
52
70
|
|
|
53
71
|
Example
|
|
54
72
|
-------
|
|
@@ -67,58 +85,36 @@ r"""
|
|
|
67
85
|
.. code-block:: console
|
|
68
86
|
|
|
69
87
|
simtools-derive-psf-parameters --site North --telescope LSTN-01 \\
|
|
70
|
-
--model_version 6.0.0 --data PSFcurve_data_v2.txt --plot_all --test
|
|
88
|
+
--model_version 6.0.0 --data tests/resources/PSFcurve_data_v2.txt --plot_all --test
|
|
71
89
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Expected final print-out message:
|
|
90
|
+
Run with parameter export:
|
|
75
91
|
|
|
76
92
|
.. code-block:: console
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
simtools-derive-psf-parameters --site North --telescope LSTN-01 \\
|
|
95
|
+
--model_version 6.0.0 \\
|
|
96
|
+
--data tests/resources/PSFcurve_data_v2.txt --write_psf_parameters
|
|
97
|
+
|
|
98
|
+
The output is saved in simtools-output/tune_psf.
|
|
99
|
+
|
|
100
|
+
Output files include:
|
|
101
|
+
|
|
102
|
+
* Parameter optimization results in tested_psf_parameters.txt
|
|
103
|
+
* PSF comparison plots in tune_psf_[telescope].pdf
|
|
104
|
+
* D80 vs off-axis angle plots (d80_vs_offaxis_cm.png, d80_vs_offaxis_deg.png)
|
|
105
|
+
* Optimized simulation model parameter files (if --write_psf_parameters is specified)
|
|
106
|
+
* Cumulative PSF plots for all tested combinations (if --plot_all is specified)
|
|
82
107
|
|
|
83
108
|
"""
|
|
84
109
|
|
|
85
110
|
import logging
|
|
86
|
-
from
|
|
87
|
-
|
|
88
|
-
import astropy.units as u
|
|
89
|
-
import matplotlib.pyplot as plt
|
|
90
|
-
import numpy as np
|
|
91
|
-
from matplotlib.backends.backend_pdf import PdfPages
|
|
111
|
+
from pathlib import Path
|
|
92
112
|
|
|
93
|
-
import simtools.utils.general as gen
|
|
94
113
|
from simtools.configuration import configurator
|
|
95
|
-
from simtools.
|
|
114
|
+
from simtools.io import io_handler
|
|
96
115
|
from simtools.model.model_utils import initialize_simulation_models
|
|
97
|
-
from simtools.ray_tracing
|
|
98
|
-
from simtools.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def load_data(data_file):
|
|
102
|
-
"""
|
|
103
|
-
Load data from a text file containing cumulative PSF measurements.
|
|
104
|
-
|
|
105
|
-
Parameters
|
|
106
|
-
----------
|
|
107
|
-
data_file : str
|
|
108
|
-
Name of the data file with the measured cumulative PSF.
|
|
109
|
-
|
|
110
|
-
Returns
|
|
111
|
-
-------
|
|
112
|
-
numpy.ndarray
|
|
113
|
-
Loaded and processed data from the file.
|
|
114
|
-
"""
|
|
115
|
-
radius_cm = "Radius [cm]"
|
|
116
|
-
cumulative_psf = "Cumulative PSF"
|
|
117
|
-
d_type = {"names": (radius_cm, cumulative_psf), "formats": ("f8", "f8")}
|
|
118
|
-
data = np.loadtxt(data_file, dtype=d_type, usecols=(0, 2))
|
|
119
|
-
data[radius_cm] *= 0.1
|
|
120
|
-
data[cumulative_psf] /= np.max(np.abs(data[cumulative_psf]))
|
|
121
|
-
return data
|
|
116
|
+
from simtools.ray_tracing import psf_parameter_optimisation as psf_opt
|
|
117
|
+
from simtools.utils.general import get_log_level_from_user
|
|
122
118
|
|
|
123
119
|
|
|
124
120
|
def _parse():
|
|
@@ -151,256 +147,37 @@ def _parse():
|
|
|
151
147
|
help=("Keep the first entry of mirror_reflection_random_angle fixed."),
|
|
152
148
|
action="store_true",
|
|
153
149
|
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
mirror_reflection,
|
|
160
|
-
mirror_align,
|
|
161
|
-
mirror_reflection_fraction=0.15,
|
|
162
|
-
mirror_reflection_2=0.035,
|
|
163
|
-
):
|
|
164
|
-
"""
|
|
165
|
-
Transform and add parameters to the all_parameters list.
|
|
166
|
-
|
|
167
|
-
Parameters
|
|
168
|
-
----------
|
|
169
|
-
mirror_reflection : float
|
|
170
|
-
The random angle of mirror reflection.
|
|
171
|
-
|
|
172
|
-
mirror_align : float
|
|
173
|
-
The random angle for mirror alignment (both horizontal and vertical).
|
|
174
|
-
|
|
175
|
-
mirror_reflection_fraction : float, optional
|
|
176
|
-
The fraction of the mirror reflection. Default is 0.15.
|
|
177
|
-
|
|
178
|
-
mirror_reflection_2 : float, optional
|
|
179
|
-
A secondary random angle for mirror reflection. Default is 0.035.
|
|
180
|
-
|
|
181
|
-
Returns
|
|
182
|
-
-------
|
|
183
|
-
None
|
|
184
|
-
Updates the all_parameters list in place.
|
|
185
|
-
"""
|
|
186
|
-
# If we want to start from values different than the ones currently in the model:
|
|
187
|
-
# align = 0.0046
|
|
188
|
-
# pars_to_change = {
|
|
189
|
-
# 'mirror_reflection_random_angle': '0.0075 0.125 0.0037',
|
|
190
|
-
# 'mirror_align_random_horizontal': f'{align} 28 0 0',
|
|
191
|
-
# 'mirror_align_random_vertical': f'{align} 28 0 0',
|
|
192
|
-
# }
|
|
193
|
-
# tel_model.change_multiple_parameters(**pars_to_change)
|
|
194
|
-
pars = {
|
|
195
|
-
"mirror_reflection_random_angle": [
|
|
196
|
-
mirror_reflection,
|
|
197
|
-
mirror_reflection_fraction,
|
|
198
|
-
mirror_reflection_2,
|
|
199
|
-
],
|
|
200
|
-
"mirror_align_random_horizontal": [mirror_align, 28.0, 0.0, 0.0],
|
|
201
|
-
"mirror_align_random_vertical": [mirror_align, 28.0, 0.0, 0.0],
|
|
202
|
-
}
|
|
203
|
-
all_parameters.append(pars)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def get_previous_values(tel_model, logger):
|
|
207
|
-
"""
|
|
208
|
-
Retrieve previous parameter values from the telescope model.
|
|
209
|
-
|
|
210
|
-
Parameters
|
|
211
|
-
----------
|
|
212
|
-
tel_model : TelescopeModel
|
|
213
|
-
Telescope model object.
|
|
214
|
-
logger : logging.Logger
|
|
215
|
-
Logger object for logging messages.
|
|
216
|
-
|
|
217
|
-
Returns
|
|
218
|
-
-------
|
|
219
|
-
tuple
|
|
220
|
-
Tuple containing the previous values of mirror_reflection_random_angle (first entry),
|
|
221
|
-
mirror_reflection_fraction, second entry), mirror_reflection_random_angle (third entry),
|
|
222
|
-
and mirror_align_random_horizontal/vertical.
|
|
223
|
-
"""
|
|
224
|
-
split_par = tel_model.get_parameter_value("mirror_reflection_random_angle")
|
|
225
|
-
mrra_0, mfr_0, mrra2_0 = split_par[0], split_par[1], split_par[2]
|
|
226
|
-
mar_0 = tel_model.get_parameter_value("mirror_align_random_horizontal")[0]
|
|
227
|
-
|
|
228
|
-
logger.debug(
|
|
229
|
-
"Previous parameter values:\n"
|
|
230
|
-
f"MRRA = {mrra_0!s}\n"
|
|
231
|
-
f"MRF = {mfr_0!s}\n"
|
|
232
|
-
f"MRRA2 = {mrra2_0!s}\n"
|
|
233
|
-
f"MAR = {mar_0!s}\n"
|
|
150
|
+
config.parser.add_argument(
|
|
151
|
+
"--write_psf_parameters",
|
|
152
|
+
help=("Write the optimized PSF parameters as simulation model parameter files"),
|
|
153
|
+
action="store_true",
|
|
154
|
+
required=False,
|
|
234
155
|
)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
all_parameters, n_runs, args_dict, mrra_0, mfr_0, mrra2_0, mar_0, logger
|
|
241
|
-
):
|
|
242
|
-
"""
|
|
243
|
-
Generate random parameters for tuning.
|
|
244
|
-
|
|
245
|
-
Parameters
|
|
246
|
-
----------
|
|
247
|
-
all_parameters : list
|
|
248
|
-
List to store all parameter sets.
|
|
249
|
-
n_runs : int
|
|
250
|
-
Number of random parameter combinations to test.
|
|
251
|
-
args_dict : dict
|
|
252
|
-
Dictionary containing parsed command-line arguments.
|
|
253
|
-
mrra_0 : float
|
|
254
|
-
Initial value of mirror_reflection_random_angle.
|
|
255
|
-
mfr_0 : float
|
|
256
|
-
Initial value of mirror_reflection_fraction.
|
|
257
|
-
mrra2_0 : float
|
|
258
|
-
Initial value of the second mirror_reflection_random_angle.
|
|
259
|
-
mar_0 : float
|
|
260
|
-
Initial value of mirror_align_random_horizontal/vertical.
|
|
261
|
-
logger : logging.Logger
|
|
262
|
-
Logger object for logging messages.
|
|
263
|
-
"""
|
|
264
|
-
# Range around the previous values are hardcoded
|
|
265
|
-
# Number of runs is hardcoded
|
|
266
|
-
if args_dict["fixed"]:
|
|
267
|
-
logger.debug("fixed=True - First entry of mirror_reflection_random_angle is kept fixed.")
|
|
268
|
-
|
|
269
|
-
for _ in range(n_runs):
|
|
270
|
-
mrra_range = 0.004 if not args_dict["fixed"] else 0
|
|
271
|
-
mrf_range = 0.1
|
|
272
|
-
mrra2_range = 0.03
|
|
273
|
-
mar_range = 0.005
|
|
274
|
-
rng = np.random.default_rng()
|
|
275
|
-
mrra = rng.uniform(max(mrra_0 - mrra_range, 0), mrra_0 + mrra_range)
|
|
276
|
-
mrf = rng.uniform(max(mfr_0 - mrf_range, 0), mfr_0 + mrf_range)
|
|
277
|
-
mrra2 = rng.uniform(max(mrra2_0 - mrra2_range, 0), mrra2_0 + mrra2_range)
|
|
278
|
-
mar = rng.uniform(max(mar_0 - mar_range, 0), mar_0 + mar_range)
|
|
279
|
-
add_parameters(all_parameters, mrra, mar, mrf, mrra2)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
def load_and_process_data(args_dict):
|
|
283
|
-
"""
|
|
284
|
-
Load and process data if specified in the command-line arguments.
|
|
285
|
-
|
|
286
|
-
Returns
|
|
287
|
-
-------
|
|
288
|
-
- data_to_plot: OrderedDict containing loaded and processed data.
|
|
289
|
-
- radius: Radius data from loaded data (if available).
|
|
290
|
-
"""
|
|
291
|
-
data_to_plot = OrderedDict()
|
|
292
|
-
radius = None
|
|
293
|
-
|
|
294
|
-
if args_dict["data"] is not None:
|
|
295
|
-
data_file = gen.find_file(args_dict["data"], args_dict["model_path"])
|
|
296
|
-
data_to_plot["measured"] = load_data(data_file)
|
|
297
|
-
radius = data_to_plot["measured"]["Radius [cm]"]
|
|
298
|
-
|
|
299
|
-
return data_to_plot, radius
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
def calculate_rmsd(data, sim):
|
|
303
|
-
"""Calculate Root Mean Squared Deviation to be used as metric to find the best parameters."""
|
|
304
|
-
return np.sqrt(np.mean((data - sim) ** 2))
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
def run_pars(tel_model, site_model, args_dict, pars, data_to_plot, radius, pdf_pages):
|
|
308
|
-
"""
|
|
309
|
-
Run the tuning for one set of parameters, add a plot to the pdfPages and return RMSD and D80.
|
|
310
|
-
|
|
311
|
-
Plotting is optional (if plot=True).
|
|
312
|
-
"""
|
|
313
|
-
cumulative_psf = "Cumulative PSF"
|
|
314
|
-
|
|
315
|
-
if pars is not None:
|
|
316
|
-
tel_model.change_multiple_parameters(**pars)
|
|
317
|
-
else:
|
|
318
|
-
raise ValueError("No best parameters found")
|
|
319
|
-
|
|
320
|
-
ray = RayTracing(
|
|
321
|
-
telescope_model=tel_model,
|
|
322
|
-
site_model=site_model,
|
|
323
|
-
simtel_path=args_dict["simtel_path"],
|
|
324
|
-
zenith_angle=args_dict["zenith"] * u.deg,
|
|
325
|
-
source_distance=args_dict["src_distance"] * u.km,
|
|
326
|
-
off_axis_angle=[0.0] * u.deg,
|
|
156
|
+
config.parser.add_argument(
|
|
157
|
+
"--random_seed",
|
|
158
|
+
help="Random seed for parameter generation.",
|
|
159
|
+
type=int,
|
|
160
|
+
default=None,
|
|
327
161
|
)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
# Simulated cumulative PSF
|
|
338
|
-
data_to_plot["simulated"] = im.get_cumulative_data(radius * u.cm)
|
|
339
|
-
else:
|
|
340
|
-
raise ValueError("Radius data is not available.")
|
|
341
|
-
|
|
342
|
-
rmsd = calculate_rmsd(
|
|
343
|
-
data_to_plot["measured"][cumulative_psf], data_to_plot["simulated"][cumulative_psf]
|
|
162
|
+
config.parser.add_argument(
|
|
163
|
+
"--n_runs",
|
|
164
|
+
help="Number of parameter combinations to test.",
|
|
165
|
+
type=int,
|
|
166
|
+
default=5,
|
|
167
|
+
)
|
|
168
|
+
return config.initialize(
|
|
169
|
+
db_config=True,
|
|
170
|
+
simulation_model=["telescope", "model_version", "parameter_version"],
|
|
344
171
|
)
|
|
345
|
-
|
|
346
|
-
if args_dict["plot_all"]:
|
|
347
|
-
fig = visualize.plot_1d(
|
|
348
|
-
data_to_plot,
|
|
349
|
-
plot_difference=True,
|
|
350
|
-
no_markers=True,
|
|
351
|
-
)
|
|
352
|
-
ax = fig.get_axes()[0]
|
|
353
|
-
ax.set_ylim(0, 1.05)
|
|
354
|
-
ax.set_title(
|
|
355
|
-
f"refl_rnd={pars['mirror_reflection_random_angle']}, "
|
|
356
|
-
f"align_rnd={pars['mirror_align_random_vertical']}"
|
|
357
|
-
)
|
|
358
|
-
|
|
359
|
-
ax.text(
|
|
360
|
-
0.8,
|
|
361
|
-
0.3,
|
|
362
|
-
f"D80 = {d80:.3f} cm\nRMSD = {rmsd:.4f}",
|
|
363
|
-
verticalalignment="center",
|
|
364
|
-
horizontalalignment="center",
|
|
365
|
-
transform=ax.transAxes,
|
|
366
|
-
)
|
|
367
|
-
plt.tight_layout()
|
|
368
|
-
pdf_pages.savefig(fig)
|
|
369
|
-
plt.clf()
|
|
370
|
-
|
|
371
|
-
return d80, rmsd
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
def find_best_parameters(
|
|
375
|
-
all_parameters, tel_model, site_model, args_dict, data_to_plot, radius, pdf_pages
|
|
376
|
-
):
|
|
377
|
-
"""
|
|
378
|
-
Find the best parameters from all parameter sets.
|
|
379
|
-
|
|
380
|
-
Returns
|
|
381
|
-
-------
|
|
382
|
-
- Tuple of best parameters and their D80 value.
|
|
383
|
-
"""
|
|
384
|
-
min_rmsd = 100
|
|
385
|
-
best_pars = None
|
|
386
|
-
|
|
387
|
-
for pars in all_parameters:
|
|
388
|
-
_, rmsd = run_pars(tel_model, site_model, args_dict, pars, data_to_plot, radius, pdf_pages)
|
|
389
|
-
if rmsd < min_rmsd:
|
|
390
|
-
min_rmsd = rmsd
|
|
391
|
-
best_pars = pars
|
|
392
|
-
|
|
393
|
-
return best_pars, min_rmsd
|
|
394
172
|
|
|
395
173
|
|
|
396
174
|
def main(): # noqa: D103
|
|
397
175
|
args_dict, db_config = _parse()
|
|
398
176
|
|
|
399
|
-
label =
|
|
177
|
+
label = label = Path(__file__).stem
|
|
400
178
|
logger = logging.getLogger()
|
|
401
|
-
logger.setLevel(
|
|
179
|
+
logger.setLevel(get_log_level_from_user(args_dict["log_level"]))
|
|
402
180
|
|
|
403
|
-
# Output directory to save files related directly to this app
|
|
404
181
|
_io_handler = io_handler.IOHandler()
|
|
405
182
|
output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
|
|
406
183
|
tel_model, site_model = initialize_simulation_models(
|
|
@@ -411,34 +188,7 @@ def main(): # noqa: D103
|
|
|
411
188
|
model_version=args_dict["model_version"],
|
|
412
189
|
)
|
|
413
190
|
|
|
414
|
-
|
|
415
|
-
mrra_0, mfr_0, mrra2_0, mar_0 = get_previous_values(tel_model, logger)
|
|
416
|
-
|
|
417
|
-
n_runs = 5 if args_dict["test"] else 50
|
|
418
|
-
generate_random_parameters(
|
|
419
|
-
all_parameters, n_runs, args_dict, mrra_0, mfr_0, mrra2_0, mar_0, logger
|
|
420
|
-
)
|
|
421
|
-
|
|
422
|
-
data_to_plot, radius = load_and_process_data(args_dict)
|
|
423
|
-
|
|
424
|
-
# Preparing figure name
|
|
425
|
-
plot_file_name = "_".join((label, tel_model.name + ".pdf"))
|
|
426
|
-
plot_file = output_dir.joinpath(plot_file_name)
|
|
427
|
-
pdf_pages = PdfPages(plot_file)
|
|
428
|
-
|
|
429
|
-
best_pars, _ = find_best_parameters(
|
|
430
|
-
all_parameters, tel_model, site_model, args_dict, data_to_plot, radius, pdf_pages
|
|
431
|
-
)
|
|
432
|
-
|
|
433
|
-
# Rerunning and plotting the best pars
|
|
434
|
-
run_pars(tel_model, site_model, args_dict, best_pars, data_to_plot, radius, pdf_pages)
|
|
435
|
-
plt.close()
|
|
436
|
-
pdf_pages.close()
|
|
437
|
-
|
|
438
|
-
# Printing the results
|
|
439
|
-
print("Best parameters:")
|
|
440
|
-
for par, value in best_pars.items():
|
|
441
|
-
print(f"{par} = {value}")
|
|
191
|
+
psf_opt.run_psf_optimization_workflow(tel_model, site_model, args_dict, output_dir)
|
|
442
192
|
|
|
443
193
|
|
|
444
194
|
if __name__ == "__main__":
|
|
@@ -11,7 +11,7 @@ import logging
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
|
|
13
13
|
from simtools.configuration import configurator
|
|
14
|
-
from simtools.
|
|
14
|
+
from simtools.io import io_handler
|
|
15
15
|
from simtools.reporting.docs_auto_report_generator import ReportGenerator
|
|
16
16
|
from simtools.reporting.docs_read_parameters import ReadParameters
|
|
17
17
|
from simtools.utils import general as gen
|
|
@@ -5,7 +5,7 @@ r"""Produces a markdown file for calibration reports."""
|
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
7
|
from simtools.configuration import configurator
|
|
8
|
-
from simtools.
|
|
8
|
+
from simtools.io import io_handler
|
|
9
9
|
from simtools.reporting.docs_read_parameters import ReadParameters
|
|
10
10
|
from simtools.utils import general as gen
|
|
11
11
|
|
|
@@ -11,7 +11,7 @@ Currently only implemented for telescopes.
|
|
|
11
11
|
import logging
|
|
12
12
|
|
|
13
13
|
from simtools.configuration import configurator
|
|
14
|
-
from simtools.
|
|
14
|
+
from simtools.io import io_handler
|
|
15
15
|
from simtools.reporting.docs_auto_report_generator import ReportGenerator
|
|
16
16
|
from simtools.reporting.docs_read_parameters import ReadParameters
|
|
17
17
|
from simtools.utils import general as gen
|
|
@@ -5,7 +5,7 @@ r"""Produces a markdown file for a given simulation configuration."""
|
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
7
|
from simtools.configuration import configurator
|
|
8
|
-
from simtools.
|
|
8
|
+
from simtools.io import io_handler
|
|
9
9
|
from simtools.reporting.docs_read_parameters import ReadParameters
|
|
10
10
|
from simtools.utils import general as gen
|
|
11
11
|
|
|
@@ -175,7 +175,7 @@ import simtools.utils.general as gen
|
|
|
175
175
|
from simtools.configuration import configurator
|
|
176
176
|
from simtools.corsika import corsika_histograms_visualize
|
|
177
177
|
from simtools.corsika.corsika_histograms import CorsikaHistograms
|
|
178
|
-
from simtools.
|
|
178
|
+
from simtools.io import io_handler
|
|
179
179
|
|
|
180
180
|
logger = logging.getLogger()
|
|
181
181
|
|
|
@@ -21,16 +21,13 @@ r"""
|
|
|
21
21
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
-
import json
|
|
25
24
|
import logging
|
|
26
25
|
from pathlib import Path
|
|
27
26
|
|
|
28
|
-
import yaml
|
|
29
|
-
|
|
30
27
|
import simtools.utils.general as gen
|
|
31
28
|
from simtools.configuration import configurator
|
|
32
29
|
from simtools.data_model import metadata_model
|
|
33
|
-
from simtools.
|
|
30
|
+
from simtools.io import ascii_handler, io_handler
|
|
34
31
|
|
|
35
32
|
|
|
36
33
|
def _parse(label, description):
|
|
@@ -74,8 +71,8 @@ def main(): # noqa: D103
|
|
|
74
71
|
label, description="Generate a default simtools metadata file from a json schema."
|
|
75
72
|
)
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
logger = logging.getLogger()
|
|
75
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
79
76
|
|
|
80
77
|
default_values = metadata_model.get_default_metadata_dict(args_dict["schema"])
|
|
81
78
|
|
|
@@ -83,24 +80,11 @@ def main(): # noqa: D103
|
|
|
83
80
|
print(default_values)
|
|
84
81
|
else:
|
|
85
82
|
_io_handler = io_handler.IOHandler()
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
default_values,
|
|
92
|
-
file,
|
|
93
|
-
default_flow_style=False,
|
|
94
|
-
sort_keys=False,
|
|
95
|
-
)
|
|
96
|
-
if args_dict["output_file"].endswith(".json"):
|
|
97
|
-
with open(_out_file, "w", encoding="utf-8") as file:
|
|
98
|
-
json.dump(
|
|
99
|
-
default_values,
|
|
100
|
-
file,
|
|
101
|
-
indent=4,
|
|
102
|
-
sort_keys=False,
|
|
103
|
-
)
|
|
83
|
+
output_file = _io_handler.get_output_file(args_dict["output_file"])
|
|
84
|
+
logger.info(f"Writing default values to {output_file}")
|
|
85
|
+
ascii_handler.write_data_to_file(
|
|
86
|
+
data=default_values, output_file=output_file, sort_keys=False
|
|
87
|
+
)
|
|
104
88
|
|
|
105
89
|
|
|
106
90
|
if __name__ == "__main__":
|
|
@@ -53,7 +53,7 @@ from matplotlib.backends.backend_pdf import PdfPages
|
|
|
53
53
|
|
|
54
54
|
import simtools.utils.general as gen
|
|
55
55
|
from simtools.configuration import configurator
|
|
56
|
-
from simtools.
|
|
56
|
+
from simtools.io import io_handler
|
|
57
57
|
from simtools.simtel.simtel_io_histograms import SimtelIOHistograms
|
|
58
58
|
|
|
59
59
|
|
|
@@ -24,19 +24,19 @@ The output consists of an HDF5 or FITS file containing the following tables:
|
|
|
24
24
|
+-------------------+---------+-----------------------------------------------+
|
|
25
25
|
| energy_max | float32 | Maximum simulated energy (TeV) |
|
|
26
26
|
+-------------------+---------+-----------------------------------------------+
|
|
27
|
-
| viewcone_min | float32 | Min viewcone angle (
|
|
27
|
+
| viewcone_min | float32 | Min viewcone angle (deg) |
|
|
28
28
|
+-------------------+---------+-----------------------------------------------+
|
|
29
|
-
| viewcone_max | float32 | Max viewcone angle (
|
|
29
|
+
| viewcone_max | float32 | Max viewcone angle (deg) |
|
|
30
30
|
+-------------------+---------+-----------------------------------------------+
|
|
31
31
|
| core_scatter_min | float32 | Min core scatter radius (m) |
|
|
32
32
|
+-------------------+---------+-----------------------------------------------+
|
|
33
33
|
| core_scatter_max | float32 | Max core scatter radius (m) |
|
|
34
34
|
+-------------------+---------+-----------------------------------------------+
|
|
35
|
-
| zenith | float32 | Zenith angle (
|
|
35
|
+
| zenith | float32 | Zenith angle (deg) |
|
|
36
36
|
+-------------------+---------+-----------------------------------------------+
|
|
37
|
-
| azimuth | float32 | Azimuth angle (
|
|
37
|
+
| azimuth | float32 | Azimuth angle (deg) |
|
|
38
38
|
+-------------------+---------+-----------------------------------------------+
|
|
39
|
-
| nsb_level | float64 | Night sky background level (
|
|
39
|
+
| nsb_level | float64 | Night sky background level (factor to dark) |
|
|
40
40
|
+-------------------+---------+-----------------------------------------------+
|
|
41
41
|
|
|
42
42
|
**SHOWERS**
|
|
@@ -56,9 +56,9 @@ The output consists of an HDF5 or FITS file containing the following tables:
|
|
|
56
56
|
+------------------+---------+-----------------------------------------------+
|
|
57
57
|
| y_core | float64 | Shower core Y position on ground (m) |
|
|
58
58
|
+------------------+---------+-----------------------------------------------+
|
|
59
|
-
| shower_azimuth | float64 | Direction of shower azimuth (
|
|
59
|
+
| shower_azimuth | float64 | Direction of shower azimuth (deg) |
|
|
60
60
|
+------------------+---------+-----------------------------------------------+
|
|
61
|
-
| shower_altitude | float64 | Direction of shower altitude (
|
|
61
|
+
| shower_altitude | float64 | Direction of shower altitude (deg) |
|
|
62
62
|
+------------------+---------+-----------------------------------------------+
|
|
63
63
|
| area_weight | float64 | Weighting factor for sampling area |
|
|
64
64
|
+------------------+---------+-----------------------------------------------+
|
|
@@ -74,9 +74,9 @@ The output consists of an HDF5 or FITS file containing the following tables:
|
|
|
74
74
|
+-----------------+---------+-----------------------------------------------+
|
|
75
75
|
| file_id | int64 | Internal unique identifier for the file |
|
|
76
76
|
+-----------------+---------+-----------------------------------------------+
|
|
77
|
-
| array_altitude | float64 | Altitude of array pointing direction (
|
|
77
|
+
| array_altitude | float64 | Altitude of array pointing direction (deg) |
|
|
78
78
|
+-----------------+---------+-----------------------------------------------+
|
|
79
|
-
| array_azimuth | float64 | Azimuth of array pointing direction (
|
|
79
|
+
| array_azimuth | float64 | Azimuth of array pointing direction (deg) |
|
|
80
80
|
+-----------------+---------+-----------------------------------------------+
|
|
81
81
|
| telescope_list | string | Comma-separated list of triggered telescopes |
|
|
82
82
|
+-----------------+---------+-----------------------------------------------+
|
|
@@ -130,7 +130,7 @@ from pathlib import Path
|
|
|
130
130
|
import simtools.utils.general as gen
|
|
131
131
|
from simtools.configuration import configurator
|
|
132
132
|
from simtools.data_model.metadata_collector import MetadataCollector
|
|
133
|
-
from simtools.
|
|
133
|
+
from simtools.io import io_handler, table_handler
|
|
134
134
|
from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
|
|
135
135
|
|
|
136
136
|
|
|
@@ -187,7 +187,7 @@ def main(): # noqa: D103
|
|
|
187
187
|
output_filepath = io_handler.IOHandler().get_output_file(args_dict["output_file"])
|
|
188
188
|
generator = SimtelIOEventDataWriter(files, args_dict["max_files"])
|
|
189
189
|
tables = generator.process_files()
|
|
190
|
-
|
|
190
|
+
table_handler.write_tables(tables, output_filepath, overwrite_existing=True)
|
|
191
191
|
MetadataCollector.dump(args_dict=args_dict, output_file=output_filepath.with_suffix(".yml"))
|
|
192
192
|
|
|
193
193
|
if args_dict["print_dataset_information"] > 0:
|