gammasimtools 0.18.0__py3-none-any.whl → 0.19.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/METADATA +26 -69
- gammasimtools-0.19.0.dist-info/RECORD +393 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/entry_points.txt +9 -2
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +16 -3
- simtools/applications/calculate_trigger_rate.py +1 -1
- simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- simtools/applications/db_add_value_from_json_to_db.py +2 -1
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
- simtools/applications/db_generate_compound_indexes.py +61 -0
- simtools/applications/db_get_file_from_db.py +1 -1
- simtools/applications/db_get_parameter_from_db.py +4 -4
- simtools/applications/db_inspect_databases.py +20 -10
- simtools/applications/derive_mirror_rnda.py +17 -11
- simtools/applications/derive_psf_parameters.py +59 -309
- simtools/applications/docs_produce_array_element_report.py +1 -1
- simtools/applications/docs_produce_calibration_reports.py +1 -1
- simtools/applications/docs_produce_model_parameter_reports.py +1 -1
- simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
- simtools/applications/generate_corsika_histograms.py +1 -1
- simtools/applications/generate_default_metadata.py +8 -24
- simtools/applications/generate_sim_telarray_histograms.py +1 -1
- simtools/applications/generate_simtel_event_data.py +11 -11
- simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
- simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
- simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
- simtools/applications/merge_tables.py +2 -2
- simtools/applications/plot_array_layout.py +3 -3
- simtools/applications/plot_simtel_events.py +379 -0
- simtools/applications/plot_tabular_data.py +9 -2
- simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
- simtools/applications/print_version.py +8 -9
- simtools/applications/production_derive_corsika_limits.py +6 -7
- simtools/applications/production_derive_statistics.py +1 -1
- simtools/applications/production_generate_grid.py +2 -2
- simtools/applications/production_merge_corsika_limits.py +214 -0
- simtools/applications/run_application.py +47 -113
- simtools/applications/simulate_calibration_events.py +166 -0
- simtools/applications/simulate_flasher.py +141 -0
- simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
- simtools/applications/simulate_prod.py +6 -24
- simtools/applications/simulate_prod_htcondor_generator.py +7 -0
- simtools/applications/submit_array_layouts.py +2 -1
- simtools/applications/submit_model_parameter_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +30 -12
- simtools/applications/validate_camera_fov.py +1 -1
- simtools/applications/validate_cumulative_psf.py +1 -1
- simtools/applications/validate_file_using_schema.py +2 -1
- simtools/applications/validate_optics.py +1 -1
- simtools/camera/camera_efficiency.py +61 -45
- simtools/camera/single_photon_electron_spectrum.py +1 -1
- simtools/configuration/commandline_parser.py +29 -0
- simtools/configuration/configurator.py +4 -4
- simtools/corsika/corsika_config.py +45 -25
- simtools/corsika/corsika_histograms.py +6 -5
- simtools/data_model/data_reader.py +2 -3
- simtools/data_model/metadata_collector.py +32 -36
- simtools/data_model/metadata_model.py +15 -12
- simtools/data_model/model_data_writer.py +13 -32
- simtools/data_model/schema.py +74 -24
- simtools/data_model/validate_data.py +34 -9
- simtools/db/db_handler.py +43 -37
- simtools/db/db_model_upload.py +3 -3
- simtools/dependencies.py +88 -25
- simtools/io/ascii_handler.py +279 -0
- simtools/{io_operations → io}/io_handler.py +25 -3
- simtools/job_execution/htcondor_script_generator.py +15 -4
- simtools/layout/array_layout.py +1 -1
- simtools/layout/array_layout_utils.py +14 -7
- simtools/model/array_model.py +23 -4
- simtools/model/flasher_model.py +106 -0
- simtools/model/model_parameter.py +4 -4
- simtools/model/model_repository.py +197 -2
- simtools/model/telescope_model.py +3 -1
- simtools/production_configuration/derive_corsika_limits.py +361 -427
- simtools/production_configuration/derive_production_statistics_handler.py +7 -6
- simtools/production_configuration/generate_production_grid.py +9 -11
- simtools/production_configuration/merge_corsika_limits.py +528 -0
- simtools/ray_tracing/mirror_panel_psf.py +1 -0
- simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
- simtools/ray_tracing/ray_tracing.py +6 -2
- simtools/reporting/docs_read_parameters.py +150 -62
- simtools/runners/corsika_runner.py +1 -1
- simtools/runners/corsika_simtel_runner.py +14 -5
- simtools/runners/runner_services.py +10 -5
- simtools/runners/simtools_runner.py +267 -0
- simtools/schemas/application_workflow.metaschema.yml +101 -68
- simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
- simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
- simtools/schemas/metadata.metaschema.yml +577 -3
- simtools/schemas/model_parameter.metaschema.yml +6 -6
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +2 -2
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/array_window.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/stars.schema.yml +1 -1
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/schemas/plot_configuration.metaschema.yml +5 -2
- simtools/schemas/production_configuration_metrics.schema.yml +12 -2
- simtools/schemas/production_tables.schema.yml +2 -2
- simtools/simtel/simtel_config_reader.py +2 -2
- simtools/simtel/simtel_config_writer.py +16 -4
- simtools/simtel/simtel_io_event_histograms.py +746 -0
- simtools/simtel/simtel_io_event_reader.py +15 -42
- simtools/simtel/simtel_io_event_writer.py +9 -9
- simtools/simtel/simtel_io_histogram.py +3 -1
- simtools/simtel/simtel_io_histograms.py +7 -3
- simtools/simtel/simtel_table_reader.py +92 -10
- simtools/simtel/simulator_array.py +138 -10
- simtools/simtel/simulator_camera_efficiency.py +32 -23
- simtools/simtel/simulator_light_emission.py +437 -271
- simtools/simtel/simulator_ray_tracing.py +1 -1
- simtools/simulator.py +105 -147
- simtools/testing/configuration.py +24 -26
- simtools/testing/helpers.py +2 -2
- simtools/testing/log_inspector.py +50 -0
- simtools/testing/validate_output.py +87 -37
- simtools/utils/general.py +125 -255
- simtools/utils/geometry.py +36 -0
- simtools/utils/names.py +1 -1
- simtools/visualization/legend_handlers.py +180 -264
- simtools/visualization/plot_array_layout.py +20 -8
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_tables.py +133 -37
- simtools/visualization/simtel_event_plots.py +816 -0
- simtools/visualization/visualize.py +4 -101
- gammasimtools-0.18.0.dist-info/RECORD +0 -376
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/top_level.txt +0 -0
- /simtools/{io_operations → io}/hdf5_handler.py +0 -0
- /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
- /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
|
@@ -5,11 +5,11 @@ from dataclasses import dataclass, field
|
|
|
5
5
|
|
|
6
6
|
import astropy.units as u
|
|
7
7
|
import numpy as np
|
|
8
|
-
from astropy.coordinates import
|
|
9
|
-
from ctapipe.coordinates import GroundFrame, TiltedGroundFrame
|
|
8
|
+
from astropy.coordinates import angular_separation
|
|
10
9
|
|
|
11
10
|
from simtools.corsika.primary_particle import PrimaryParticle
|
|
12
|
-
from simtools.
|
|
11
|
+
from simtools.io import table_handler
|
|
12
|
+
from simtools.utils.geometry import transform_ground_to_shower_coordinates
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
@dataclass
|
|
@@ -71,7 +71,7 @@ class SimtelIOEventDataReader:
|
|
|
71
71
|
list
|
|
72
72
|
List of dictionaries containing the data from the tables.
|
|
73
73
|
"""
|
|
74
|
-
dataset_dict =
|
|
74
|
+
dataset_dict = table_handler.read_table_list(
|
|
75
75
|
event_data_file,
|
|
76
76
|
["SHOWERS", "TRIGGERS", "FILE_INFO"],
|
|
77
77
|
include_indexed_tables=True,
|
|
@@ -110,16 +110,17 @@ class SimtelIOEventDataReader:
|
|
|
110
110
|
if table[col].unit:
|
|
111
111
|
setattr(shower_data, f"{col}_unit", table[col].unit)
|
|
112
112
|
|
|
113
|
-
shower_data.x_core_shower, shower_data.y_core_shower = (
|
|
114
|
-
|
|
113
|
+
shower_data.x_core_shower, shower_data.y_core_shower, _ = (
|
|
114
|
+
transform_ground_to_shower_coordinates(
|
|
115
115
|
shower_data.x_core,
|
|
116
116
|
shower_data.y_core,
|
|
117
|
+
0.0,
|
|
117
118
|
shower_data.shower_azimuth,
|
|
118
119
|
shower_data.shower_altitude,
|
|
119
120
|
)
|
|
120
121
|
)
|
|
121
|
-
shower_data.core_distance_shower = np.
|
|
122
|
-
shower_data.x_core_shower
|
|
122
|
+
shower_data.core_distance_shower = np.hypot(
|
|
123
|
+
shower_data.x_core_shower, shower_data.y_core_shower
|
|
123
124
|
)
|
|
124
125
|
|
|
125
126
|
return shower_data
|
|
@@ -191,7 +192,7 @@ class SimtelIOEventDataReader:
|
|
|
191
192
|
& (shower_data.event_id == tr_event_id)
|
|
192
193
|
& (shower_data.file_id == tr_file_id)
|
|
193
194
|
)
|
|
194
|
-
matched_idx = np.
|
|
195
|
+
matched_idx = np.nonzero(mask)[0]
|
|
195
196
|
if len(matched_idx) == 1:
|
|
196
197
|
matched_indices.append(matched_idx[0])
|
|
197
198
|
else:
|
|
@@ -233,7 +234,7 @@ class SimtelIOEventDataReader:
|
|
|
233
234
|
def get_name(key):
|
|
234
235
|
return table_name_map.get(key, key)
|
|
235
236
|
|
|
236
|
-
tables =
|
|
237
|
+
tables = table_handler.read_tables(
|
|
237
238
|
event_data_file,
|
|
238
239
|
table_names=[get_name(k) for k in ("SHOWERS", "TRIGGERS", "FILE_INFO")],
|
|
239
240
|
)
|
|
@@ -249,10 +250,10 @@ class SimtelIOEventDataReader:
|
|
|
249
250
|
|
|
250
251
|
triggered_data.angular_distance = (
|
|
251
252
|
angular_separation(
|
|
252
|
-
triggered_shower.shower_azimuth * u.
|
|
253
|
-
triggered_shower.shower_altitude * u.
|
|
254
|
-
triggered_data.array_azimuth * u.
|
|
255
|
-
triggered_data.array_altitude * u.
|
|
253
|
+
triggered_shower.shower_azimuth * u.deg,
|
|
254
|
+
triggered_shower.shower_altitude * u.deg,
|
|
255
|
+
triggered_data.array_azimuth * u.deg,
|
|
256
|
+
triggered_data.array_altitude * u.deg,
|
|
256
257
|
)
|
|
257
258
|
.to(u.deg)
|
|
258
259
|
.value
|
|
@@ -298,34 +299,6 @@ class SimtelIOEventDataReader:
|
|
|
298
299
|
|
|
299
300
|
return filtered_triggered_data, filtered_triggered_shower_data
|
|
300
301
|
|
|
301
|
-
def _transform_to_shower_coordinates(self, x_core, y_core, shower_azimuth, shower_altitude):
|
|
302
|
-
"""
|
|
303
|
-
Transform core positions from ground coordinates to shower coordinates.
|
|
304
|
-
|
|
305
|
-
Parameters
|
|
306
|
-
----------
|
|
307
|
-
x_core : np.ndarray
|
|
308
|
-
Core x positions in ground coordinates.
|
|
309
|
-
y_core : np.ndarray
|
|
310
|
-
Core y positions in ground coordinates.
|
|
311
|
-
shower_azimuth : np.ndarray
|
|
312
|
-
Shower azimuth angles.
|
|
313
|
-
shower_altitude : np.ndarray
|
|
314
|
-
Shower altitude angles.
|
|
315
|
-
|
|
316
|
-
Returns
|
|
317
|
-
-------
|
|
318
|
-
tuple
|
|
319
|
-
Core positions in shower coordinates (x, y).
|
|
320
|
-
"""
|
|
321
|
-
ground = GroundFrame(x=x_core * u.m, y=y_core * u.m, z=np.zeros_like(x_core) * u.m)
|
|
322
|
-
shower_frame = ground.transform_to(
|
|
323
|
-
TiltedGroundFrame(
|
|
324
|
-
pointing_direction=AltAz(az=shower_azimuth * u.rad, alt=shower_altitude * u.rad)
|
|
325
|
-
)
|
|
326
|
-
)
|
|
327
|
-
return shower_frame.x.value, shower_frame.y.value
|
|
328
|
-
|
|
329
302
|
def get_reduced_simulation_file_info(self, simulation_file_info):
|
|
330
303
|
"""
|
|
331
304
|
Return reduced simulation file info assuming single-valued parameters.
|
|
@@ -36,8 +36,8 @@ class TableSchemas:
|
|
|
36
36
|
"simulated_energy": (np.float64, u.TeV),
|
|
37
37
|
"x_core": (np.float64, u.m),
|
|
38
38
|
"y_core": (np.float64, u.m),
|
|
39
|
-
"shower_azimuth": (np.float64, u.
|
|
40
|
-
"shower_altitude": (np.float64, u.
|
|
39
|
+
"shower_azimuth": (np.float64, u.deg),
|
|
40
|
+
"shower_altitude": (np.float64, u.deg),
|
|
41
41
|
"area_weight": (np.float64, None),
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -45,8 +45,8 @@ class TableSchemas:
|
|
|
45
45
|
"shower_id": (np.uint32, None),
|
|
46
46
|
"event_id": (np.uint32, None),
|
|
47
47
|
"file_id": (np.uint32, None),
|
|
48
|
-
"array_altitude": (np.float64, u.
|
|
49
|
-
"array_azimuth": (np.float64, u.
|
|
48
|
+
"array_altitude": (np.float64, u.deg),
|
|
49
|
+
"array_azimuth": (np.float64, u.deg),
|
|
50
50
|
"telescope_list": (str, None), # Store as comma-separated string
|
|
51
51
|
"telescope_list_common_id": (str, None), # Store as comma-separated string
|
|
52
52
|
}
|
|
@@ -196,8 +196,8 @@ class SimtelIOEventDataWriter:
|
|
|
196
196
|
"simulated_energy": shower["energy"],
|
|
197
197
|
"x_core": None, # filled in _process_mc_event
|
|
198
198
|
"y_core": None, # filled in _process_mc_event
|
|
199
|
-
"shower_azimuth": shower["azimuth"],
|
|
200
|
-
"shower_altitude": shower["altitude"],
|
|
199
|
+
"shower_azimuth": np.degrees(shower["azimuth"]),
|
|
200
|
+
"shower_altitude": np.degrees(shower["altitude"]),
|
|
201
201
|
"area_weight": None, # filled in _process_mc_event
|
|
202
202
|
}
|
|
203
203
|
for _ in range(self.n_use)
|
|
@@ -247,8 +247,8 @@ class SimtelIOEventDataWriter:
|
|
|
247
247
|
tracking_position = obj.parse()
|
|
248
248
|
tracking_positions.append(
|
|
249
249
|
{
|
|
250
|
-
"altitude": tracking_position["altitude_raw"],
|
|
251
|
-
"azimuth": tracking_position["azimuth_raw"],
|
|
250
|
+
"altitude": np.degrees(tracking_position["altitude_raw"]),
|
|
251
|
+
"azimuth": np.degrees(tracking_position["azimuth_raw"]),
|
|
252
252
|
}
|
|
253
253
|
)
|
|
254
254
|
|
|
@@ -271,7 +271,7 @@ class SimtelIOEventDataWriter:
|
|
|
271
271
|
"event_id": event_id,
|
|
272
272
|
"file_id": file_id,
|
|
273
273
|
"array_altitude": float(np.mean(altitudes)),
|
|
274
|
-
"array_azimuth": float(calculate_circular_mean(azimuths)),
|
|
274
|
+
"array_azimuth": float(np.degrees(calculate_circular_mean(np.deg2rad(azimuths)))),
|
|
275
275
|
"telescope_list": ",".join(map(str, telescopes)),
|
|
276
276
|
"telescope_list_common_id": ",".join(
|
|
277
277
|
[
|
|
@@ -177,7 +177,7 @@ class SimtelIOHistogram:
|
|
|
177
177
|
histograms = {hist["id"]: hist for hist in self.histogram if hist["id"] in {1, 2}}
|
|
178
178
|
if 1 in histograms and 2 in histograms:
|
|
179
179
|
return histograms[1], histograms[2]
|
|
180
|
-
self._logger.error("Histograms ids not found. Please check
|
|
180
|
+
self._logger.error("Histograms ids not found. Please check files.")
|
|
181
181
|
raise HistogramIdNotFoundError
|
|
182
182
|
|
|
183
183
|
def _set_view_cone(self, view_cone):
|
|
@@ -560,6 +560,8 @@ class SimtelIOHistogram:
|
|
|
560
560
|
self.energy_range[0],
|
|
561
561
|
self.energy_range[1],
|
|
562
562
|
)
|
|
563
|
+
if first_estimate == 0:
|
|
564
|
+
return 0.0 * u.s
|
|
563
565
|
if stacked_num_simulated_events is None:
|
|
564
566
|
_simulated_events, _ = self.total_number_of_events
|
|
565
567
|
return (_simulated_events / first_estimate) * u.s
|
|
@@ -9,7 +9,7 @@ from eventio import EventIOFile, Histograms
|
|
|
9
9
|
from eventio.search_utils import yield_toplevel_of_type
|
|
10
10
|
|
|
11
11
|
from simtools import version
|
|
12
|
-
from simtools.
|
|
12
|
+
from simtools.io.hdf5_handler import fill_hdf5_table
|
|
13
13
|
from simtools.simtel.simtel_io_histogram import (
|
|
14
14
|
HistogramIdNotFoundError,
|
|
15
15
|
InconsistentHistogramFormatError,
|
|
@@ -159,7 +159,7 @@ class SimtelIOHistograms:
|
|
|
159
159
|
if sim_hist is None or trig_hist is None:
|
|
160
160
|
msg = (
|
|
161
161
|
"Simulated and triggered histograms were not found in the stacked histograms."
|
|
162
|
-
" Please check
|
|
162
|
+
" Please check sim_telarray files!"
|
|
163
163
|
)
|
|
164
164
|
self._logger.error(msg)
|
|
165
165
|
raise HistogramIdNotFoundError
|
|
@@ -285,7 +285,11 @@ class SimtelIOHistograms:
|
|
|
285
285
|
f"Estimated equivalent observation time corresponding to the number of "
|
|
286
286
|
f"events simulated: {obs_time.value} s"
|
|
287
287
|
)
|
|
288
|
-
|
|
288
|
+
if obs_time != 0:
|
|
289
|
+
sim_event_rate = _simulated_events / obs_time
|
|
290
|
+
else:
|
|
291
|
+
sim_event_rate = 0.0 * obs_time.unit
|
|
292
|
+
logging.warning("Observation time is zero, cannot calculate event rate.")
|
|
289
293
|
sim_event_rates.append(sim_event_rate)
|
|
290
294
|
logging.info(f"Simulated event rate: {sim_event_rate.value:.4e} Hz")
|
|
291
295
|
|
|
@@ -6,9 +6,10 @@ import re
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
8
|
import astropy.units as u
|
|
9
|
+
import numpy as np
|
|
9
10
|
from astropy.table import Table
|
|
10
11
|
|
|
11
|
-
from simtools.
|
|
12
|
+
from simtools.io import ascii_handler
|
|
12
13
|
|
|
13
14
|
logger = logging.getLogger(__name__)
|
|
14
15
|
|
|
@@ -132,11 +133,6 @@ def _data_columns_camera_filter():
|
|
|
132
133
|
)
|
|
133
134
|
|
|
134
135
|
|
|
135
|
-
def _data_columns_lightguide_efficiency_vs_wavelength():
|
|
136
|
-
"""Column description for parameter lightguide_efficiency_vs_wavelength."""
|
|
137
|
-
return _data_columns_lightguide_efficiency_vs_incidence_angle()
|
|
138
|
-
|
|
139
|
-
|
|
140
136
|
def _data_columns_lightguide_efficiency_vs_incidence_angle():
|
|
141
137
|
"""Column description for (parameter lightguide_efficiency_vs_incidence_angle."""
|
|
142
138
|
return (
|
|
@@ -201,6 +197,16 @@ def _data_columns_mirror_reflectivity(n_columns, n_dim):
|
|
|
201
197
|
return _columns, "Mirror reflectivity"
|
|
202
198
|
|
|
203
199
|
|
|
200
|
+
def _data_columns_secondary_mirror_reflectivity():
|
|
201
|
+
"""Column description for secondary mirror reflectivity."""
|
|
202
|
+
columns = [
|
|
203
|
+
{"name": "wavelength", "description": "Wavelength", "unit": "nm"},
|
|
204
|
+
{"name": "reflectivity", "description": "Reflectivity", "unit": None},
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
return columns, "Secondary mirror reflectivity vs wavelength"
|
|
208
|
+
|
|
209
|
+
|
|
204
210
|
def _data_columns_pulse_shape(n_columns):
|
|
205
211
|
"""Column description for parameters discriminator_pulse_shape, fadc_pulse_shape."""
|
|
206
212
|
_columns = [
|
|
@@ -259,6 +265,8 @@ def read_simtel_table(parameter_name, file_path):
|
|
|
259
265
|
|
|
260
266
|
if parameter_name == "atmospheric_transmission":
|
|
261
267
|
return _read_simtel_data_for_atmospheric_transmission(file_path)
|
|
268
|
+
if parameter_name == "lightguide_efficiency_vs_wavelength":
|
|
269
|
+
return _read_simtel_data_for_lightguide_efficiency(file_path)
|
|
262
270
|
|
|
263
271
|
rows, meta_from_simtel, n_columns, n_dim = _read_simtel_data(file_path)
|
|
264
272
|
columns_info, description = _data_columns(parameter_name, n_columns, n_dim)
|
|
@@ -291,6 +299,17 @@ def _adjust_columns_length(rows, n_columns):
|
|
|
291
299
|
return [row[:n_columns] + [0.0] * max(0, n_columns - len(row)) for row in rows]
|
|
292
300
|
|
|
293
301
|
|
|
302
|
+
def _process_line_parts(parts):
|
|
303
|
+
"""Convert parts to floats, skipping non-float entries."""
|
|
304
|
+
row = []
|
|
305
|
+
for p in parts:
|
|
306
|
+
try:
|
|
307
|
+
row.append(float(p))
|
|
308
|
+
except ValueError:
|
|
309
|
+
logger.debug(f"Skipping non-float part: {p}")
|
|
310
|
+
return row
|
|
311
|
+
|
|
312
|
+
|
|
294
313
|
def _read_simtel_data(file_path):
|
|
295
314
|
"""
|
|
296
315
|
Read data, comments, and (if available) axis definition from sim_telarray table.
|
|
@@ -311,7 +330,7 @@ def _read_simtel_data(file_path):
|
|
|
311
330
|
n_dim_axis = None
|
|
312
331
|
r_pol_axis = None
|
|
313
332
|
|
|
314
|
-
lines =
|
|
333
|
+
lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
|
|
315
334
|
|
|
316
335
|
for line in lines:
|
|
317
336
|
stripped = line.strip()
|
|
@@ -326,12 +345,75 @@ def _read_simtel_data(file_path):
|
|
|
326
345
|
elif stripped: # Data
|
|
327
346
|
data_lines.append(stripped.split("%%%")[0].split("#")[0].strip()) # Remove comments
|
|
328
347
|
|
|
329
|
-
rows = [
|
|
348
|
+
rows = [_process_line_parts(line.split()) for line in data_lines]
|
|
330
349
|
n_columns = max(len(row) for row in rows) if rows else 0
|
|
331
350
|
|
|
332
351
|
return rows, "\n".join(meta_lines), n_columns, n_dim_axis
|
|
333
352
|
|
|
334
353
|
|
|
354
|
+
def _read_simtel_data_for_lightguide_efficiency(file_path):
|
|
355
|
+
"""
|
|
356
|
+
Read angular efficiency data and return a table with columns: angle, wavelength, efficiency.
|
|
357
|
+
|
|
358
|
+
Parameters
|
|
359
|
+
----------
|
|
360
|
+
file_path : str or Path
|
|
361
|
+
|
|
362
|
+
Returns
|
|
363
|
+
-------
|
|
364
|
+
astropy.table.Table
|
|
365
|
+
"""
|
|
366
|
+
wavelengths = []
|
|
367
|
+
data = []
|
|
368
|
+
meta_lines = []
|
|
369
|
+
|
|
370
|
+
lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
|
|
371
|
+
|
|
372
|
+
def extract_wavelengths_from_header(line):
|
|
373
|
+
match = re.search(r"orig\.:\s*(.*)", line)
|
|
374
|
+
return [float(wl.replace("nm", "")) for wl in match.group(1).split()]
|
|
375
|
+
|
|
376
|
+
for line in lines:
|
|
377
|
+
line = line.strip()
|
|
378
|
+
|
|
379
|
+
if not line:
|
|
380
|
+
continue
|
|
381
|
+
|
|
382
|
+
if line.startswith("#"):
|
|
383
|
+
meta_lines.append(line.lstrip("#").strip())
|
|
384
|
+
if "orig.:" in line:
|
|
385
|
+
wavelengths = extract_wavelengths_from_header(line)
|
|
386
|
+
continue
|
|
387
|
+
|
|
388
|
+
parts = line.split()
|
|
389
|
+
try:
|
|
390
|
+
theta = float(parts[0])
|
|
391
|
+
eff_values = list(map(float, parts[-len(wavelengths) :]))
|
|
392
|
+
data.extend((theta, wl, eff) for wl, eff in zip(wavelengths, eff_values))
|
|
393
|
+
except (ValueError, IndexError):
|
|
394
|
+
logger.debug(f"Skipping malformed line: {line}")
|
|
395
|
+
continue
|
|
396
|
+
|
|
397
|
+
if not data or not wavelengths:
|
|
398
|
+
raise ValueError("No valid data or wavelengths found in file")
|
|
399
|
+
|
|
400
|
+
table = Table(rows=data, names=["angle", "wavelength", "efficiency"])
|
|
401
|
+
table["angle"].unit = u.deg
|
|
402
|
+
table["wavelength"].unit = u.nm
|
|
403
|
+
table["efficiency"].unit = u.dimensionless_unscaled
|
|
404
|
+
|
|
405
|
+
table.meta.update(
|
|
406
|
+
{
|
|
407
|
+
"Name": "angular_efficiency",
|
|
408
|
+
"File": str(file_path),
|
|
409
|
+
"Description": "Angular efficiency vs wavelength",
|
|
410
|
+
"Context_from_sim_telarray": "\n".join(meta_lines),
|
|
411
|
+
}
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
return table
|
|
415
|
+
|
|
416
|
+
|
|
335
417
|
def _read_simtel_data_for_atmospheric_transmission(file_path):
|
|
336
418
|
"""
|
|
337
419
|
Read data and comments from sim_telarray table for atmospheric_transmission.
|
|
@@ -346,7 +428,7 @@ def _read_simtel_data_for_atmospheric_transmission(file_path):
|
|
|
346
428
|
astropy table
|
|
347
429
|
Table with atmospheric transmission.
|
|
348
430
|
"""
|
|
349
|
-
lines =
|
|
431
|
+
lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
|
|
350
432
|
|
|
351
433
|
observatory_level, height_bins = _read_header_line_for_atmospheric_transmission(
|
|
352
434
|
lines, file_path
|
|
@@ -366,7 +448,7 @@ def _read_simtel_data_for_atmospheric_transmission(file_path):
|
|
|
366
448
|
wl = float(parts[0])
|
|
367
449
|
for i, height in enumerate(height_bins):
|
|
368
450
|
extinction_value = float(parts[i + 1])
|
|
369
|
-
if extinction_value
|
|
451
|
+
if np.isclose(extinction_value, 99999.0):
|
|
370
452
|
continue
|
|
371
453
|
wavelengths.append(wl)
|
|
372
454
|
heights.append(height)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
from simtools.
|
|
5
|
+
from simtools.io import io_handler
|
|
6
6
|
from simtools.runners.simtel_runner import InvalidOutputFileError, SimtelRunner
|
|
7
7
|
from simtools.utils.general import clear_default_sim_telarray_cfg_directories
|
|
8
8
|
|
|
@@ -68,6 +68,73 @@ class SimulatorArray(SimtelRunner):
|
|
|
68
68
|
str
|
|
69
69
|
Command to run sim_telarray.
|
|
70
70
|
"""
|
|
71
|
+
command = self._common_run_command(run_number, weak_pointing)
|
|
72
|
+
|
|
73
|
+
command += f" {input_file}"
|
|
74
|
+
command += f" | gzip > {self._log_file} 2>&1 || exit"
|
|
75
|
+
command += super().get_config_option(
|
|
76
|
+
"power_law",
|
|
77
|
+
SimulatorArray.get_power_law_for_sim_telarray_histograms(
|
|
78
|
+
self.corsika_config.primary_particle
|
|
79
|
+
),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return clear_default_sim_telarray_cfg_directories(command)
|
|
83
|
+
|
|
84
|
+
def make_run_command_for_calibration_simulations(
|
|
85
|
+
self, run_number=None, input_file=None, calibration_runner_args=None
|
|
86
|
+
):
|
|
87
|
+
"""
|
|
88
|
+
Build and return the command to run sim_telarray for calibration simulations.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
calibration_runner_args: dict
|
|
93
|
+
Dictionary with calibration runner arguments.
|
|
94
|
+
input_file: str
|
|
95
|
+
Full path of the input CORSIKA file
|
|
96
|
+
run_number: int (optional)
|
|
97
|
+
run number
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
str
|
|
102
|
+
Command to run sim_telarray for pedestal simulations.
|
|
103
|
+
"""
|
|
104
|
+
command = self._common_run_command(run_number)
|
|
105
|
+
|
|
106
|
+
command += super().get_config_option(
|
|
107
|
+
"Altitude",
|
|
108
|
+
self.corsika_config.array_model.site_model.get_parameter_value_with_unit(
|
|
109
|
+
"reference_point_altitude"
|
|
110
|
+
).to_value("m"),
|
|
111
|
+
)
|
|
112
|
+
command += super().get_config_option(
|
|
113
|
+
"nsb_scaling_factor", calibration_runner_args["nsb_scaling_factor"]
|
|
114
|
+
)
|
|
115
|
+
if calibration_runner_args.get("stars"):
|
|
116
|
+
command += super().get_config_option("stars", calibration_runner_args["stars"])
|
|
117
|
+
|
|
118
|
+
if calibration_runner_args.get("run_mode") in ("pedestals", "nsb_only_pedestals"):
|
|
119
|
+
command += super().get_config_option(
|
|
120
|
+
"pedestal_events", calibration_runner_args["number_of_events"]
|
|
121
|
+
)
|
|
122
|
+
if calibration_runner_args.get("run_mode") == "nsb_only_pedestals":
|
|
123
|
+
command += self._nsb_only_pedestals_command()
|
|
124
|
+
if calibration_runner_args.get("run_mode") == "dark_pedestals":
|
|
125
|
+
command += super().get_config_option(
|
|
126
|
+
"dark_events", calibration_runner_args["number_of_events"]
|
|
127
|
+
)
|
|
128
|
+
if calibration_runner_args.get("run_mode") == "flasher":
|
|
129
|
+
command += self._flasher_command(calibration_runner_args)
|
|
130
|
+
|
|
131
|
+
command += f" {input_file}"
|
|
132
|
+
command += f" | gzip > {self._log_file} 2>&1 || exit"
|
|
133
|
+
|
|
134
|
+
return clear_default_sim_telarray_cfg_directories(command)
|
|
135
|
+
|
|
136
|
+
def _common_run_command(self, run_number, weak_pointing=None):
|
|
137
|
+
"""Build generic run command for sim_telarray."""
|
|
71
138
|
config_dir = self.corsika_config.array_model.get_config_directory()
|
|
72
139
|
self._log_file = self.get_file_name(file_type="log", run_number=run_number)
|
|
73
140
|
histogram_file = self.get_file_name(file_type="histogram", run_number=run_number)
|
|
@@ -83,12 +150,6 @@ class SimulatorArray(SimtelRunner):
|
|
|
83
150
|
command += super().get_config_option(
|
|
84
151
|
"telescope_phi", self.corsika_config.azimuth_angle, weak_pointing
|
|
85
152
|
)
|
|
86
|
-
command += super().get_config_option(
|
|
87
|
-
"power_law",
|
|
88
|
-
SimulatorArray.get_power_law_for_sim_telarray_histograms(
|
|
89
|
-
self.corsika_config.primary_particle
|
|
90
|
-
),
|
|
91
|
-
)
|
|
92
153
|
command += super().get_config_option("histogram_file", histogram_file)
|
|
93
154
|
command += super().get_config_option("random_state", "none")
|
|
94
155
|
if self.sim_telarray_seeds and self.sim_telarray_seeds.get("random_instrument_instances"):
|
|
@@ -100,10 +161,77 @@ class SimulatorArray(SimtelRunner):
|
|
|
100
161
|
command += super().get_config_option("random_seed", self.sim_telarray_seeds["seed"])
|
|
101
162
|
command += super().get_config_option("show", "all")
|
|
102
163
|
command += super().get_config_option("output_file", output_file)
|
|
103
|
-
command += f" {input_file}"
|
|
104
|
-
command += f" | gzip > {self._log_file} 2>&1 || exit"
|
|
105
164
|
|
|
106
|
-
return
|
|
165
|
+
return command
|
|
166
|
+
|
|
167
|
+
def _flasher_command(self, calibration_runner_args):
|
|
168
|
+
"""
|
|
169
|
+
Generate the command to run sim_telarray for flasher simulations.
|
|
170
|
+
|
|
171
|
+
Parameters
|
|
172
|
+
----------
|
|
173
|
+
calibration_runner_args: dict
|
|
174
|
+
Dictionary with calibration runner arguments.
|
|
175
|
+
|
|
176
|
+
Returns
|
|
177
|
+
-------
|
|
178
|
+
str
|
|
179
|
+
Command to run sim_telarray for flasher simulations.
|
|
180
|
+
"""
|
|
181
|
+
command = super().get_config_option(
|
|
182
|
+
"laser_events", calibration_runner_args["number_of_events"]
|
|
183
|
+
)
|
|
184
|
+
command += super().get_config_option(
|
|
185
|
+
"laser_photons", calibration_runner_args["flasher_photons"]
|
|
186
|
+
)
|
|
187
|
+
command += super().get_config_option(
|
|
188
|
+
"laser_var_photons", calibration_runner_args["flasher_var_photons"]
|
|
189
|
+
)
|
|
190
|
+
command += super().get_config_option(
|
|
191
|
+
"laser_pulse_exptime", calibration_runner_args["flasher_exp_time"]
|
|
192
|
+
)
|
|
193
|
+
command += super().get_config_option(
|
|
194
|
+
"laser_pulse_sigtime", calibration_runner_args["flasher_sig_time"]
|
|
195
|
+
)
|
|
196
|
+
command += super().get_config_option("laser_external_trigger", 1)
|
|
197
|
+
|
|
198
|
+
return command
|
|
199
|
+
|
|
200
|
+
def _nsb_only_pedestals_command(self):
|
|
201
|
+
"""
|
|
202
|
+
Generate the command to run sim_telarray for nsb-only pedestal simulations.
|
|
203
|
+
|
|
204
|
+
Returns
|
|
205
|
+
-------
|
|
206
|
+
str
|
|
207
|
+
Command to run sim_telarray.
|
|
208
|
+
"""
|
|
209
|
+
null_values = [
|
|
210
|
+
"fadc_noise",
|
|
211
|
+
"fadc_lg_noise",
|
|
212
|
+
"qe_variation",
|
|
213
|
+
"gain_variation",
|
|
214
|
+
"fadc_var_pedestal",
|
|
215
|
+
"fadc_err_pedestal",
|
|
216
|
+
"fadc_sysvar_pedestal",
|
|
217
|
+
"fadc_dev_pedestal",
|
|
218
|
+
]
|
|
219
|
+
null_command_parts = []
|
|
220
|
+
for param in null_values:
|
|
221
|
+
null_command_parts.append(super().get_config_option(param, 0.0))
|
|
222
|
+
command = " ".join(null_command_parts)
|
|
223
|
+
|
|
224
|
+
one_values = [
|
|
225
|
+
"fadc_lg_var_pedestal",
|
|
226
|
+
"fadc_lg_err_pedestal",
|
|
227
|
+
"fadc_lg_dev_pedestal",
|
|
228
|
+
"fadc_lg_sysvar_pedestal",
|
|
229
|
+
]
|
|
230
|
+
one_command_parts = []
|
|
231
|
+
for param in one_values:
|
|
232
|
+
one_command_parts.append(super().get_config_option(param, -1.0))
|
|
233
|
+
command += " " + " ".join(one_command_parts)
|
|
234
|
+
return command
|
|
107
235
|
|
|
108
236
|
def _check_run_result(self, run_number=None):
|
|
109
237
|
"""
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from simtools.
|
|
6
|
+
from simtools.io import ascii_handler
|
|
7
7
|
from simtools.runners.simtel_runner import SimtelRunner
|
|
8
8
|
from simtools.utils import general
|
|
9
9
|
|
|
@@ -82,41 +82,27 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
82
82
|
"""Prepare the command used to run testeff."""
|
|
83
83
|
self._logger.debug("Preparing the command to run testeff")
|
|
84
84
|
|
|
85
|
-
# Processing camera pixel features
|
|
86
85
|
pixel_shape = self._telescope_model.camera.get_pixel_shape()
|
|
87
86
|
pixel_shape_cmd = "-hpix" if pixel_shape in [1, 3] else "-spix"
|
|
88
87
|
pixel_diameter = self._telescope_model.camera.get_pixel_diameter()
|
|
89
88
|
|
|
90
|
-
# Processing focal length
|
|
91
89
|
focal_length = self._telescope_model.get_telescope_effective_focal_length("m", True)
|
|
92
90
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
except InvalidModelParameterError:
|
|
98
|
-
pass
|
|
99
|
-
|
|
100
|
-
# Processing camera transmission
|
|
101
|
-
camera_transmission = 1
|
|
102
|
-
try:
|
|
103
|
-
camera_transmission = self._telescope_model.get_parameter_value("camera_transmission")
|
|
104
|
-
except KeyError:
|
|
105
|
-
pass
|
|
106
|
-
|
|
107
|
-
# Processing camera filter
|
|
108
|
-
# A special case is testeff does not support 2D distributions
|
|
91
|
+
mirror_class = self._telescope_model.get_parameter_value("mirror_class")
|
|
92
|
+
curvature_radius = self._get_curvature_radius(mirror_class)
|
|
93
|
+
camera_transmission = self._telescope_model.get_parameter_value("camera_transmission")
|
|
94
|
+
|
|
109
95
|
camera_filter_file = self._telescope_model.get_parameter_value("camera_filter")
|
|
96
|
+
# testeff does not support 2D distributions
|
|
110
97
|
if self._telescope_model.is_file_2d("camera_filter"):
|
|
111
98
|
camera_filter_file = self._get_one_dim_distribution(
|
|
112
99
|
"camera_filter", "camera_filter_incidence_angle"
|
|
113
100
|
)
|
|
114
101
|
|
|
115
|
-
# Processing mirror reflectivity
|
|
116
|
-
# A special case is testeff does not support 2D distributions
|
|
117
102
|
mirror_reflectivity = self._telescope_model.get_parameter_value("mirror_reflectivity")
|
|
118
103
|
if mirror_class == 2:
|
|
119
104
|
mirror_reflectivity_secondary = mirror_reflectivity
|
|
105
|
+
# testeff does not support 2D distributions
|
|
120
106
|
if self._telescope_model.is_file_2d("mirror_reflectivity"):
|
|
121
107
|
mirror_reflectivity = self._get_one_dim_distribution(
|
|
122
108
|
"mirror_reflectivity", "primary_mirror_incidence_angle"
|
|
@@ -136,6 +122,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
136
122
|
command += f" -alt {self._site_model.get_parameter_value('corsika_observation_level')}"
|
|
137
123
|
command += f" -fatm {self._site_model.get_parameter_value('atmospheric_transmission')}"
|
|
138
124
|
command += f" -flen {focal_length}"
|
|
125
|
+
command += f" -fcur {curvature_radius:.3f}"
|
|
139
126
|
command += f" {pixel_shape_cmd} {pixel_diameter}"
|
|
140
127
|
if mirror_class == 0:
|
|
141
128
|
command += f" -fmir {self._telescope_model.get_parameter_value('mirror_list')}"
|
|
@@ -227,7 +214,8 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
227
214
|
two_dim_distribution, incidence_angle_distribution
|
|
228
215
|
)
|
|
229
216
|
new_file_name = (
|
|
230
|
-
f"weighted_average_1D_{
|
|
217
|
+
f"weighted_average_1D_{weighting_distribution_parameter}"
|
|
218
|
+
f"_{self._telescope_model.get_parameter_value(two_dim_parameter)}"
|
|
231
219
|
)
|
|
232
220
|
return self._telescope_model.export_table_to_model_directory(
|
|
233
221
|
new_file_name, distribution_to_export
|
|
@@ -257,7 +245,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
257
245
|
self._telescope_model.config_file_directory / Path(nsb_spectrum_file).name
|
|
258
246
|
)
|
|
259
247
|
|
|
260
|
-
lines =
|
|
248
|
+
lines = ascii_handler.read_file_encoded_in_utf_or_latin(nsb_spectrum_file)
|
|
261
249
|
|
|
262
250
|
with open(validated_nsb_spectrum_file, "w", encoding="utf-8") as file:
|
|
263
251
|
for line in lines:
|
|
@@ -271,3 +259,24 @@ class SimulatorCameraEfficiency(SimtelRunner):
|
|
|
271
259
|
else:
|
|
272
260
|
file.write(line)
|
|
273
261
|
return validated_nsb_spectrum_file
|
|
262
|
+
|
|
263
|
+
def _get_curvature_radius(self, mirror_class=1):
|
|
264
|
+
"""Get radius of curvature of dish."""
|
|
265
|
+
if mirror_class == 2:
|
|
266
|
+
return (
|
|
267
|
+
self._telescope_model.get_parameter_value_with_unit("primary_mirror_diameter")
|
|
268
|
+
.to("m")
|
|
269
|
+
.value
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
if self._telescope_model.get_parameter_value("parabolic_dish"):
|
|
273
|
+
return (
|
|
274
|
+
2.0
|
|
275
|
+
* self._telescope_model.get_parameter_value_with_unit("dish_shape_length")
|
|
276
|
+
.to("m")
|
|
277
|
+
.value
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
self._telescope_model.get_parameter_value_with_unit("dish_shape_length").to("m").value
|
|
282
|
+
)
|