gammasimtools 0.18.0__py3-none-any.whl → 0.20.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.20.0.dist-info}/METADATA +24 -69
- gammasimtools-0.20.0.dist-info/RECORD +395 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/entry_points.txt +11 -4
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +16 -3
- simtools/applications/calculate_incident_angles.py +182 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +17 -14
- simtools/applications/db_add_value_from_json_to_db.py +8 -10
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
- simtools/applications/db_generate_compound_indexes.py +65 -0
- simtools/applications/db_get_file_from_db.py +12 -24
- 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/derive_trigger_rates.py +91 -0
- 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_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 +421 -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 +9 -5
- 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 +46 -11
- 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 +42 -12
- simtools/db/db_handler.py +125 -62
- simtools/db/db_model_upload.py +14 -19
- simtools/dependencies.py +98 -30
- 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 +51 -12
- simtools/model/array_model.py +41 -5
- simtools/model/flasher_model.py +106 -0
- simtools/model/model_parameter.py +4 -4
- simtools/model/model_repository.py +197 -2
- simtools/model/site_model.py +25 -0
- simtools/model/telescope_model.py +3 -1
- simtools/production_configuration/derive_corsika_limits.py +336 -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/incident_angles.py +706 -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 +4 -4
- 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 +2 -2
- 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 +23 -30
- 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 +2 -2
- 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 +7 -2
- simtools/simtel/simtel_config_reader.py +2 -2
- simtools/simtel/simtel_config_writer.py +33 -23
- simtools/simtel/simtel_io_event_histograms.py +483 -0
- simtools/simtel/simtel_io_event_reader.py +65 -43
- simtools/simtel/simtel_io_event_writer.py +40 -20
- simtools/simtel/simtel_io_metadata.py +1 -1
- simtools/simtel/simtel_table_reader.py +95 -13
- 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/telescope_trigger_rates.py +119 -0
- simtools/testing/configuration.py +24 -26
- simtools/testing/helpers.py +2 -2
- simtools/testing/log_inspector.py +52 -0
- simtools/testing/validate_output.py +87 -37
- simtools/utils/general.py +125 -255
- simtools/utils/geometry.py +56 -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_incident_angles.py +431 -0
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_simtel_event_histograms.py +376 -0
- simtools/visualization/plot_simtel_events.py +816 -0
- simtools/visualization/plot_tables.py +133 -37
- simtools/visualization/visualize.py +1 -100
- gammasimtools-0.18.0.dist-info/RECORD +0 -376
- simtools/applications/calculate_trigger_rate.py +0 -187
- simtools/applications/generate_sim_telarray_histograms.py +0 -196
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
- simtools/simtel/simtel_io_histogram.py +0 -621
- simtools/simtel/simtel_io_histograms.py +0 -552
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.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
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
r"""
|
|
4
|
-
Derive
|
|
5
|
-
|
|
6
|
-
This parameter, often referred to as "mirror roughness," is used to align the simulation
|
|
7
|
-
with the measured containment diameter of the optical point-spread function (PSF) for
|
|
8
|
-
individual mirror panels.
|
|
4
|
+
Derive mirror random reflection angle (mirror roughness) of a single mirror panel.
|
|
9
5
|
|
|
10
6
|
Description
|
|
11
7
|
-----------
|
|
12
8
|
|
|
13
9
|
This application derives the value of the simulation model parameter
|
|
14
10
|
*mirror_reflection_random_angle* using measurements of the focal length
|
|
15
|
-
and PSF of individual mirror panels.
|
|
11
|
+
and point-spread function (PSF) of individual mirror panels.
|
|
12
|
+
This parameter is sometimes referred to as the "mirror roughness".
|
|
16
13
|
|
|
17
14
|
PSF measurements are provided by one of the following options:
|
|
18
15
|
|
|
@@ -22,7 +19,7 @@ r"""
|
|
|
22
19
|
* file (table) with measured PSF for each mirror panel spot size (``--psf_measurement``)
|
|
23
20
|
|
|
24
21
|
The containment fraction used for the PSF diameter calculation is set through
|
|
25
|
-
the argument ``--containment_fraction`` (typically 0.8 = 80
|
|
22
|
+
the argument ``--containment_fraction`` (typically 0.8 = 80%; called below D80).
|
|
26
23
|
|
|
27
24
|
Mirror panels are simulated individually, using one of the following options to set the
|
|
28
25
|
mirror panel focal length:
|
|
@@ -37,7 +34,7 @@ r"""
|
|
|
37
34
|
taken from the Model Parameters DB (default) or can be set using the argument ``--rnda``.
|
|
38
35
|
|
|
39
36
|
Ray-tracing simulations are performed for single mirror configurations for each
|
|
40
|
-
mirror given in the
|
|
37
|
+
mirror given in the mirror list. The mean simulated containment diameter for all the mirrors
|
|
41
38
|
is compared with the mean measured containment diameter. The algorithm defines a new value for
|
|
42
39
|
the random reflection angle based on the sign of the difference between measured and simulated
|
|
43
40
|
containment diameters and a new set of simulations is performed. This process is repeated
|
|
@@ -67,7 +64,7 @@ r"""
|
|
|
67
64
|
Command line arguments
|
|
68
65
|
----------------------
|
|
69
66
|
telescope (str, required)
|
|
70
|
-
Telescope name (e.g.
|
|
67
|
+
Telescope name (e.g. LSTN-01, SSTS-25)
|
|
71
68
|
model_version (str, optional)
|
|
72
69
|
Model version
|
|
73
70
|
psf_measurement (str, optional)
|
|
@@ -89,6 +86,8 @@ r"""
|
|
|
89
86
|
random_focal_length (float, optional)
|
|
90
87
|
Value of the random focal lengths to replace the default random_focal_length. Only used if
|
|
91
88
|
'use_random_focal_length' is activated.
|
|
89
|
+
random_focal_length_seed (int, optional)
|
|
90
|
+
Seed for the random number generator used for focal length variation.
|
|
92
91
|
no_tuning (activation mode, optional)
|
|
93
92
|
Turn off the tuning - A single case will be simulated and plotted.
|
|
94
93
|
test (activation mode, optional)
|
|
@@ -96,8 +95,8 @@ r"""
|
|
|
96
95
|
|
|
97
96
|
Example
|
|
98
97
|
-------
|
|
99
|
-
Derive mirror random reflection angle for a
|
|
100
|
-
simulation production
|
|
98
|
+
Derive mirror random reflection angle for a large-sized telescope (LSTS),
|
|
99
|
+
simulation production 6.0.0
|
|
101
100
|
|
|
102
101
|
.. code-block:: console
|
|
103
102
|
|
|
@@ -200,6 +199,13 @@ def _parse(label):
|
|
|
200
199
|
type=float,
|
|
201
200
|
required=False,
|
|
202
201
|
)
|
|
202
|
+
config.parser.add_argument(
|
|
203
|
+
"--random_focal_length_seed",
|
|
204
|
+
help="Seed for the random number generator used for focal length variation.",
|
|
205
|
+
type=int,
|
|
206
|
+
required=False,
|
|
207
|
+
default=None,
|
|
208
|
+
)
|
|
203
209
|
config.parser.add_argument(
|
|
204
210
|
"--no_tuning",
|
|
205
211
|
help="no tuning of random_reflection_angle (a single case will be simulated).",
|
|
@@ -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__":
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
r"""
|
|
2
|
+
Derive cosmic-ray trigger rates for a single telescope or an array of telescopes.
|
|
3
|
+
|
|
4
|
+
Uses simulated background events (e.g. from proton primaries) to calculate the trigger rates.
|
|
5
|
+
Input is reduced event data generated from simulations for the given configuration.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Command line arguments
|
|
9
|
+
----------------------
|
|
10
|
+
event_data_file (str, required)
|
|
11
|
+
Event data file containing reduced event data.
|
|
12
|
+
array_layout_name (list, optional)
|
|
13
|
+
Name of the array layout to use for the simulation.
|
|
14
|
+
telescope_ids (str, optional)
|
|
15
|
+
Path to a file containing telescope configurations.
|
|
16
|
+
plot_histograms (bool, optional)
|
|
17
|
+
Plot histograms of the event data.
|
|
18
|
+
model_version (str, optional)
|
|
19
|
+
Version of the simulation model to use.
|
|
20
|
+
site (str, optional)
|
|
21
|
+
Name of the site where the simulation is being run.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Example
|
|
25
|
+
-------
|
|
26
|
+
|
|
27
|
+
Derive trigger rates for the South Alpha layout:
|
|
28
|
+
|
|
29
|
+
.. code-block:: console
|
|
30
|
+
|
|
31
|
+
simtools-derive-trigger-rates \\
|
|
32
|
+
--site South \\
|
|
33
|
+
--model_version 6.0.0 \\
|
|
34
|
+
--event_data_file /path/to/event_data_file.h5 \\
|
|
35
|
+
--array_layout_name alpha\\
|
|
36
|
+
--plot_histograms
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
import logging
|
|
41
|
+
|
|
42
|
+
import simtools.utils.general as gen
|
|
43
|
+
from simtools.configuration import configurator
|
|
44
|
+
from simtools.telescope_trigger_rates import telescope_trigger_rates
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _parse():
|
|
48
|
+
"""Parse command line configuration."""
|
|
49
|
+
config = configurator.Configurator(
|
|
50
|
+
description="Derive trigger rates for a single telescope or an array of telescopes.",
|
|
51
|
+
)
|
|
52
|
+
config.parser.add_argument(
|
|
53
|
+
"--event_data_file",
|
|
54
|
+
type=str,
|
|
55
|
+
required=True,
|
|
56
|
+
help="Event data file containing reduced event data.",
|
|
57
|
+
)
|
|
58
|
+
config.parser.add_argument(
|
|
59
|
+
"--telescope_ids",
|
|
60
|
+
type=str,
|
|
61
|
+
required=False,
|
|
62
|
+
help="Path to a file containing telescope configurations.",
|
|
63
|
+
)
|
|
64
|
+
config.parser.add_argument(
|
|
65
|
+
"--plot_histograms",
|
|
66
|
+
help="Plot histograms of the event data.",
|
|
67
|
+
action="store_true",
|
|
68
|
+
default=False,
|
|
69
|
+
)
|
|
70
|
+
return config.initialize(
|
|
71
|
+
db_config=True,
|
|
72
|
+
output=True,
|
|
73
|
+
simulation_model=[
|
|
74
|
+
"site",
|
|
75
|
+
"model_version",
|
|
76
|
+
"layout",
|
|
77
|
+
],
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def main(): # noqa: D103
|
|
82
|
+
args_dict, db_config = _parse()
|
|
83
|
+
|
|
84
|
+
logger = logging.getLogger()
|
|
85
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "info")))
|
|
86
|
+
|
|
87
|
+
telescope_trigger_rates(args_dict, db_config)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
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
|
|