gammasimtools 0.18.0__py3-none-any.whl → 0.20.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/METADATA +24 -69
- gammasimtools-0.20.0.dist-info/RECORD +395 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/entry_points.txt +11 -4
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +16 -3
- simtools/applications/calculate_incident_angles.py +182 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +17 -14
- simtools/applications/db_add_value_from_json_to_db.py +8 -10
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
- simtools/applications/db_generate_compound_indexes.py +65 -0
- simtools/applications/db_get_file_from_db.py +12 -24
- simtools/applications/db_get_parameter_from_db.py +4 -4
- simtools/applications/db_inspect_databases.py +20 -10
- simtools/applications/derive_mirror_rnda.py +17 -11
- simtools/applications/derive_psf_parameters.py +59 -309
- simtools/applications/derive_trigger_rates.py +91 -0
- simtools/applications/docs_produce_array_element_report.py +1 -1
- simtools/applications/docs_produce_calibration_reports.py +1 -1
- simtools/applications/docs_produce_model_parameter_reports.py +1 -1
- simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
- simtools/applications/generate_corsika_histograms.py +1 -1
- simtools/applications/generate_default_metadata.py +8 -24
- simtools/applications/generate_simtel_event_data.py +11 -11
- simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
- simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
- simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
- simtools/applications/merge_tables.py +2 -2
- simtools/applications/plot_array_layout.py +3 -3
- simtools/applications/plot_simtel_events.py +421 -0
- simtools/applications/plot_tabular_data.py +9 -2
- simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
- simtools/applications/print_version.py +8 -9
- simtools/applications/production_derive_corsika_limits.py +6 -7
- simtools/applications/production_derive_statistics.py +1 -1
- simtools/applications/production_generate_grid.py +2 -2
- simtools/applications/production_merge_corsika_limits.py +214 -0
- simtools/applications/run_application.py +47 -113
- simtools/applications/simulate_calibration_events.py +166 -0
- simtools/applications/simulate_flasher.py +141 -0
- simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
- simtools/applications/simulate_prod.py +6 -24
- simtools/applications/simulate_prod_htcondor_generator.py +7 -0
- simtools/applications/submit_array_layouts.py +2 -1
- simtools/applications/submit_model_parameter_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +30 -12
- simtools/applications/validate_camera_fov.py +1 -1
- simtools/applications/validate_cumulative_psf.py +1 -1
- simtools/applications/validate_file_using_schema.py +9 -5
- simtools/applications/validate_optics.py +1 -1
- simtools/camera/camera_efficiency.py +61 -45
- simtools/camera/single_photon_electron_spectrum.py +1 -1
- simtools/configuration/commandline_parser.py +46 -11
- simtools/configuration/configurator.py +4 -4
- simtools/corsika/corsika_config.py +45 -25
- simtools/corsika/corsika_histograms.py +6 -5
- simtools/data_model/data_reader.py +2 -3
- simtools/data_model/metadata_collector.py +32 -36
- simtools/data_model/metadata_model.py +15 -12
- simtools/data_model/model_data_writer.py +13 -32
- simtools/data_model/schema.py +74 -24
- simtools/data_model/validate_data.py +42 -12
- simtools/db/db_handler.py +125 -62
- simtools/db/db_model_upload.py +14 -19
- simtools/dependencies.py +98 -30
- simtools/io/ascii_handler.py +279 -0
- simtools/{io_operations → io}/io_handler.py +25 -3
- simtools/job_execution/htcondor_script_generator.py +15 -4
- simtools/layout/array_layout.py +1 -1
- simtools/layout/array_layout_utils.py +51 -12
- simtools/model/array_model.py +41 -5
- simtools/model/flasher_model.py +106 -0
- simtools/model/model_parameter.py +4 -4
- simtools/model/model_repository.py +197 -2
- simtools/model/site_model.py +25 -0
- simtools/model/telescope_model.py +3 -1
- simtools/production_configuration/derive_corsika_limits.py +336 -427
- simtools/production_configuration/derive_production_statistics_handler.py +7 -6
- simtools/production_configuration/generate_production_grid.py +9 -11
- simtools/production_configuration/merge_corsika_limits.py +528 -0
- simtools/ray_tracing/incident_angles.py +706 -0
- simtools/ray_tracing/mirror_panel_psf.py +1 -0
- simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
- simtools/ray_tracing/ray_tracing.py +6 -2
- simtools/reporting/docs_read_parameters.py +150 -62
- simtools/runners/corsika_runner.py +1 -1
- simtools/runners/corsika_simtel_runner.py +14 -5
- simtools/runners/runner_services.py +10 -5
- simtools/runners/simtools_runner.py +267 -0
- simtools/schemas/application_workflow.metaschema.yml +101 -68
- simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
- simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
- simtools/schemas/metadata.metaschema.yml +577 -3
- simtools/schemas/model_parameter.metaschema.yml +6 -6
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +4 -4
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/array_window.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +2 -2
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +23 -30
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/stars.schema.yml +2 -2
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/schemas/plot_configuration.metaschema.yml +5 -2
- simtools/schemas/production_configuration_metrics.schema.yml +12 -2
- simtools/schemas/production_tables.schema.yml +7 -2
- simtools/simtel/simtel_config_reader.py +2 -2
- simtools/simtel/simtel_config_writer.py +33 -23
- simtools/simtel/simtel_io_event_histograms.py +483 -0
- simtools/simtel/simtel_io_event_reader.py +65 -43
- simtools/simtel/simtel_io_event_writer.py +40 -20
- simtools/simtel/simtel_io_metadata.py +1 -1
- simtools/simtel/simtel_table_reader.py +95 -13
- simtools/simtel/simulator_array.py +138 -10
- simtools/simtel/simulator_camera_efficiency.py +32 -23
- simtools/simtel/simulator_light_emission.py +437 -271
- simtools/simtel/simulator_ray_tracing.py +1 -1
- simtools/simulator.py +105 -147
- simtools/telescope_trigger_rates.py +119 -0
- simtools/testing/configuration.py +24 -26
- simtools/testing/helpers.py +2 -2
- simtools/testing/log_inspector.py +52 -0
- simtools/testing/validate_output.py +87 -37
- simtools/utils/general.py +125 -255
- simtools/utils/geometry.py +56 -0
- simtools/utils/names.py +1 -1
- simtools/visualization/legend_handlers.py +180 -264
- simtools/visualization/plot_array_layout.py +20 -8
- simtools/visualization/plot_incident_angles.py +431 -0
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_simtel_event_histograms.py +376 -0
- simtools/visualization/plot_simtel_events.py +816 -0
- simtools/visualization/plot_tables.py +133 -37
- simtools/visualization/visualize.py +1 -100
- gammasimtools-0.18.0.dist-info/RECORD +0 -376
- simtools/applications/calculate_trigger_rate.py +0 -187
- simtools/applications/generate_sim_telarray_histograms.py +0 -196
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
- simtools/simtel/simtel_io_histogram.py +0 -621
- simtools/simtel/simtel_io_histograms.py +0 -552
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/top_level.txt +0 -0
- /simtools/{io_operations → io}/hdf5_handler.py +0 -0
- /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
- /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
|
@@ -1,621 +0,0 @@
|
|
|
1
|
-
"""Reads the content of either a single histogram or sim_telarray output file."""
|
|
2
|
-
|
|
3
|
-
import copy
|
|
4
|
-
import logging
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
import numpy as np
|
|
8
|
-
from astropy import units as u
|
|
9
|
-
from astropy.table import QTable
|
|
10
|
-
from ctao_cr_spectra.definitions import IRFDOC_PROTON_SPECTRUM
|
|
11
|
-
from ctao_cr_spectra.spectral import cone_solid_angle
|
|
12
|
-
from eventio import EventIOFile, Histograms
|
|
13
|
-
from eventio.search_utils import yield_toplevel_of_type
|
|
14
|
-
|
|
15
|
-
from simtools.simtel.simtel_io_file_info import get_corsika_run_header
|
|
16
|
-
|
|
17
|
-
__all__ = [
|
|
18
|
-
"HistogramIdNotFoundError",
|
|
19
|
-
"InconsistentHistogramFormatError",
|
|
20
|
-
"SimtelIOHistogram",
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class InconsistentHistogramFormatError(Exception):
|
|
25
|
-
"""Exception for bad histogram format."""
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class HistogramIdNotFoundError(Exception):
|
|
29
|
-
"""Exception for histogram ID not found."""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class SimtelIOHistogram:
|
|
33
|
-
"""
|
|
34
|
-
Reads and generates histograms from sim_telarray output.
|
|
35
|
-
|
|
36
|
-
Read the content of either a single histogram (.hdata, or .hdata.zst) or a single sim_telarray
|
|
37
|
-
output file (.simtel or .simtel.zst).
|
|
38
|
-
|
|
39
|
-
Parameters
|
|
40
|
-
----------
|
|
41
|
-
histogram_file: str
|
|
42
|
-
The histogram (.hdata.zst) or sim_telarray (.simtel.zst) file.
|
|
43
|
-
area_from_distribution: bool
|
|
44
|
-
If true, the area thrown (the area in which the simulated events are distributed)
|
|
45
|
-
in the trigger rate calculation is estimated based on the event distribution.
|
|
46
|
-
The expected shape of the distribution of events as function of the core distance is
|
|
47
|
-
triangular up to the maximum distance. The weighted mean radius of the triangular
|
|
48
|
-
distribution is 2/3 times the upper edge. Therefore, when using the
|
|
49
|
-
``area_from_distribution`` flag, the mean distance times 3/2, returns just the position of
|
|
50
|
-
the upper edge in the triangle distribution with little impact of the binning and little
|
|
51
|
-
dependence on the scatter area defined in the simulation. This is special useful when
|
|
52
|
-
calculating trigger rate for individual telescopes.
|
|
53
|
-
If false, the area thrown is estimated based on the maximum distance as given in
|
|
54
|
-
the simulation configuration.
|
|
55
|
-
energy_range: list
|
|
56
|
-
The energy range used in the simulation. It must be passed as a list of floats and the
|
|
57
|
-
energy must be in TeV.
|
|
58
|
-
This argument is only needed and used if histogram_file is a .hdata file, in which case the
|
|
59
|
-
energy range cannot be retrieved directly from the file.
|
|
60
|
-
view_cone: list
|
|
61
|
-
The view cone used in the simulation. It must be passed as a list of floats and the
|
|
62
|
-
view cone must be in deg.
|
|
63
|
-
This argument is only needed and used if histogram_file is a .hdata file, in which case the
|
|
64
|
-
view cone cannot be retrieved directly from the file.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
def __init__(
|
|
68
|
-
self, histogram_file, area_from_distribution=False, energy_range=None, view_cone=None
|
|
69
|
-
):
|
|
70
|
-
"""Initialize SimtelIOHistogram class."""
|
|
71
|
-
self._logger = logging.getLogger(__name__)
|
|
72
|
-
self.histogram_file = histogram_file
|
|
73
|
-
if not Path(histogram_file).exists():
|
|
74
|
-
msg = f"File {histogram_file} does not exist."
|
|
75
|
-
self._logger.error(msg)
|
|
76
|
-
raise FileNotFoundError
|
|
77
|
-
|
|
78
|
-
self._config = None
|
|
79
|
-
self._total_area = None
|
|
80
|
-
self._solid_angle = None
|
|
81
|
-
self._histogram = None
|
|
82
|
-
self._total_num_simulated_events = None
|
|
83
|
-
self._total_num_triggered_events = None
|
|
84
|
-
self._initialize_histogram()
|
|
85
|
-
self.trigger_rate = None
|
|
86
|
-
self.trigger_rate_uncertainty = None
|
|
87
|
-
self.trigger_rate_per_energy_bin = None
|
|
88
|
-
self.energy_axis = None
|
|
89
|
-
self.radius_axis = None
|
|
90
|
-
self.area_from_distribution = area_from_distribution
|
|
91
|
-
|
|
92
|
-
self._set_view_cone(view_cone)
|
|
93
|
-
self._set_energy_range(energy_range)
|
|
94
|
-
|
|
95
|
-
def _initialize_histogram(self):
|
|
96
|
-
"""
|
|
97
|
-
Initialize lists of histograms and files.
|
|
98
|
-
|
|
99
|
-
Returns
|
|
100
|
-
-------
|
|
101
|
-
list:
|
|
102
|
-
List of histograms.
|
|
103
|
-
"""
|
|
104
|
-
with EventIOFile(self.histogram_file) as f:
|
|
105
|
-
for obj in yield_toplevel_of_type(f, Histograms):
|
|
106
|
-
self.histogram = obj.parse()
|
|
107
|
-
|
|
108
|
-
@property
|
|
109
|
-
def number_of_histogram_types(self):
|
|
110
|
-
"""Return number of histograms."""
|
|
111
|
-
return len(self.histogram)
|
|
112
|
-
|
|
113
|
-
def get_histogram_type_title(self, histogram_index):
|
|
114
|
-
"""
|
|
115
|
-
Return the title of the histogram with index histogram_index.
|
|
116
|
-
|
|
117
|
-
Parameters
|
|
118
|
-
----------
|
|
119
|
-
histogram_index: int
|
|
120
|
-
Histogram index.
|
|
121
|
-
|
|
122
|
-
Returns
|
|
123
|
-
-------
|
|
124
|
-
str
|
|
125
|
-
Histogram title.
|
|
126
|
-
"""
|
|
127
|
-
return self.histogram[histogram_index]["title"]
|
|
128
|
-
|
|
129
|
-
@property
|
|
130
|
-
def config(self):
|
|
131
|
-
"""
|
|
132
|
-
Return information about the input parameters for the simulation.
|
|
133
|
-
|
|
134
|
-
If the file is a .hdata or .hdata.zst, config will be None.
|
|
135
|
-
|
|
136
|
-
Returns
|
|
137
|
-
-------
|
|
138
|
-
dict:
|
|
139
|
-
dictionary with information about the simulation
|
|
140
|
-
"""
|
|
141
|
-
return self._config if self._config else get_corsika_run_header(self.histogram_file)
|
|
142
|
-
|
|
143
|
-
@property
|
|
144
|
-
def total_number_of_events(self):
|
|
145
|
-
"""
|
|
146
|
-
Return the total number of simulated and triggered events in the histograms.
|
|
147
|
-
|
|
148
|
-
Returns
|
|
149
|
-
-------
|
|
150
|
-
int, int:
|
|
151
|
-
total number of simulated and triggered events.
|
|
152
|
-
"""
|
|
153
|
-
if self._total_num_simulated_events is None or self._total_num_triggered_events is None:
|
|
154
|
-
simulated_histogram, trigger_histogram = self.fill_event_histogram_dicts()
|
|
155
|
-
self._total_num_simulated_events = np.sum(simulated_histogram["data"])
|
|
156
|
-
self._total_num_triggered_events = np.sum(trigger_histogram["data"])
|
|
157
|
-
logging.debug(
|
|
158
|
-
"Number of total simulated / triggered events: "
|
|
159
|
-
f"{self._total_num_simulated_events} / {self._total_num_triggered_events}"
|
|
160
|
-
)
|
|
161
|
-
return self._total_num_simulated_events, self._total_num_triggered_events
|
|
162
|
-
|
|
163
|
-
def fill_event_histogram_dicts(self):
|
|
164
|
-
"""
|
|
165
|
-
Get data from the total simulated event and the triggered event histograms.
|
|
166
|
-
|
|
167
|
-
Returns
|
|
168
|
-
-------
|
|
169
|
-
tuple(dict, dict):
|
|
170
|
-
Information about the histograms with simulated and triggered events.
|
|
171
|
-
|
|
172
|
-
Raises
|
|
173
|
-
------
|
|
174
|
-
HistogramIdNotFoundError:
|
|
175
|
-
if histogram ids not found. Problem with the file.
|
|
176
|
-
"""
|
|
177
|
-
histograms = {hist["id"]: hist for hist in self.histogram if hist["id"] in {1, 2}}
|
|
178
|
-
if 1 in histograms and 2 in histograms:
|
|
179
|
-
return histograms[1], histograms[2]
|
|
180
|
-
self._logger.error("Histograms ids not found. Please check your files.")
|
|
181
|
-
raise HistogramIdNotFoundError
|
|
182
|
-
|
|
183
|
-
def _set_view_cone(self, view_cone):
|
|
184
|
-
"""
|
|
185
|
-
View cone used in the simulation.
|
|
186
|
-
|
|
187
|
-
Parameters
|
|
188
|
-
----------
|
|
189
|
-
view_cone: list
|
|
190
|
-
The view cone used in the simulation. It must be passed as a list of floats and the
|
|
191
|
-
view cone must be in deg (as in the CORSIKA configuration).
|
|
192
|
-
|
|
193
|
-
Raises
|
|
194
|
-
------
|
|
195
|
-
ValueError:
|
|
196
|
-
if input parameter is missing.
|
|
197
|
-
"""
|
|
198
|
-
if view_cone is None:
|
|
199
|
-
try:
|
|
200
|
-
self.view_cone = self.config["viewcone"] * u.deg
|
|
201
|
-
except TypeError as exc:
|
|
202
|
-
msg = (
|
|
203
|
-
"view_cone needs to be passed as argument (minimum and maximum of the "
|
|
204
|
-
"view cone radius in deg)."
|
|
205
|
-
)
|
|
206
|
-
self._logger.error(msg)
|
|
207
|
-
raise ValueError(msg) from exc
|
|
208
|
-
else:
|
|
209
|
-
if isinstance(view_cone, u.Quantity):
|
|
210
|
-
self.view_cone = view_cone.to(u.deg)
|
|
211
|
-
else:
|
|
212
|
-
self.view_cone = view_cone * u.deg
|
|
213
|
-
|
|
214
|
-
@property
|
|
215
|
-
def solid_angle(self):
|
|
216
|
-
"""
|
|
217
|
-
Solid angle corresponding to the view cone.
|
|
218
|
-
|
|
219
|
-
Returns
|
|
220
|
-
-------
|
|
221
|
-
astropy.Quantity[u.sr]:
|
|
222
|
-
Solid angle corresponding to the view cone.
|
|
223
|
-
"""
|
|
224
|
-
if self._solid_angle is None:
|
|
225
|
-
self._solid_angle = cone_solid_angle(self.view_cone[1]) - cone_solid_angle(
|
|
226
|
-
self.view_cone[0]
|
|
227
|
-
)
|
|
228
|
-
return self._solid_angle
|
|
229
|
-
|
|
230
|
-
@property
|
|
231
|
-
def total_area(self):
|
|
232
|
-
"""
|
|
233
|
-
Total area covered by the simulated events (original CORSIKA CSCAT), i.e., area thrown.
|
|
234
|
-
|
|
235
|
-
Returns
|
|
236
|
-
-------
|
|
237
|
-
astropy.Quantity[area]:
|
|
238
|
-
Total area covered on the ground covered by the simulation.
|
|
239
|
-
"""
|
|
240
|
-
if self._total_area is None:
|
|
241
|
-
events_histogram, _ = self.fill_event_histogram_dicts()
|
|
242
|
-
self._initialize_histogram_axes(events_histogram)
|
|
243
|
-
|
|
244
|
-
if self.area_from_distribution is True:
|
|
245
|
-
area_from_distribution_max_radius = 1.5 * np.average(
|
|
246
|
-
self.radius_axis[:-1], weights=np.sum(events_histogram["data"], axis=0)
|
|
247
|
-
)
|
|
248
|
-
self._total_area = (np.pi * (area_from_distribution_max_radius * u.m) ** 2).to(
|
|
249
|
-
u.cm**2
|
|
250
|
-
)
|
|
251
|
-
else:
|
|
252
|
-
# The max of the core range is always half the upper edge:
|
|
253
|
-
# self.radius_axis[-1]/2 is equal to self.config["core_range"][1]
|
|
254
|
-
self._total_area = (
|
|
255
|
-
np.pi * (((self.radius_axis[-1] / 2 - self.radius_axis[0]) * u.m).to(u.cm)) ** 2
|
|
256
|
-
)
|
|
257
|
-
return self._total_area
|
|
258
|
-
|
|
259
|
-
def _set_energy_range(self, energy_range):
|
|
260
|
-
"""
|
|
261
|
-
Set energy range to be used in the simulations.
|
|
262
|
-
|
|
263
|
-
Parameters
|
|
264
|
-
----------
|
|
265
|
-
energy_range: list
|
|
266
|
-
The energy range used in the simulation. It must be passed as a list of floats and the
|
|
267
|
-
energy must be in TeV.
|
|
268
|
-
|
|
269
|
-
Raises
|
|
270
|
-
------
|
|
271
|
-
ValueError:
|
|
272
|
-
if input parameter is missing.
|
|
273
|
-
"""
|
|
274
|
-
if energy_range is None:
|
|
275
|
-
try:
|
|
276
|
-
self.energy_range = [
|
|
277
|
-
self.config["E_range"][0] * u.TeV,
|
|
278
|
-
self.config["E_range"][1] * u.TeV,
|
|
279
|
-
]
|
|
280
|
-
except TypeError as exc: # E_range not in self.config
|
|
281
|
-
msg = (
|
|
282
|
-
"energy_range needs to be passed as argument (minimum and maximum"
|
|
283
|
-
" energies in TeV)."
|
|
284
|
-
)
|
|
285
|
-
self._logger.error(msg)
|
|
286
|
-
raise ValueError(msg) from exc
|
|
287
|
-
else:
|
|
288
|
-
if isinstance(energy_range, u.Quantity):
|
|
289
|
-
self.energy_range = energy_range.to(u.TeV)
|
|
290
|
-
else:
|
|
291
|
-
self.energy_range = energy_range * u.TeV
|
|
292
|
-
|
|
293
|
-
@staticmethod
|
|
294
|
-
def _produce_triggered_to_sim_fraction_hist(events_histogram, triggered_events_histogram):
|
|
295
|
-
"""
|
|
296
|
-
Produce a new histogram with the fraction of triggered events over the simulated events.
|
|
297
|
-
|
|
298
|
-
The dimension of the histogram is reduced, as the rates are summed for all the bins in
|
|
299
|
-
impact distance.
|
|
300
|
-
|
|
301
|
-
Parameters
|
|
302
|
-
----------
|
|
303
|
-
events_histogram:
|
|
304
|
-
A dictionary with "data" corresponding to a 2D histogram (impact distance x energy)
|
|
305
|
-
for the simulated events.
|
|
306
|
-
triggered_events_histogram:
|
|
307
|
-
A dictionary with "data" corresponding to a 2D histogram (impact distance x energy)
|
|
308
|
-
for the triggered events.
|
|
309
|
-
|
|
310
|
-
Returns
|
|
311
|
-
-------
|
|
312
|
-
event_ratio_histogram:
|
|
313
|
-
The new histogram with the fraction of triggered over simulated events.
|
|
314
|
-
"""
|
|
315
|
-
simulated_events_per_energy_bin = np.sum(events_histogram["data"], axis=1)
|
|
316
|
-
|
|
317
|
-
triggered_events_per_energy_bin = np.sum(triggered_events_histogram["data"], axis=1)
|
|
318
|
-
ratio_per_energy_bin = np.zeros_like(triggered_events_per_energy_bin, dtype=float)
|
|
319
|
-
|
|
320
|
-
non_zero_indices = np.nonzero(simulated_events_per_energy_bin)[0]
|
|
321
|
-
ratio_per_energy_bin[non_zero_indices] = (
|
|
322
|
-
triggered_events_per_energy_bin[non_zero_indices]
|
|
323
|
-
/ simulated_events_per_energy_bin[non_zero_indices]
|
|
324
|
-
)
|
|
325
|
-
return ratio_per_energy_bin
|
|
326
|
-
|
|
327
|
-
def compute_system_trigger_rate(self, events_histogram=None, triggered_events_histogram=None):
|
|
328
|
-
"""
|
|
329
|
-
Compute the system trigger rate and its uncertainty, which are saved as class attributes.
|
|
330
|
-
|
|
331
|
-
If events_histogram and triggered_events_histogram are passed, they are used to calculate
|
|
332
|
-
the trigger rate and trigger rate uncertainty, instead of the histograms from the file.
|
|
333
|
-
This is specially useful when calculating the trigger rate for stacked files, in which case
|
|
334
|
-
one can pass the histograms resulted from stacking the files to this function.
|
|
335
|
-
Default is filling from the file.
|
|
336
|
-
|
|
337
|
-
Parameters
|
|
338
|
-
----------
|
|
339
|
-
events_histogram:
|
|
340
|
-
A dictionary with "data" corresponding to a 2D histogram (core distance x energy)
|
|
341
|
-
for the simulated events.
|
|
342
|
-
triggered_events_histogram:
|
|
343
|
-
A dictionary with "data" corresponding to a 2D histogram (core distance x energy)
|
|
344
|
-
for the triggered events.
|
|
345
|
-
"""
|
|
346
|
-
if self.trigger_rate is None:
|
|
347
|
-
# Get the simulated and triggered 2D histograms from the sim_telarray output file
|
|
348
|
-
if events_histogram is None and triggered_events_histogram is None:
|
|
349
|
-
events_histogram, triggered_events_histogram = self.fill_event_histogram_dicts()
|
|
350
|
-
# Calculate triggered/simulated event 1D histogram (energy dependent)
|
|
351
|
-
triggered_to_sim_fraction_hist = self._produce_triggered_to_sim_fraction_hist(
|
|
352
|
-
events_histogram, triggered_events_histogram
|
|
353
|
-
)
|
|
354
|
-
self._initialize_histogram_axes(triggered_events_histogram)
|
|
355
|
-
|
|
356
|
-
# Getting the particle distribution function according to the reference
|
|
357
|
-
particle_distribution_function = self.get_particle_distribution_function(
|
|
358
|
-
label="reference"
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
# Integrating the flux between the consecutive energy bins. The result given in
|
|
362
|
-
# cm-2s-1sr-1
|
|
363
|
-
flux_per_energy_bin = self._integrate_in_energy_bin(
|
|
364
|
-
particle_distribution_function, self.energy_axis
|
|
365
|
-
)
|
|
366
|
-
|
|
367
|
-
# Derive the trigger rate per energy bin
|
|
368
|
-
self.trigger_rate_per_energy_bin = (
|
|
369
|
-
triggered_to_sim_fraction_hist
|
|
370
|
-
* flux_per_energy_bin
|
|
371
|
-
* self.total_area
|
|
372
|
-
* self.solid_angle
|
|
373
|
-
).decompose()
|
|
374
|
-
|
|
375
|
-
# Derive the system trigger rate
|
|
376
|
-
self.trigger_rate = np.sum(self.trigger_rate_per_energy_bin)
|
|
377
|
-
|
|
378
|
-
# Derive the uncertainty in the system trigger rate estimate
|
|
379
|
-
self.trigger_rate_uncertainty = self.estimate_trigger_rate_uncertainty(
|
|
380
|
-
self.trigger_rate,
|
|
381
|
-
np.sum(events_histogram["data"]),
|
|
382
|
-
np.sum(triggered_events_histogram["data"]),
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
return self.trigger_rate, self.trigger_rate_uncertainty
|
|
386
|
-
|
|
387
|
-
def trigger_info_in_table(self):
|
|
388
|
-
"""
|
|
389
|
-
Provide the trigger rate per energy bin in tabulated form.
|
|
390
|
-
|
|
391
|
-
Returns
|
|
392
|
-
-------
|
|
393
|
-
astropy.QTable:
|
|
394
|
-
The QTable instance with the trigger rate per energy bin.
|
|
395
|
-
"""
|
|
396
|
-
meta = self.produce_trigger_meta_data()
|
|
397
|
-
return QTable(
|
|
398
|
-
[self.energy_axis[:-1] * u.TeV, (self.trigger_rate_per_energy_bin.to(u.Hz))],
|
|
399
|
-
names=("Energy (TeV)", "Trigger rate (Hz)"),
|
|
400
|
-
meta=meta,
|
|
401
|
-
)
|
|
402
|
-
|
|
403
|
-
def produce_trigger_meta_data(self):
|
|
404
|
-
"""
|
|
405
|
-
Produce the meta data to include in the tabulated form of the trigger rate per energy bin.
|
|
406
|
-
|
|
407
|
-
It shows some information from the input file (sim_telarray file) and the final estimate
|
|
408
|
-
system trigger rate.
|
|
409
|
-
|
|
410
|
-
Returns
|
|
411
|
-
-------
|
|
412
|
-
dict:
|
|
413
|
-
dictionary with the metadata.
|
|
414
|
-
"""
|
|
415
|
-
return {
|
|
416
|
-
"sim_telarray_file": self.histogram_file,
|
|
417
|
-
"simulation_input": self.print_info(mode="silent"),
|
|
418
|
-
"system_trigger_rate (Hz)": self.trigger_rate.value,
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
def _integrate_in_energy_bin(self, particle_distribution_function, energy_axis):
|
|
422
|
-
"""
|
|
423
|
-
Integrate the particle distribution.
|
|
424
|
-
|
|
425
|
-
The function integrates between the consecutive energy bins given by the energy_axis array.
|
|
426
|
-
|
|
427
|
-
Parameters
|
|
428
|
-
----------
|
|
429
|
-
particle_distribution_function: ctao_cr_spectra.spectral.PowerLaw
|
|
430
|
-
The function describing the spectral distribution.
|
|
431
|
-
energy_axis: numpy.array
|
|
432
|
-
The array with the simulated particle energies.
|
|
433
|
-
|
|
434
|
-
Returns
|
|
435
|
-
-------
|
|
436
|
-
astropy.Quantity:
|
|
437
|
-
astropy.Quantity of a numpy array with the energy integrated flux.
|
|
438
|
-
"""
|
|
439
|
-
unit = None
|
|
440
|
-
flux_per_energy_bin = []
|
|
441
|
-
for i_energy, _ in enumerate(energy_axis[:-1]):
|
|
442
|
-
integrated_flux = particle_distribution_function.integrate_energy(
|
|
443
|
-
energy_axis[i_energy] * u.TeV, energy_axis[i_energy + 1] * u.TeV
|
|
444
|
-
).decompose(bases=[u.s, u.cm, u.sr])
|
|
445
|
-
if unit is None:
|
|
446
|
-
unit = integrated_flux.unit
|
|
447
|
-
|
|
448
|
-
flux_per_energy_bin.append(integrated_flux.value)
|
|
449
|
-
|
|
450
|
-
return np.array(flux_per_energy_bin) * unit
|
|
451
|
-
|
|
452
|
-
def _initialize_histogram_axes(self, events_histogram):
|
|
453
|
-
"""
|
|
454
|
-
Initialize the two axes of a histogram.
|
|
455
|
-
|
|
456
|
-
The two axes are: the array with the edges of the bins in core
|
|
457
|
-
distance and the edges of the array with the energy bins.
|
|
458
|
-
|
|
459
|
-
Parameters
|
|
460
|
-
----------
|
|
461
|
-
events_histogram:
|
|
462
|
-
A single histogram from where to extract axis information.
|
|
463
|
-
"""
|
|
464
|
-
self.radius_axis = np.linspace(
|
|
465
|
-
events_histogram["lower_x"],
|
|
466
|
-
events_histogram["upper_x"],
|
|
467
|
-
events_histogram["n_bins_x"] + 1,
|
|
468
|
-
endpoint=True,
|
|
469
|
-
)
|
|
470
|
-
|
|
471
|
-
self.energy_axis = np.logspace(
|
|
472
|
-
events_histogram["lower_y"],
|
|
473
|
-
events_histogram["upper_y"],
|
|
474
|
-
events_histogram["n_bins_y"] + 1,
|
|
475
|
-
endpoint=True,
|
|
476
|
-
)
|
|
477
|
-
|
|
478
|
-
def get_particle_distribution_function(self, label="reference"):
|
|
479
|
-
"""
|
|
480
|
-
Get the particle distribution function.
|
|
481
|
-
|
|
482
|
-
This depends on whether one wants the reference CR distribution or the distribution
|
|
483
|
-
used in the simulation. This is controlled by label.
|
|
484
|
-
By using label="reference", one gets the distribution function according to a pre-defined CR
|
|
485
|
-
distribution, while by using label="simulation", the spectral index of the distribution
|
|
486
|
-
function from the simulation is used. The label="simulation" works only when the
|
|
487
|
-
input file is a .simtel file and not a .hdata file.
|
|
488
|
-
|
|
489
|
-
Parameters
|
|
490
|
-
----------
|
|
491
|
-
label: str
|
|
492
|
-
label defining which distribution function. Possible values are: "reference", or
|
|
493
|
-
"simulation".
|
|
494
|
-
|
|
495
|
-
Returns
|
|
496
|
-
-------
|
|
497
|
-
ctao_cr_spectra.spectral.PowerLaw
|
|
498
|
-
The function describing the spectral distribution.
|
|
499
|
-
"""
|
|
500
|
-
if label == "reference":
|
|
501
|
-
particle_distribution_function = copy.copy(IRFDOC_PROTON_SPECTRUM)
|
|
502
|
-
elif label == "simulation":
|
|
503
|
-
particle_distribution_function = self._get_simulation_spectral_distribution_function()
|
|
504
|
-
else:
|
|
505
|
-
msg = f"label {label} is not valid. Please use either 'reference' or 'simulation'."
|
|
506
|
-
self._logger.error(msg)
|
|
507
|
-
raise ValueError(msg)
|
|
508
|
-
return particle_distribution_function
|
|
509
|
-
|
|
510
|
-
def _get_simulation_spectral_distribution_function(self):
|
|
511
|
-
"""
|
|
512
|
-
Get the simulation particle energy distribution according to its configuration.
|
|
513
|
-
|
|
514
|
-
Returns
|
|
515
|
-
-------
|
|
516
|
-
ctao_cr_spectra.spectral.PowerLaw
|
|
517
|
-
The function describing the spectral distribution.
|
|
518
|
-
|
|
519
|
-
Raises
|
|
520
|
-
------
|
|
521
|
-
ValueError:
|
|
522
|
-
if input parameter is missing.
|
|
523
|
-
"""
|
|
524
|
-
spectral_distribution = copy.copy(IRFDOC_PROTON_SPECTRUM)
|
|
525
|
-
try:
|
|
526
|
-
spectral_distribution.index = self.config["spectral_index"]
|
|
527
|
-
except TypeError as exc:
|
|
528
|
-
msg = (
|
|
529
|
-
"spectral_index not found in the configuration of the file. "
|
|
530
|
-
"Consider using a .simtel file instead."
|
|
531
|
-
)
|
|
532
|
-
self._logger.error(msg)
|
|
533
|
-
raise ValueError(msg) from exc
|
|
534
|
-
return spectral_distribution
|
|
535
|
-
|
|
536
|
-
def estimate_observation_time(self, stacked_num_simulated_events=None):
|
|
537
|
-
"""
|
|
538
|
-
Estimates the observation time corresponding to the simulated number of events.
|
|
539
|
-
|
|
540
|
-
It uses the CTAO reference cosmic-ray spectra, the total number of particles simulated,
|
|
541
|
-
and other information from the simulation configuration self.config.
|
|
542
|
-
If stacked_num_simulated_events is given, the observation time is estimated from it instead
|
|
543
|
-
of from the simulation configuration (useful for the stacked trigger rate estimate).
|
|
544
|
-
|
|
545
|
-
Parameters
|
|
546
|
-
----------
|
|
547
|
-
stacked_num_simulated_events: int
|
|
548
|
-
total number of simulated events for the stacked dataset.
|
|
549
|
-
|
|
550
|
-
Returns
|
|
551
|
-
-------
|
|
552
|
-
astropy.Quantity[time]
|
|
553
|
-
Estimated observation time based on the total number of particles simulated.
|
|
554
|
-
"""
|
|
555
|
-
first_estimate = IRFDOC_PROTON_SPECTRUM.compute_number_events(
|
|
556
|
-
self.view_cone[0],
|
|
557
|
-
self.view_cone[1],
|
|
558
|
-
1 * u.s,
|
|
559
|
-
self.total_area,
|
|
560
|
-
self.energy_range[0],
|
|
561
|
-
self.energy_range[1],
|
|
562
|
-
)
|
|
563
|
-
if stacked_num_simulated_events is None:
|
|
564
|
-
_simulated_events, _ = self.total_number_of_events
|
|
565
|
-
return (_simulated_events / first_estimate) * u.s
|
|
566
|
-
return (stacked_num_simulated_events / first_estimate) * u.s
|
|
567
|
-
|
|
568
|
-
def estimate_trigger_rate_uncertainty(
|
|
569
|
-
self, trigger_rate_estimate, num_simulated_events, num_triggered_events
|
|
570
|
-
):
|
|
571
|
-
"""
|
|
572
|
-
Estimate the trigger rate uncertainty.
|
|
573
|
-
|
|
574
|
-
The calculation is based on the number of simulated and triggered events.
|
|
575
|
-
Poisson statistics are assumed. The uncertainty is calculated based on propagation
|
|
576
|
-
of the individual uncertainties.
|
|
577
|
-
If stacked_num_simulated_events is passed, the uncertainty is estimated based on it instead
|
|
578
|
-
of based on the total number of trigger events from the simulation configuration
|
|
579
|
-
(useful for the stacked trigger rate estimate).
|
|
580
|
-
|
|
581
|
-
Parameters
|
|
582
|
-
----------
|
|
583
|
-
trigger_rate_estimate: astropy.Quantity[1/time]
|
|
584
|
-
The already estimated the trigger rate.
|
|
585
|
-
num_simulated_events: int
|
|
586
|
-
Total number of simulated events.
|
|
587
|
-
num_triggered_events: int
|
|
588
|
-
Total number of triggered events.
|
|
589
|
-
|
|
590
|
-
Returns
|
|
591
|
-
-------
|
|
592
|
-
astropy.Quantity[1/time]
|
|
593
|
-
Uncertainty in the trigger rate estimate.
|
|
594
|
-
"""
|
|
595
|
-
# pylint: disable=E1101
|
|
596
|
-
return (
|
|
597
|
-
trigger_rate_estimate.value
|
|
598
|
-
* np.sqrt(1 / num_triggered_events + 1 / num_simulated_events)
|
|
599
|
-
) * trigger_rate_estimate.unit
|
|
600
|
-
|
|
601
|
-
def print_info(self, mode=None):
|
|
602
|
-
"""
|
|
603
|
-
Print information on the geometry and input parameters.
|
|
604
|
-
|
|
605
|
-
Returns
|
|
606
|
-
-------
|
|
607
|
-
dict:
|
|
608
|
-
Dictionary with the information, e.g., view angle, energy range, etc.
|
|
609
|
-
"""
|
|
610
|
-
_simulated, _triggered = self.total_number_of_events
|
|
611
|
-
info_dict = {
|
|
612
|
-
"view_cone": self.view_cone,
|
|
613
|
-
"solid_angle": self.solid_angle,
|
|
614
|
-
"total_area": self.total_area,
|
|
615
|
-
"energy_range": self.energy_range,
|
|
616
|
-
"total_num_simulated_events": _simulated,
|
|
617
|
-
"total_num_triggered_events": _triggered,
|
|
618
|
-
}
|
|
619
|
-
if mode != "silent":
|
|
620
|
-
print(info_dict)
|
|
621
|
-
return info_dict
|