gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__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.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Calculates array or single-telescope trigger rates.
|
|
5
|
+
|
|
6
|
+
The applications reads from a simtel_array output file, a list of
|
|
7
|
+
simtel_array output files ou from a file containing a list of simtel_array files.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Command line arguments
|
|
11
|
+
----------------------
|
|
12
|
+
simtel_file_names (str or list):
|
|
13
|
+
Path to the simtel_array file or a list of simtel_array output files.
|
|
14
|
+
Files can be generated in `simulate_prod` using the ``--save_file_lists`` option.
|
|
15
|
+
save_tables (bool):
|
|
16
|
+
If true, save the tables with the energy-dependent trigger rate to a ecsv file.
|
|
17
|
+
area_from_distribution (bool):
|
|
18
|
+
If true, the area thrown (the area in which the simulated events are distributed)
|
|
19
|
+
in the trigger rate calculation is estimated based on the event distribution.
|
|
20
|
+
The expected shape of the distribution of events as function of the core distance is triangular
|
|
21
|
+
up to the maximum distance. The weighted mean radius of the triangular distribution is 2/3 times
|
|
22
|
+
the upper edge. Therefore, when using the ``area_from_distribution`` flag, the mean distance
|
|
23
|
+
times 3/2, returns just the position of the upper edge in the triangle distribution with little
|
|
24
|
+
impact of the binning and little dependence on the scatter area defined in the simulation.
|
|
25
|
+
This is special useful when calculating trigger rate for individual telescopes.
|
|
26
|
+
If false, the area thrown is estimated based on the maximum distance as given in
|
|
27
|
+
the simulation configuration.
|
|
28
|
+
|
|
29
|
+
Example
|
|
30
|
+
-------
|
|
31
|
+
Calculate trigger rate from simtel_array file
|
|
32
|
+
|
|
33
|
+
.. code-block:: console
|
|
34
|
+
|
|
35
|
+
simtools-calculate-trigger-rate --simtel_file_names tests/resources/ \\
|
|
36
|
+
run201_proton_za20deg_azm0deg_North_test_layout_test-prod.simtel.zst
|
|
37
|
+
|
|
38
|
+
Expected final print-out message:
|
|
39
|
+
|
|
40
|
+
.. code-block:: console
|
|
41
|
+
|
|
42
|
+
System trigger rate (Hz): 9.0064e+03 pm 9.0087e+03 Hz
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
import logging
|
|
47
|
+
from pathlib import Path
|
|
48
|
+
|
|
49
|
+
import simtools.utils.general as gen
|
|
50
|
+
from simtools.configuration import configurator
|
|
51
|
+
from simtools.io_operations import io_handler
|
|
52
|
+
from simtools.simtel.simtel_io_histograms import SimtelIOHistograms
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _parse(label, description):
|
|
56
|
+
"""
|
|
57
|
+
Parse command line configuration.
|
|
58
|
+
|
|
59
|
+
Parameters
|
|
60
|
+
----------
|
|
61
|
+
label: str
|
|
62
|
+
Label describing the application.
|
|
63
|
+
description: str
|
|
64
|
+
Description of the application.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
CommandLineParser
|
|
69
|
+
Command line parser object
|
|
70
|
+
|
|
71
|
+
"""
|
|
72
|
+
config = configurator.Configurator(label=label, description=description)
|
|
73
|
+
|
|
74
|
+
config.parser.add_argument(
|
|
75
|
+
"--simtel_file_names",
|
|
76
|
+
help="Name of the simtel_array output files to be calculate the trigger rate from or the "
|
|
77
|
+
"text file containing the list of simtel_array output files.",
|
|
78
|
+
nargs="+",
|
|
79
|
+
required=True,
|
|
80
|
+
type=str,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
config.parser.add_argument(
|
|
84
|
+
"--save_tables",
|
|
85
|
+
help="If true, saves the trigger rates per energy bin into ECSV files.",
|
|
86
|
+
action="store_true",
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
config.parser.add_argument(
|
|
90
|
+
"--area_from_distribution",
|
|
91
|
+
help="If true, calculates the trigger rates using the event distribution.",
|
|
92
|
+
action="store_true",
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
config.parser.add_argument(
|
|
96
|
+
"--stack_files",
|
|
97
|
+
help="If true, stacks all the histograms.",
|
|
98
|
+
action="store_true",
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
config_parser, _ = config.initialize(
|
|
102
|
+
db_config=False,
|
|
103
|
+
paths=True,
|
|
104
|
+
simulation_configuration={"corsika_configuration": ["energy_range", "view_cone"]},
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return config_parser
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _get_simulation_parameters(config_parser):
|
|
111
|
+
"""
|
|
112
|
+
Get energy range and view cone in the correct form to use in the simtel classes.
|
|
113
|
+
|
|
114
|
+
Parameters
|
|
115
|
+
----------
|
|
116
|
+
CommandLineParser:
|
|
117
|
+
Command line parser object as defined by the _parse function.
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
list:
|
|
122
|
+
The energy range used in the simulation.
|
|
123
|
+
list:
|
|
124
|
+
The view cone used in the simulation.
|
|
125
|
+
|
|
126
|
+
"""
|
|
127
|
+
if config_parser["energy_range"] is not None:
|
|
128
|
+
energy_range = [
|
|
129
|
+
config_parser["energy_range"][0].to("TeV").value,
|
|
130
|
+
config_parser["energy_range"][1].to("TeV").value,
|
|
131
|
+
]
|
|
132
|
+
else:
|
|
133
|
+
energy_range = None
|
|
134
|
+
if config_parser["view_cone"] is not None:
|
|
135
|
+
view_cone = [
|
|
136
|
+
config_parser["view_cone"][0].to("deg").value,
|
|
137
|
+
config_parser["view_cone"][1].to("deg").value,
|
|
138
|
+
]
|
|
139
|
+
else:
|
|
140
|
+
view_cone = None
|
|
141
|
+
|
|
142
|
+
return energy_range, view_cone
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def main(): # noqa: D103
|
|
146
|
+
label = Path(__file__).stem
|
|
147
|
+
description = (
|
|
148
|
+
"Calculates the simulated and triggered event rate based on simtel_array output files."
|
|
149
|
+
)
|
|
150
|
+
config_parser = _parse(label, description)
|
|
151
|
+
|
|
152
|
+
logger = logging.getLogger()
|
|
153
|
+
logger.setLevel(gen.get_log_level_from_user(config_parser["log_level"]))
|
|
154
|
+
|
|
155
|
+
# Building list of simtel_array files from the input files
|
|
156
|
+
simtel_array_files = []
|
|
157
|
+
for one_file in config_parser["simtel_file_names"]:
|
|
158
|
+
try:
|
|
159
|
+
if Path(one_file).suffix in [".zst", ".simtel", ".hdata"]:
|
|
160
|
+
simtel_array_files.append(one_file)
|
|
161
|
+
else:
|
|
162
|
+
# Collecting hist files
|
|
163
|
+
with open(one_file, encoding="utf-8") as file:
|
|
164
|
+
for line in file:
|
|
165
|
+
# Removing '\n' from filename, in case it is left there.
|
|
166
|
+
simtel_array_files.append(line.replace("\n", ""))
|
|
167
|
+
except FileNotFoundError as exc:
|
|
168
|
+
msg = f"{one_file} is not a file."
|
|
169
|
+
logger.error(msg)
|
|
170
|
+
raise FileNotFoundError from exc
|
|
171
|
+
|
|
172
|
+
energy_range, view_cone = _get_simulation_parameters(config_parser)
|
|
173
|
+
|
|
174
|
+
histograms = SimtelIOHistograms(
|
|
175
|
+
simtel_array_files,
|
|
176
|
+
area_from_distribution=config_parser["area_from_distribution"],
|
|
177
|
+
energy_range=energy_range,
|
|
178
|
+
view_cone=view_cone,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
logger.info("Calculating simulated and triggered event rate")
|
|
182
|
+
(
|
|
183
|
+
sim_event_rates,
|
|
184
|
+
triggered_event_rates,
|
|
185
|
+
triggered_event_rate_uncertainties,
|
|
186
|
+
trigger_rate_in_tables,
|
|
187
|
+
) = histograms.calculate_trigger_rates(
|
|
188
|
+
print_info=True, stack_files=config_parser["stack_files"]
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# Print out results
|
|
192
|
+
for i_hist, _ in enumerate(sim_event_rates):
|
|
193
|
+
print(f"\nFile {histograms.histogram_files[i_hist]}\n")
|
|
194
|
+
print(
|
|
195
|
+
f"System trigger rate (Hz): {triggered_event_rates[i_hist].value:.4e} \u00B1 "
|
|
196
|
+
f"{triggered_event_rate_uncertainties[i_hist].value:.4e} Hz"
|
|
197
|
+
)
|
|
198
|
+
if config_parser["save_tables"]:
|
|
199
|
+
io_handler_instance = io_handler.IOHandler()
|
|
200
|
+
output_path = io_handler_instance.get_output_directory(label, sub_dir="application-plots")
|
|
201
|
+
for i_table, table in enumerate(trigger_rate_in_tables):
|
|
202
|
+
output_file = (
|
|
203
|
+
str(output_path.joinpath(Path(simtel_array_files[i_table]).stem)) + ".ecsv"
|
|
204
|
+
)
|
|
205
|
+
logger.info(f"Writing table {i_table + 1} to {output_file}")
|
|
206
|
+
table.write(output_file, overwrite=True)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
if __name__ == "__main__":
|
|
210
|
+
main()
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
r"""
|
|
3
|
+
Convert all simulation model parameters exported from sim_telarray format using schema files.
|
|
4
|
+
|
|
5
|
+
Check value, type, and range, convert units, and write json files
|
|
6
|
+
ready to be submitted to the model database. Prints out parameters which are not found
|
|
7
|
+
in simtel configuration file and parameters which are not found in simtools schema files.
|
|
8
|
+
|
|
9
|
+
Command line arguments
|
|
10
|
+
----------------------
|
|
11
|
+
simtel_cfg_file (str)
|
|
12
|
+
File name of sim_telarray configuration file containing all simulation model parameters.
|
|
13
|
+
|
|
14
|
+
simtel_telescope_name (str)
|
|
15
|
+
Name of the telescope in the sim_telarray configuration file.
|
|
16
|
+
|
|
17
|
+
telescope (str, optional)
|
|
18
|
+
Telescope model name (e.g. LST-1, SST-D, ...)
|
|
19
|
+
|
|
20
|
+
Example
|
|
21
|
+
-------
|
|
22
|
+
|
|
23
|
+
Extract model parameters with schema files from simtel configuration file
|
|
24
|
+
(requires access to the model parameter repository)
|
|
25
|
+
|
|
26
|
+
.. code-block:: console
|
|
27
|
+
|
|
28
|
+
simtools-convert-all-model-parameters-from-simtel \\
|
|
29
|
+
--schema_directory ../model_parameters/schema\\
|
|
30
|
+
--simtel_cfg_file all_telescope_config_la_palma.cfg\\
|
|
31
|
+
--simtel_telescope_name CT1\\
|
|
32
|
+
--telescope LSTN-01\\
|
|
33
|
+
--model_version "2024-03-06"
|
|
34
|
+
|
|
35
|
+
The export of the model parameters from sim_telarray for 6.0.0 can be done e.g., as follows:
|
|
36
|
+
|
|
37
|
+
.. code-block:: console
|
|
38
|
+
|
|
39
|
+
./sim_telarray/bin/sim_telarray -c sim_telarray/cfg/CTA/CTA-PROD6-LaPalma.cfg \\
|
|
40
|
+
-C limits=no-internal -C initlist=no-internal -C list=no-internal \\
|
|
41
|
+
-C typelist=no-internal -C maximum_telescopes=30 -DNSB_AUTOSCALE \\
|
|
42
|
+
-DNECTARCAM -DHYPER_LAYOUT -DNUM_TELESCOPES=30 /dev/null \\
|
|
43
|
+
2>|/dev/null | grep '(@cfg)' >| all_telescope_config_la_palma.cfg
|
|
44
|
+
|
|
45
|
+
./sim_telarray/bin/sim_telarray -c sim_telarray/cfg/CTA/CTA-PROD6-Paranal.cfg \\
|
|
46
|
+
-C limits=no-internal -C initlist=no-internal -C list=no-internal \\
|
|
47
|
+
-C typelist=no-internal -C maximum_telescopes=87 -DNSB_AUTOSCALE \\
|
|
48
|
+
-DFLASHCAM -DHYPER_LAYOUT -DNUM_TELESCOPES=87 /dev/null \\
|
|
49
|
+
2>|/dev/null | grep '(@cfg)' >| all_telescope_config_paranal.cfg
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
import logging
|
|
54
|
+
import re
|
|
55
|
+
from pathlib import Path
|
|
56
|
+
|
|
57
|
+
import numpy as np
|
|
58
|
+
|
|
59
|
+
import simtools.data_model.model_data_writer as writer
|
|
60
|
+
import simtools.utils.general as gen
|
|
61
|
+
from simtools.configuration import configurator
|
|
62
|
+
from simtools.constants import MODEL_PARAMETER_SCHEMA_PATH
|
|
63
|
+
from simtools.io_operations.io_handler import IOHandler
|
|
64
|
+
from simtools.simtel.simtel_config_reader import SimtelConfigReader
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _parse(label=None, description=None):
|
|
68
|
+
"""
|
|
69
|
+
Parse command line configuration.
|
|
70
|
+
|
|
71
|
+
Parameters
|
|
72
|
+
----------
|
|
73
|
+
label: str
|
|
74
|
+
Label describing application.
|
|
75
|
+
description: str
|
|
76
|
+
Description of application.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
CommandLineParser
|
|
81
|
+
Command line parser object
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
config = configurator.Configurator(label=label, description=description)
|
|
85
|
+
|
|
86
|
+
config.parser.add_argument(
|
|
87
|
+
"--schema_directory",
|
|
88
|
+
help=(
|
|
89
|
+
"Directory with schema files for model parameter validation "
|
|
90
|
+
"(default: simtools schema directory)"
|
|
91
|
+
),
|
|
92
|
+
required=False,
|
|
93
|
+
)
|
|
94
|
+
config.parser.add_argument(
|
|
95
|
+
"--simtel_cfg_file",
|
|
96
|
+
help="File name for simtel_array configuration",
|
|
97
|
+
type=str,
|
|
98
|
+
required=True,
|
|
99
|
+
)
|
|
100
|
+
config.parser.add_argument(
|
|
101
|
+
"--simtel_telescope_name",
|
|
102
|
+
help="Name of the telescope in the sim_telarray configuration file",
|
|
103
|
+
type=str,
|
|
104
|
+
required=True,
|
|
105
|
+
)
|
|
106
|
+
return config.initialize(simulation_model="telescope")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def get_list_of_parameters_and_schema_files(schema_directory):
|
|
110
|
+
"""
|
|
111
|
+
Return list of parameters and schema files located in schema file directory.
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
list
|
|
116
|
+
List of parameters found in schema file directory.
|
|
117
|
+
list
|
|
118
|
+
List of schema files found in schema file directory.
|
|
119
|
+
|
|
120
|
+
"""
|
|
121
|
+
schema_files = sorted(Path(schema_directory).rglob("*.schema.yml"))
|
|
122
|
+
parameters = []
|
|
123
|
+
for schema_file in schema_files:
|
|
124
|
+
schema_dict = gen.collect_data_from_file(file_name=schema_file)
|
|
125
|
+
parameters.append(schema_dict.get("name"))
|
|
126
|
+
return parameters, schema_files
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def get_list_of_simtel_parameters(simtel_config_file, logger):
|
|
130
|
+
"""
|
|
131
|
+
Return list of simtel parameters found in simtel configuration file.
|
|
132
|
+
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
simtel_config_file: str
|
|
136
|
+
File name for sim_telarray configuration
|
|
137
|
+
logger: logging.Logger
|
|
138
|
+
Logger object
|
|
139
|
+
|
|
140
|
+
Returns
|
|
141
|
+
-------
|
|
142
|
+
list
|
|
143
|
+
List of parameters found in simtel configuration file.
|
|
144
|
+
|
|
145
|
+
"""
|
|
146
|
+
simtel_parameter_set = set()
|
|
147
|
+
with open(simtel_config_file, encoding="utf-8") as file:
|
|
148
|
+
for line in file:
|
|
149
|
+
parts_of_lines = re.split(r",\s*|\s+", line.strip())
|
|
150
|
+
simtel_parameter_set.add(parts_of_lines[1].lower())
|
|
151
|
+
logger.info(f"Found {len(simtel_parameter_set)} parameters in simtel configuration file.")
|
|
152
|
+
return list(simtel_parameter_set)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def read_simtel_config_file(args_dict, logger, schema_file, camera_pixels=None):
|
|
156
|
+
"""
|
|
157
|
+
Read the simtel configuration file.
|
|
158
|
+
|
|
159
|
+
Parameters
|
|
160
|
+
----------
|
|
161
|
+
args_dict: dict
|
|
162
|
+
Dictionary with command line arguments.
|
|
163
|
+
logger: logging.Logger
|
|
164
|
+
Logger object
|
|
165
|
+
schema_file: str
|
|
166
|
+
Schema path name.
|
|
167
|
+
camera_pixels: int
|
|
168
|
+
Number of camera pixels.
|
|
169
|
+
|
|
170
|
+
"""
|
|
171
|
+
simtel_config_reader = SimtelConfigReader(
|
|
172
|
+
schema_file=schema_file,
|
|
173
|
+
simtel_config_file=args_dict["simtel_cfg_file"],
|
|
174
|
+
simtel_telescope_name=args_dict["simtel_telescope_name"],
|
|
175
|
+
camera_pixels=camera_pixels,
|
|
176
|
+
)
|
|
177
|
+
logger.info(f"Simtel parameter: {simtel_config_reader.parameter_dict}")
|
|
178
|
+
|
|
179
|
+
if simtel_config_reader.parameter_dict is None or len(simtel_config_reader.parameter_dict) == 0:
|
|
180
|
+
return None
|
|
181
|
+
return simtel_config_reader
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def get_number_of_camera_pixel(args_dict, logger):
|
|
185
|
+
"""
|
|
186
|
+
Get the number of camera pixels from the simtel configuration file.
|
|
187
|
+
|
|
188
|
+
Required to set the dimension some of the parameter correctly, as simtel
|
|
189
|
+
in some cases does not provide the dimension ('all:' in the parameter files).
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
args_dict: dict
|
|
194
|
+
Dictionary with command line arguments.
|
|
195
|
+
logger: logging.Logger
|
|
196
|
+
Logger object
|
|
197
|
+
|
|
198
|
+
Returns
|
|
199
|
+
-------
|
|
200
|
+
int, None
|
|
201
|
+
Number of camera pixels (None if file is not found)
|
|
202
|
+
|
|
203
|
+
"""
|
|
204
|
+
try:
|
|
205
|
+
simtel_config_reader = SimtelConfigReader(
|
|
206
|
+
schema_file=MODEL_PARAMETER_SCHEMA_PATH / "camera_pixels.schema.yml",
|
|
207
|
+
simtel_config_file=args_dict["simtel_cfg_file"],
|
|
208
|
+
simtel_telescope_name=args_dict["simtel_telescope_name"],
|
|
209
|
+
)
|
|
210
|
+
_camera_pixel = simtel_config_reader.parameter_dict.get(args_dict["simtel_telescope_name"])
|
|
211
|
+
except (FileNotFoundError, AttributeError):
|
|
212
|
+
logger.warning("Failed to read camera pixel parameter.")
|
|
213
|
+
_camera_pixel = None
|
|
214
|
+
logger.info(f"Number of camera pixels: {_camera_pixel}")
|
|
215
|
+
return _camera_pixel
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def read_and_export_parameters(args_dict, logger):
|
|
219
|
+
"""
|
|
220
|
+
Read and export parameters from simtel configuration file to json files.
|
|
221
|
+
|
|
222
|
+
Only applicable parameters are exported to json.
|
|
223
|
+
Provide extensive logging information on the parameters found in the simtel
|
|
224
|
+
configuration file.
|
|
225
|
+
|
|
226
|
+
Parameters
|
|
227
|
+
----------
|
|
228
|
+
args_dict: dict
|
|
229
|
+
Dictionary with command line arguments.
|
|
230
|
+
logger: logging.Logger
|
|
231
|
+
Logger object
|
|
232
|
+
|
|
233
|
+
Returns
|
|
234
|
+
-------
|
|
235
|
+
list
|
|
236
|
+
List of simtel parameters not found in schema files.
|
|
237
|
+
list
|
|
238
|
+
List of simtools parameter not found in simtel configuration file.
|
|
239
|
+
|
|
240
|
+
"""
|
|
241
|
+
_parameters, _schema_files = get_list_of_parameters_and_schema_files(
|
|
242
|
+
args_dict.get("schema_directory", MODEL_PARAMETER_SCHEMA_PATH)
|
|
243
|
+
)
|
|
244
|
+
_simtel_parameters = get_list_of_simtel_parameters(args_dict["simtel_cfg_file"], logger)
|
|
245
|
+
|
|
246
|
+
io_handler = IOHandler()
|
|
247
|
+
io_handler.set_paths(output_path=args_dict["output_path"], use_plain_output_path=True)
|
|
248
|
+
|
|
249
|
+
_camera_pixel = get_number_of_camera_pixel(args_dict, logger)
|
|
250
|
+
|
|
251
|
+
_parameters_not_in_simtel = []
|
|
252
|
+
|
|
253
|
+
for _parameter, _schema_file in zip(_parameters, _schema_files):
|
|
254
|
+
|
|
255
|
+
logger.info(f"Parameter: {_parameter} Schema file: {_schema_file}")
|
|
256
|
+
simtel_config_reader = read_simtel_config_file(
|
|
257
|
+
args_dict, logger, _schema_file, _camera_pixel
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if simtel_config_reader is None:
|
|
261
|
+
logger.info("Parameter not found in sim_telarray configuration file.")
|
|
262
|
+
_parameters_not_in_simtel.append(_parameter)
|
|
263
|
+
continue
|
|
264
|
+
|
|
265
|
+
_json_dict = writer.ModelDataWriter.dump_model_parameter(
|
|
266
|
+
parameter_name=_parameter,
|
|
267
|
+
value=simtel_config_reader.parameter_dict.get(args_dict["simtel_telescope_name"]),
|
|
268
|
+
instrument=args_dict["telescope"],
|
|
269
|
+
model_version=args_dict["model_version"],
|
|
270
|
+
output_file=io_handler.get_output_file(f"{_parameter}.json"),
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
simtel_config_reader.compare_simtel_config_with_schema()
|
|
274
|
+
|
|
275
|
+
if simtel_config_reader.simtel_parameter_name.lower() in _simtel_parameters:
|
|
276
|
+
_simtel_parameters.remove(simtel_config_reader.simtel_parameter_name.lower())
|
|
277
|
+
|
|
278
|
+
if _json_dict["file"]:
|
|
279
|
+
logger.info(f"File name for {_parameter} is {_json_dict['value']}")
|
|
280
|
+
|
|
281
|
+
return _parameters_not_in_simtel, _simtel_parameters
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def print_parameters_not_found(_parameters_not_in_simtel, _simtel_parameters, args_dict, logger):
|
|
285
|
+
"""
|
|
286
|
+
Print simtel/simtools parameter not found in schema and ocnfiguration files.
|
|
287
|
+
|
|
288
|
+
For simtel parameters not found, check if the setting for the chose
|
|
289
|
+
telescope is different from the default values.
|
|
290
|
+
|
|
291
|
+
Parameters
|
|
292
|
+
----------
|
|
293
|
+
_parameters_not_in_simtel: list
|
|
294
|
+
List of simtel parameters not found in schema files.
|
|
295
|
+
_simtel_parameters: list
|
|
296
|
+
List of simtel parameters not found in simtools schema files.
|
|
297
|
+
args_dict: dict
|
|
298
|
+
Dictionary with command line arguments.
|
|
299
|
+
logger: logging.Logger
|
|
300
|
+
Logger object
|
|
301
|
+
|
|
302
|
+
"""
|
|
303
|
+
logger.info(
|
|
304
|
+
f"Parameters not found in simtools schema files ({len(_parameters_not_in_simtel)}):"
|
|
305
|
+
)
|
|
306
|
+
for para in sorted(_parameters_not_in_simtel):
|
|
307
|
+
logger.info(f" {para}")
|
|
308
|
+
|
|
309
|
+
logger.info(f"Simtel parameters not found in schema files ({len(_simtel_parameters)}):")
|
|
310
|
+
for para in sorted(_simtel_parameters):
|
|
311
|
+
logger.info(f"Simtel parameter: {para}")
|
|
312
|
+
simtel_config_reader = SimtelConfigReader(
|
|
313
|
+
schema_file=None,
|
|
314
|
+
simtel_config_file=args_dict["simtel_cfg_file"],
|
|
315
|
+
simtel_telescope_name=args_dict["simtel_telescope_name"],
|
|
316
|
+
parameter_name=para,
|
|
317
|
+
)
|
|
318
|
+
_default = simtel_config_reader.parameter_dict.get("default")
|
|
319
|
+
_tel_value = simtel_config_reader.parameter_dict.get(args_dict["simtel_telescope_name"])
|
|
320
|
+
# simple comparison of default value and telescope values, does not work for lists
|
|
321
|
+
try:
|
|
322
|
+
if _default == _tel_value or np.isclose(_default, _tel_value):
|
|
323
|
+
logger.info(f" Default and telescope values are equal: {_default}")
|
|
324
|
+
continue
|
|
325
|
+
except (ValueError, TypeError):
|
|
326
|
+
pass
|
|
327
|
+
if isinstance(_default, np.ndarray):
|
|
328
|
+
logger.warning(f" Default value: {_default} (length: {_default.size})")
|
|
329
|
+
else:
|
|
330
|
+
logger.warning(f" Default value: {_default}")
|
|
331
|
+
if isinstance(_tel_value, np.ndarray):
|
|
332
|
+
logger.warning(f" Telescope value: {_tel_value} (length: {_tel_value.size})")
|
|
333
|
+
else:
|
|
334
|
+
logger.warning(f" Telescope value: {_tel_value}")
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def print_list_of_files(args_dict, logger):
|
|
338
|
+
"""
|
|
339
|
+
Print model parameters which describe a file name.
|
|
340
|
+
|
|
341
|
+
This is useful to find files which are part of the model.
|
|
342
|
+
|
|
343
|
+
Parameters
|
|
344
|
+
----------
|
|
345
|
+
args_dict: dict
|
|
346
|
+
Dictionary with command line arguments.
|
|
347
|
+
logger: logging.Logger
|
|
348
|
+
Logger object
|
|
349
|
+
|
|
350
|
+
"""
|
|
351
|
+
model_files = sorted(Path(args_dict["output_path"]).rglob("*.json"))
|
|
352
|
+
for file in model_files:
|
|
353
|
+
model_dict = gen.collect_data_from_file(file_name=file)
|
|
354
|
+
if model_dict.get("file"):
|
|
355
|
+
logger.info(f"{file.name}: {model_dict['value']}")
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def main(): # noqa: D103
|
|
359
|
+
args_dict, _ = _parse(
|
|
360
|
+
label=Path(__file__).stem,
|
|
361
|
+
description="Convert simulation model parameters from sim_telarray to simtools format.",
|
|
362
|
+
)
|
|
363
|
+
logger = logging.getLogger()
|
|
364
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
365
|
+
|
|
366
|
+
_parameters_not_in_simtel, _simtel_parameters = read_and_export_parameters(args_dict, logger)
|
|
367
|
+
print_parameters_not_found(_parameters_not_in_simtel, _simtel_parameters, args_dict, logger)
|
|
368
|
+
print_list_of_files(args_dict, logger)
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
if __name__ == "__main__":
|
|
372
|
+
main()
|