gammasimtools 0.6.0__py3-none-any.whl → 0.8.1__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.1.dist-info/METADATA +172 -0
- gammasimtools-0.8.1.dist-info/RECORD +346 -0
- {gammasimtools-0.6.0.dist-info → gammasimtools-0.8.1.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.1.dist-info/entry_points.txt +31 -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 +113 -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 +210 -184
- 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 +329 -533
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +305 -256
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +233 -496
- simtools/model/mirrors.py +61 -44
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +7 -103
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +127 -621
- 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 +266 -568
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +2 -0
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.0.dist-info/METADATA +0 -180
- gammasimtools-0.6.0.dist-info/RECORD +0 -91
- gammasimtools-0.6.0.dist-info/entry_points.txt +0 -23
- 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 -1481
- 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.0.dist-info → gammasimtools-0.8.1.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.0.dist-info → gammasimtools-0.8.1.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
r"""
|
|
4
|
+
Generates a set of histograms Cherenkov photon distributions from CORSIKA output.
|
|
5
|
+
|
|
6
|
+
The Cherenkov photons (from observation level) are read from a CORSIKA IACT
|
|
7
|
+
output file provided as input.
|
|
8
8
|
|
|
9
9
|
The histograms can be saved both into pdfs and in a hdf5 file.
|
|
10
10
|
|
|
11
|
-
The following 2D histograms are
|
|
11
|
+
The following 2D histograms are generated:
|
|
12
12
|
- Number of Cherenkov photons on the ground;
|
|
13
13
|
- Density of Cherenkov photons on the ground;
|
|
14
14
|
- Incoming direction (directive cosines) of the Cherenkov photons;
|
|
15
15
|
- Time of arrival (ns) vs altitude of production (km);
|
|
16
16
|
- Number of Cherenkov photons per event per telescope.
|
|
17
17
|
|
|
18
|
-
The following 1D histograms are
|
|
18
|
+
The following 1D histograms are generated:
|
|
19
19
|
- Wavelength;
|
|
20
20
|
- Counts;
|
|
21
21
|
- Density;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- Number of photons per event.
|
|
26
26
|
|
|
27
27
|
Histograms for the distribution of CORSIKA event header elements can also be generated by using
|
|
28
|
-
the
|
|
28
|
+
the --event_1d_histograms and --event_2d_histograms arguments. The accepted arguments (keys)
|
|
29
29
|
are to be found in the CORSIKA manual, e.g., "total_energy", "zenith", "azimuth".
|
|
30
30
|
|
|
31
31
|
Command line arguments
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
bins: 100
|
|
66
66
|
scale: linear
|
|
67
67
|
start: !astropy.units.Quantity
|
|
68
|
-
unit: &id001
|
|
68
|
+
unit: &id001 m
|
|
69
69
|
value: -1000.0
|
|
70
70
|
stop: &id002 !astropy.units.Quantity
|
|
71
71
|
unit: *id001
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
bins: 80
|
|
82
82
|
scale: linear
|
|
83
83
|
start: !astropy.units.Quantity
|
|
84
|
-
unit:
|
|
84
|
+
unit: nm
|
|
85
85
|
value: 200.0
|
|
86
86
|
stop: !astropy.units.Quantity
|
|
87
87
|
unit: *id003
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
bins: 100
|
|
92
92
|
scale: linear
|
|
93
93
|
start: !astropy.units.Quantity
|
|
94
|
-
unit:
|
|
94
|
+
unit: ns
|
|
95
95
|
value: -2000.0
|
|
96
96
|
stop: !astropy.units.Quantity
|
|
97
97
|
unit: *id004
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
bins: 100
|
|
101
101
|
scale: linear
|
|
102
102
|
start: !astropy.units.Quantity
|
|
103
|
-
unit:
|
|
103
|
+
unit: km
|
|
104
104
|
value: 120.0
|
|
105
105
|
stop: !astropy.units.Quantity
|
|
106
106
|
unit: *id005
|
|
@@ -110,10 +110,10 @@
|
|
|
110
110
|
pdf (bool, optional)
|
|
111
111
|
If set, histograms are saved into pdf files.
|
|
112
112
|
One pdf file contains all the histograms for the Cherenkov photons.
|
|
113
|
-
The name of the file is controlled via
|
|
113
|
+
The name of the file is controlled via hdf5_file_name.
|
|
114
114
|
If event_1d_histograms and event_2d_histograms are used, two separate pdf files might be
|
|
115
115
|
created to accommodate the histograms for the CORSIKA event header elements. The core names
|
|
116
|
-
of these output pdf files are also given by
|
|
116
|
+
of these output pdf files are also given by hdf5_file_name argument with the addition of
|
|
117
117
|
'event_1d_histograms' and 'event_2d_histograms'.
|
|
118
118
|
|
|
119
119
|
|
|
@@ -122,28 +122,28 @@
|
|
|
122
122
|
|
|
123
123
|
hdf5_file_name (str, optional)
|
|
124
124
|
The name of the output hdf5 data (without the path).
|
|
125
|
-
It requires the
|
|
126
|
-
If not given,
|
|
127
|
-
If the output
|
|
128
|
-
flags (e.g.
|
|
125
|
+
It requires the --hdf5 flag.
|
|
126
|
+
If not given, hdf5_file_name takes the name from the input IACT file (input_file).
|
|
127
|
+
If the output hdf5_file_name file already exists, the tables associated to the chosen
|
|
128
|
+
flags (e.g. hdf5, event_1d_histograms, event_2d_histograms) will be overwritten. The
|
|
129
129
|
remaining tables, if any, will stay untouched.
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
event_1d_histograms (str, optional)
|
|
133
|
-
|
|
133
|
+
Generate 1D histograms for elements given in --event_1d_histograms from the CORSIKA event
|
|
134
134
|
header and save into hdf5/pdf files.
|
|
135
135
|
It allows more than one argument, separated by simple spaces.
|
|
136
|
-
Usage:
|
|
136
|
+
Usage: --event_1d_histograms first_interaction_height total_energy.
|
|
137
137
|
|
|
138
138
|
event_2d_histograms (str, optional)
|
|
139
|
-
|
|
139
|
+
Generate 2D histograms for elements given in --event_2d_histograms from the CORSIKA event
|
|
140
140
|
header and save into hdf5/pdf files.
|
|
141
141
|
It allows more than one argument, separated by simple spaces.
|
|
142
|
-
The elements are grouped into pairs and the 2D histograms are
|
|
142
|
+
The elements are grouped into pairs and the 2D histograms are generated always for two
|
|
143
143
|
subsequent elements.
|
|
144
|
-
For example,
|
|
145
|
-
will
|
|
146
|
-
histogram for
|
|
144
|
+
For example, --event_2d_histograms first_interaction_height total_energy zenith azimuth
|
|
145
|
+
will generate one 2D histogram for first_interaction_height total_energy and another 2D
|
|
146
|
+
histogram for zenith and azimuth.
|
|
147
147
|
|
|
148
148
|
Example
|
|
149
149
|
-------
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
|
|
152
152
|
.. code-block:: console
|
|
153
153
|
|
|
154
|
-
simtools-generate-corsika-histograms --iact_file /workdir/external/simtools
|
|
155
|
-
|
|
154
|
+
simtools-generate-corsika-histograms --iact_file /workdir/external/simtools/\\
|
|
155
|
+
testsresources/tel_output_10GeV-2-gamma-20deg-CTAO-South.corsikaio \\
|
|
156
|
+
--pdf --hdf5 \\
|
|
156
157
|
--event_2d_histograms zenith azimuth --event_1d_histograms total_energy
|
|
157
158
|
|
|
158
|
-
|
|
159
159
|
Expected final print-out message:
|
|
160
160
|
|
|
161
161
|
.. code-block:: console
|
|
@@ -182,7 +182,7 @@ logger = logging.getLogger()
|
|
|
182
182
|
|
|
183
183
|
def _parse(label, description):
|
|
184
184
|
"""
|
|
185
|
-
Parse command line configuration
|
|
185
|
+
Parse command line configuration.
|
|
186
186
|
|
|
187
187
|
Parameters
|
|
188
188
|
----------
|
|
@@ -251,7 +251,7 @@ def _parse(label, description):
|
|
|
251
251
|
config.parser.add_argument(
|
|
252
252
|
"--event_1d_histograms",
|
|
253
253
|
help="The keys from the CORSIKA event header to be used for the generation of 1D "
|
|
254
|
-
"histograms. The available choices can been found in the
|
|
254
|
+
"histograms. The available choices can been found in the all_event_keys attribute of"
|
|
255
255
|
"the CorsikaHistograms.",
|
|
256
256
|
required=False,
|
|
257
257
|
default=None,
|
|
@@ -261,7 +261,7 @@ def _parse(label, description):
|
|
|
261
261
|
config.parser.add_argument(
|
|
262
262
|
"--event_2d_histograms",
|
|
263
263
|
help="The keys from the CORSIKA event header to be used for the generation of 2D "
|
|
264
|
-
"histograms. The available choices can been found in the
|
|
264
|
+
"histograms. The available choices can been found in the all_event_keys attribute of"
|
|
265
265
|
"the CorsikaHistograms.",
|
|
266
266
|
required=False,
|
|
267
267
|
default=None,
|
|
@@ -270,16 +270,16 @@ def _parse(label, description):
|
|
|
270
270
|
|
|
271
271
|
config_parser, _ = config.initialize(db_config=False, paths=True)
|
|
272
272
|
|
|
273
|
-
if
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
273
|
+
if (
|
|
274
|
+
not config_parser["pdf"]
|
|
275
|
+
and not config_parser["hdf5"]
|
|
276
|
+
and not config_parser["event_1d_histograms"]
|
|
277
|
+
and not config_parser["event_2d_histograms"]
|
|
278
|
+
):
|
|
279
|
+
config.parser.error(
|
|
280
|
+
"At least one argument is required: --pdf, --hdf5, --event_1d_histograms, or "
|
|
281
|
+
"--event_2d_histograms."
|
|
282
|
+
)
|
|
283
283
|
|
|
284
284
|
return config_parser, _
|
|
285
285
|
|
|
@@ -290,12 +290,11 @@ def _plot_figures(corsika_histograms_instance, test=False):
|
|
|
290
290
|
|
|
291
291
|
Parameters
|
|
292
292
|
----------
|
|
293
|
-
corsika_histograms_instance:
|
|
293
|
+
corsika_histograms_instance: CorsikaHistograms instance.
|
|
294
294
|
The CorsikaHistograms instance created in main.
|
|
295
295
|
test: bool
|
|
296
296
|
If true plots the figures for the first two functions only.
|
|
297
297
|
"""
|
|
298
|
-
|
|
299
298
|
plot_function_names = [
|
|
300
299
|
plotting_method
|
|
301
300
|
for plotting_method in dir(corsika_histograms_visualize)
|
|
@@ -307,8 +306,8 @@ def _plot_figures(corsika_histograms_instance, test=False):
|
|
|
307
306
|
|
|
308
307
|
figure_list = []
|
|
309
308
|
for function_name in plot_function_names:
|
|
310
|
-
|
|
311
|
-
figures =
|
|
309
|
+
plot_function = getattr(corsika_histograms_visualize, function_name)
|
|
310
|
+
figures = plot_function(corsika_histograms_instance)
|
|
312
311
|
for fig in figures:
|
|
313
312
|
figure_list.append(fig)
|
|
314
313
|
|
|
@@ -326,10 +325,10 @@ def _derive_event_1d_histograms(
|
|
|
326
325
|
|
|
327
326
|
Parameters
|
|
328
327
|
----------
|
|
329
|
-
corsika_histograms_instance:
|
|
328
|
+
corsika_histograms_instance: CorsikaHistograms instance.
|
|
330
329
|
The CorsikaHistograms instance created in main.
|
|
331
330
|
event_1d_header_keys: str
|
|
332
|
-
|
|
331
|
+
Generate 1D histograms for elements given in event_1d_header_keys from the CORSIKA event
|
|
333
332
|
header and save into hdf5/pdf files.
|
|
334
333
|
pdf: bool
|
|
335
334
|
If true, histograms are saved into a pdf file.
|
|
@@ -362,14 +361,15 @@ def _derive_event_2d_histograms(
|
|
|
362
361
|
):
|
|
363
362
|
"""
|
|
364
363
|
Auxiliary function to derive the histograms for the arguments given by event_1d_histograms.
|
|
364
|
+
|
|
365
365
|
If an odd number of event header keys are given, the last one is discarded.
|
|
366
366
|
|
|
367
367
|
Parameters
|
|
368
368
|
----------
|
|
369
|
-
corsika_histograms_instance:
|
|
369
|
+
corsika_histograms_instance: CorsikaHistograms instance.
|
|
370
370
|
The CorsikaHistograms instance created in main.
|
|
371
371
|
event_2d_header_keys: str
|
|
372
|
-
|
|
372
|
+
Generate 1D histograms for elements given in event_1d_header_keys from the CORSIKA event
|
|
373
373
|
header and save into hdf5/pdf files.
|
|
374
374
|
pdf: bool
|
|
375
375
|
If true, histograms are saved into a pdf file.
|
|
@@ -384,7 +384,7 @@ def _derive_event_2d_histograms(
|
|
|
384
384
|
|
|
385
385
|
if len(event_2d_header_keys) % 2 == 1: # if odd number of keys
|
|
386
386
|
msg = (
|
|
387
|
-
"An odd number of keys was passed to
|
|
387
|
+
"An odd number of keys was passed to generate 2D histograms."
|
|
388
388
|
"The last key is being ignored."
|
|
389
389
|
)
|
|
390
390
|
logger.warning(msg)
|
|
@@ -412,7 +412,7 @@ def _derive_event_2d_histograms(
|
|
|
412
412
|
corsika_histograms_visualize.save_figs_to_pdf(figures_list, output_file_name)
|
|
413
413
|
|
|
414
414
|
|
|
415
|
-
def main():
|
|
415
|
+
def main(): # noqa: D103
|
|
416
416
|
label = Path(__file__).stem
|
|
417
417
|
description = "Generate histograms for the Cherenkov photons saved in the CORSIKA IACT file."
|
|
418
418
|
io_handler_instance = io_handler.IOHandler()
|
|
@@ -433,7 +433,7 @@ def main():
|
|
|
433
433
|
except ValueError:
|
|
434
434
|
msg = (
|
|
435
435
|
f"{args_dict['telescope_indices']} not a valid input. "
|
|
436
|
-
f"Please use integer numbers for
|
|
436
|
+
f"Please use integer numbers for telescope_indices"
|
|
437
437
|
)
|
|
438
438
|
logger.error(msg)
|
|
439
439
|
raise
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
|
-
"""
|
|
3
|
-
Summary
|
|
4
|
-
-------
|
|
2
|
+
r"""
|
|
5
3
|
Generate a default simtools metadata file from a json schema.
|
|
6
4
|
|
|
7
5
|
Command line arguments
|
|
@@ -16,8 +14,8 @@
|
|
|
16
14
|
-------
|
|
17
15
|
.. code-block:: console
|
|
18
16
|
|
|
19
|
-
simtools-generate-default-metadata
|
|
20
|
-
--schema simtools/schemas/metadata.metaschema.yml
|
|
17
|
+
simtools-generate-default-metadata \\
|
|
18
|
+
--schema simtools/schemas/metadata.metaschema.yml \\
|
|
21
19
|
--output_file default_metadata.yml
|
|
22
20
|
|
|
23
21
|
|
|
@@ -37,7 +35,7 @@ from simtools.io_operations import io_handler
|
|
|
37
35
|
|
|
38
36
|
def _parse(label, description):
|
|
39
37
|
"""
|
|
40
|
-
Parse command line configuration
|
|
38
|
+
Parse command line configuration.
|
|
41
39
|
|
|
42
40
|
Parameters
|
|
43
41
|
----------
|
|
@@ -52,7 +50,6 @@ def _parse(label, description):
|
|
|
52
50
|
Command line parser object
|
|
53
51
|
|
|
54
52
|
"""
|
|
55
|
-
|
|
56
53
|
config = configurator.Configurator(label=label, description=description)
|
|
57
54
|
|
|
58
55
|
config.parser.add_argument(
|
|
@@ -71,7 +68,7 @@ def _parse(label, description):
|
|
|
71
68
|
return config.initialize(output=False, require_command_line=True)
|
|
72
69
|
|
|
73
70
|
|
|
74
|
-
def main():
|
|
71
|
+
def main(): # noqa: D103
|
|
75
72
|
label = Path(__file__).stem
|
|
76
73
|
args_dict, _ = _parse(
|
|
77
74
|
label, description="Generate a default simtools metadata file from a json schema."
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Make a regular array of telescopes and save it as astropy table.
|
|
5
|
+
|
|
6
|
+
The arrays consist of one telescope at the center of the array and or of 4 telescopes
|
|
7
|
+
in a square grid. These arrays are used for trigger rate simulations.
|
|
8
|
+
|
|
9
|
+
The array layout files created will be available at the data/layout directory.
|
|
10
|
+
|
|
11
|
+
Command line arguments
|
|
12
|
+
----------------------
|
|
13
|
+
site (str, required)
|
|
14
|
+
observatory site (e.g., North or South).
|
|
15
|
+
model_version (str, optional)
|
|
16
|
+
Model version to use (e.g., 6.0.0). If not provided, the latest version is used.
|
|
17
|
+
|
|
18
|
+
Example
|
|
19
|
+
-------
|
|
20
|
+
Runtime < 10 s.
|
|
21
|
+
|
|
22
|
+
.. code-block:: console
|
|
23
|
+
|
|
24
|
+
simtools-generate-regular-arrays --site=North
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
import logging
|
|
28
|
+
import os
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
import astropy.units as u
|
|
32
|
+
from astropy.table import QTable
|
|
33
|
+
|
|
34
|
+
import simtools.data_model.model_data_writer as writer
|
|
35
|
+
import simtools.utils.general as gen
|
|
36
|
+
from simtools.configuration import configurator
|
|
37
|
+
from simtools.utils import names
|
|
38
|
+
|
|
39
|
+
# Telescope distances for 4 tel square arrays
|
|
40
|
+
# !HARDCODED
|
|
41
|
+
telescope_distance = {"LST": 57.5 * u.m, "MST": 70 * u.m, "SST": 80 * u.m}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse():
|
|
45
|
+
config = configurator.Configurator(
|
|
46
|
+
label=Path(__file__).stem,
|
|
47
|
+
description=(
|
|
48
|
+
"Generate a regular array of telescope and save as astropy table.\n"
|
|
49
|
+
"Default telescope distances for 4 telescope square arrays are: \n"
|
|
50
|
+
f" LST: {telescope_distance['LST']}\n"
|
|
51
|
+
f" MST: {telescope_distance['MST']}\n"
|
|
52
|
+
f" SST: {telescope_distance['SST']}\n"
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
return config.initialize(db_config=False, simulation_model="site", output=True)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def main():
|
|
59
|
+
"""Create layout array files (ecsv) of regular arrays."""
|
|
60
|
+
args_dict, _ = _parse()
|
|
61
|
+
|
|
62
|
+
logger = logging.getLogger()
|
|
63
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
64
|
+
|
|
65
|
+
if args_dict["site"] == "South":
|
|
66
|
+
array_list = ["1SST", "4SST", "1MST", "4MST", "1LST", "4LST"]
|
|
67
|
+
else:
|
|
68
|
+
array_list = ["1MST", "4MST", "1LST", "4LST"]
|
|
69
|
+
|
|
70
|
+
for array_name in array_list:
|
|
71
|
+
logger.info(f"Processing array {array_name}")
|
|
72
|
+
|
|
73
|
+
tel_name, pos_x, pos_y, pos_z = [], [], [], []
|
|
74
|
+
tel_size = array_name[1:4]
|
|
75
|
+
|
|
76
|
+
# Single telescope at the center
|
|
77
|
+
if array_name[0] == "1":
|
|
78
|
+
tel_name.append(
|
|
79
|
+
names.get_array_element_name_from_type_site_id(tel_size, args_dict["site"], "01")
|
|
80
|
+
)
|
|
81
|
+
pos_x.append(0 * u.m)
|
|
82
|
+
pos_y.append(0 * u.m)
|
|
83
|
+
pos_z.append(0 * u.m)
|
|
84
|
+
# 4 telescopes in a regular square grid
|
|
85
|
+
else:
|
|
86
|
+
for i in range(1, 5):
|
|
87
|
+
tel_name.append(
|
|
88
|
+
names.get_array_element_name_from_type_site_id(
|
|
89
|
+
tel_size, args_dict["site"], f"0{i}"
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
pos_x.append(telescope_distance[tel_size] * (-1) ** (i // 2))
|
|
93
|
+
pos_y.append(telescope_distance[tel_size] * (-1) ** (i % 2))
|
|
94
|
+
pos_z.append(0 * u.m)
|
|
95
|
+
|
|
96
|
+
table = QTable(meta={"array_name": array_name, "site": args_dict["site"]})
|
|
97
|
+
table["telescope_name"] = tel_name
|
|
98
|
+
table["position_x"] = pos_x
|
|
99
|
+
table["position_y"] = pos_y
|
|
100
|
+
table["position_z"] = pos_z
|
|
101
|
+
table.sort("telescope_name")
|
|
102
|
+
table.pprint()
|
|
103
|
+
|
|
104
|
+
output_file = args_dict.get("output_file", None)
|
|
105
|
+
if output_file is not None:
|
|
106
|
+
base_name, file_extension = os.path.splitext(output_file)
|
|
107
|
+
output_file = f"{base_name}-{args_dict['site']}-{array_name}{file_extension}"
|
|
108
|
+
writer.ModelDataWriter.dump(
|
|
109
|
+
args_dict=args_dict,
|
|
110
|
+
output_file=output_file,
|
|
111
|
+
metadata=None,
|
|
112
|
+
product_data=table,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if __name__ == "__main__":
|
|
117
|
+
main()
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
This application allows to write sim_telarray histograms into pdf and hdf5 files.
|
|
3
|
+
r"""
|
|
4
|
+
Write sim_telarray histograms into pdf and hdf5 files.
|
|
5
|
+
|
|
7
6
|
It accepts multiple lists of histograms files, a single list or a histogram file.
|
|
8
7
|
Each histogram is plotted in a page of the pdf file if the --pdf option is activated.
|
|
9
8
|
|
|
@@ -19,31 +18,29 @@
|
|
|
19
18
|
pdf (bool, optional)
|
|
20
19
|
If set, histograms are saved into pdf files.
|
|
21
20
|
One pdf file contains all the histograms found in the file.
|
|
22
|
-
The name of the file is controlled via
|
|
21
|
+
The name of the file is controlled via output_file_name.
|
|
23
22
|
hdf5: bool
|
|
24
23
|
If true, histograms are saved into hdf5 files.
|
|
25
|
-
At least one of
|
|
24
|
+
At least one of pdf and hdf5 has to be activated.
|
|
26
25
|
output_file_name (str, optional)
|
|
27
26
|
The name of the output hdf5 (and/or pdf) files (without the path).
|
|
28
|
-
If not given,
|
|
29
|
-
(
|
|
30
|
-
If the output
|
|
31
|
-
associated to
|
|
27
|
+
If not given, output_file_name takes the name from the (first) input file
|
|
28
|
+
(hist_file_names).
|
|
29
|
+
If the output output_file_name.hdf5 file already exists and hdf5 is set, the tables
|
|
30
|
+
associated to hdf5 will be overwritten. The remaining tables, if any, will stay
|
|
32
31
|
untouched.
|
|
33
|
-
verbosity (str, optional)
|
|
34
|
-
Log level to print.
|
|
35
32
|
|
|
36
33
|
Raises
|
|
37
34
|
------
|
|
38
35
|
TypeError:
|
|
39
|
-
if argument passed through
|
|
36
|
+
if argument passed through hist_file_names is not a file.
|
|
40
37
|
|
|
41
38
|
Example
|
|
42
39
|
-------
|
|
43
40
|
.. code-block:: console
|
|
44
41
|
|
|
45
|
-
simtools-generate-simtel-array-histograms --hist_file_names tests/resources/
|
|
46
|
-
run2_gamma_za20deg_azm0deg-North-Prod5_test-production-5.hdata.zst
|
|
42
|
+
simtools-generate-simtel-array-histograms --hist_file_names tests/resources/ \\
|
|
43
|
+
run2_gamma_za20deg_azm0deg-North-Prod5_test-production-5.hdata.zst \\
|
|
47
44
|
--output_file_name test_hist_hdata --hdf5 --pdf
|
|
48
45
|
|
|
49
46
|
"""
|
|
@@ -57,12 +54,12 @@ from matplotlib.backends.backend_pdf import PdfPages
|
|
|
57
54
|
import simtools.utils.general as gen
|
|
58
55
|
from simtools.configuration import configurator
|
|
59
56
|
from simtools.io_operations import io_handler
|
|
60
|
-
from simtools.simtel.
|
|
57
|
+
from simtools.simtel.simtel_io_histograms import SimtelIOHistograms
|
|
61
58
|
|
|
62
59
|
|
|
63
60
|
def _parse(label, description):
|
|
64
61
|
"""
|
|
65
|
-
Parse command line configuration
|
|
62
|
+
Parse command line configuration.
|
|
66
63
|
|
|
67
64
|
Parameters
|
|
68
65
|
----------
|
|
@@ -105,88 +102,132 @@ def _parse(label, description):
|
|
|
105
102
|
)
|
|
106
103
|
|
|
107
104
|
config_parser, _ = config.initialize(db_config=False, paths=True)
|
|
108
|
-
if not config_parser["pdf"]:
|
|
109
|
-
|
|
110
|
-
config.parser.error("At least one argument is required: `--pdf` or `--hdf5`.")
|
|
105
|
+
if not config_parser["pdf"] and not config_parser["hdf5"]:
|
|
106
|
+
config.parser.error("At least one argument is required: --pdf or --hdf5.")
|
|
111
107
|
|
|
112
108
|
return config_parser
|
|
113
109
|
|
|
114
110
|
|
|
115
|
-
def
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
io_handler_instance = io_handler.IOHandler()
|
|
119
|
-
config_parser = _parse(label, description)
|
|
120
|
-
output_path = io_handler_instance.get_output_directory(label, sub_dir="application-plots")
|
|
121
|
-
logger = logging.getLogger()
|
|
122
|
-
logger.setLevel(gen.get_log_level_from_user(config_parser["log_level"]))
|
|
123
|
-
logger.info("Starting the application.")
|
|
111
|
+
def build_histogram_files(config_parser, logger):
|
|
112
|
+
"""
|
|
113
|
+
Build a list of histogram files from command line arguments.
|
|
124
114
|
|
|
125
|
-
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
config_parser: dict
|
|
118
|
+
Parsed command line arguments.
|
|
119
|
+
logger: logging.Logger
|
|
120
|
+
Logger object for logging messages.
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
-------
|
|
124
|
+
list
|
|
125
|
+
List of histogram file paths.
|
|
126
|
+
"""
|
|
126
127
|
histogram_files = []
|
|
127
128
|
for one_file in config_parser["hist_file_names"]:
|
|
128
129
|
try:
|
|
129
130
|
if Path(one_file).suffix in [".zst", ".simtel", ".hdata"]:
|
|
130
131
|
histogram_files.append(one_file)
|
|
131
132
|
else:
|
|
132
|
-
# Collecting hist files
|
|
133
133
|
with open(one_file, encoding="utf-8") as file:
|
|
134
134
|
for line in file:
|
|
135
|
-
|
|
136
|
-
histogram_files.append(line.replace("\n", ""))
|
|
135
|
+
histogram_files.append(line.strip())
|
|
137
136
|
except FileNotFoundError as exc:
|
|
138
137
|
msg = f"{one_file} is not a file."
|
|
139
138
|
logger.error(msg)
|
|
140
139
|
raise FileNotFoundError from exc
|
|
140
|
+
return histogram_files
|
|
141
141
|
|
|
142
|
-
# If no output name is passed, the tool gets the name of the first histogram of the list
|
|
143
|
-
if config_parser["output_file_name"] is None:
|
|
144
|
-
config_parser["output_file_name"] = Path(histogram_files[0]).absolute().name
|
|
145
|
-
output_file_name = Path(output_path).joinpath(f"{config_parser['output_file_name']}")
|
|
146
142
|
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
def check_and_log_overwrite(config_parser, logger):
|
|
144
|
+
"""
|
|
145
|
+
Check if the output hdf5 file already exists and log a warning if it does.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
config_parser: dict
|
|
150
|
+
Parsed command line arguments.
|
|
151
|
+
logger: logging.Logger
|
|
152
|
+
Logger object for logging messages.
|
|
153
|
+
|
|
154
|
+
Returns
|
|
155
|
+
-------
|
|
156
|
+
bool
|
|
157
|
+
True if the hdf5 file exists and should be overwritten, False otherwise.
|
|
158
|
+
"""
|
|
159
|
+
if Path(f"{config_parser['output_file_name']}.hdf5").exists() and config_parser["hdf5"]:
|
|
149
160
|
msg = (
|
|
150
161
|
f"Output hdf5 file {config_parser['output_file_name']}.hdf5 already exists. "
|
|
151
162
|
f"Overwriting it."
|
|
152
163
|
)
|
|
153
164
|
logger.warning(msg)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
overwrite = False
|
|
165
|
+
return True
|
|
166
|
+
return False
|
|
157
167
|
|
|
158
|
-
# Building SimtelHistograms
|
|
159
|
-
simtel_histograms = SimtelHistograms(histogram_files)
|
|
160
168
|
|
|
169
|
+
def create_pdf(simtel_histograms, output_file_name, config_parser, logger):
|
|
170
|
+
"""
|
|
171
|
+
Create a PDF file containing histograms.
|
|
172
|
+
|
|
173
|
+
Parameters
|
|
174
|
+
----------
|
|
175
|
+
simtel_histograms: SimtelIOHistograms
|
|
176
|
+
SimtelIOHistograms object containing histograms to plot.
|
|
177
|
+
output_file_name: str
|
|
178
|
+
Base name for the output PDF file.
|
|
179
|
+
config_parser: dict
|
|
180
|
+
Parsed command line arguments.
|
|
181
|
+
logger: logging.Logger
|
|
182
|
+
Logger object for logging messages.
|
|
183
|
+
"""
|
|
161
184
|
if config_parser["pdf"]:
|
|
162
185
|
logger.debug(f"Creating the pdf file {output_file_name}.pdf")
|
|
163
186
|
pdf_pages = PdfPages(f"{output_file_name}.pdf")
|
|
164
|
-
|
|
165
|
-
if config_parser["test"]:
|
|
166
|
-
number_of_histograms = 2
|
|
167
|
-
else:
|
|
168
|
-
number_of_histograms = simtel_histograms.number_of_histograms
|
|
169
|
-
|
|
187
|
+
number_of_histograms = 2 if config_parser["test"] else len(simtel_histograms.combined_hists)
|
|
170
188
|
for i_hist in range(number_of_histograms):
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
logger.debug(f"Processing: {title}")
|
|
174
|
-
|
|
189
|
+
logger.debug(f"Processing: {i_hist + 1} histogram.")
|
|
175
190
|
fig, ax = plt.subplots(1, 1, figsize=(6, 6))
|
|
176
191
|
simtel_histograms.plot_one_histogram(i_hist, ax)
|
|
177
|
-
|
|
178
192
|
plt.tight_layout()
|
|
179
193
|
pdf_pages.savefig(fig)
|
|
180
194
|
plt.clf()
|
|
181
|
-
|
|
182
195
|
plt.close()
|
|
183
196
|
pdf_pages.close()
|
|
184
197
|
logger.info(f"Wrote histograms to the pdf file {output_file_name}.pdf")
|
|
185
198
|
|
|
199
|
+
|
|
200
|
+
def export_to_hdf5(simtel_histograms, output_file_name, overwrite, config_parser, logger):
|
|
201
|
+
"""Export histograms to an HDF5 file."""
|
|
186
202
|
if config_parser["hdf5"]:
|
|
187
203
|
logger.info(f"Wrote histograms to the hdf5 file {output_file_name}.hdf5")
|
|
188
204
|
simtel_histograms.export_histograms(f"{output_file_name}.hdf5", overwrite=overwrite)
|
|
189
205
|
|
|
190
206
|
|
|
207
|
+
def main(): # noqa: D103
|
|
208
|
+
label = Path(__file__).stem
|
|
209
|
+
description = "Display the simtel_array histograms."
|
|
210
|
+
io_handler_instance = io_handler.IOHandler()
|
|
211
|
+
config_parser = _parse(label, description)
|
|
212
|
+
output_path = io_handler_instance.get_output_directory(label, sub_dir="application-plots")
|
|
213
|
+
logger = logging.getLogger()
|
|
214
|
+
logger.setLevel(gen.get_log_level_from_user(config_parser["log_level"]))
|
|
215
|
+
logger.info("Starting the application.")
|
|
216
|
+
|
|
217
|
+
histogram_files = build_histogram_files(config_parser, logger)
|
|
218
|
+
|
|
219
|
+
# If no output name is passed, the tool gets the name of the first histogram of the list
|
|
220
|
+
if config_parser["output_file_name"] is None:
|
|
221
|
+
config_parser["output_file_name"] = Path(histogram_files[0]).absolute().name
|
|
222
|
+
output_file_name = Path(output_path).joinpath(f"{config_parser['output_file_name']}")
|
|
223
|
+
|
|
224
|
+
# If the hdf5 output file already exists, it is overwritten
|
|
225
|
+
overwrite = check_and_log_overwrite(config_parser, logger)
|
|
226
|
+
|
|
227
|
+
simtel_histograms = SimtelIOHistograms(histogram_files)
|
|
228
|
+
create_pdf(simtel_histograms, output_file_name, config_parser, logger)
|
|
229
|
+
export_to_hdf5(simtel_histograms, output_file_name, overwrite, config_parser, logger)
|
|
230
|
+
|
|
231
|
+
|
|
191
232
|
if __name__ == "__main__":
|
|
192
233
|
main()
|