gammasimtools 0.20.0__py3-none-any.whl → 0.22.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.20.0.dist-info → gammasimtools-0.22.0.dist-info}/METADATA +2 -3
- {gammasimtools-0.20.0.dist-info → gammasimtools-0.22.0.dist-info}/RECORD +313 -296
- {gammasimtools-0.20.0.dist-info → gammasimtools-0.22.0.dist-info}/entry_points.txt +3 -2
- simtools/_version.py +2 -2
- simtools/applications/calculate_incident_angles.py +1 -4
- simtools/applications/convert_all_model_parameters_from_simtel.py +1 -2
- simtools/applications/convert_model_parameter_from_simtel.py +0 -1
- simtools/applications/db_generate_compound_indexes.py +4 -17
- simtools/applications/db_upload_model_repository.py +122 -0
- simtools/applications/derive_psf_parameters.py +71 -42
- 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 +8 -185
- simtools/applications/maintain_simulation_model_add_production.py +81 -0
- simtools/applications/merge_tables.py +1 -1
- simtools/applications/plot_array_layout.py +1 -2
- simtools/applications/plot_simtel_events.py +2 -228
- simtools/applications/print_version.py +8 -7
- simtools/applications/production_derive_statistics.py +1 -2
- simtools/applications/production_generate_grid.py +1 -1
- simtools/applications/simulate_flasher.py +74 -72
- simtools/applications/simulate_illuminator.py +52 -186
- simtools/applications/{simulate_calibration_events.py → simulate_pedestals.py} +9 -55
- simtools/applications/submit_model_parameter_from_external.py +0 -1
- simtools/applications/validate_camera_efficiency.py +0 -1
- simtools/applications/validate_camera_fov.py +1 -2
- simtools/applications/validate_cumulative_psf.py +2 -3
- simtools/applications/validate_file_using_schema.py +20 -12
- simtools/applications/validate_optics.py +2 -2
- simtools/camera/camera_efficiency.py +8 -11
- simtools/configuration/commandline_parser.py +1 -7
- simtools/configuration/configurator.py +0 -2
- simtools/corsika/corsika_config.py +9 -11
- simtools/corsika/corsika_histograms.py +82 -1
- simtools/data_model/model_data_writer.py +87 -25
- simtools/data_model/schema.py +61 -2
- simtools/data_model/validate_data.py +1 -1
- simtools/db/db_handler.py +103 -48
- simtools/db/db_model_upload.py +247 -16
- simtools/io/io_handler.py +31 -83
- simtools/job_execution/job_manager.py +45 -0
- simtools/layout/array_layout_utils.py +1 -5
- simtools/model/array_model.py +93 -42
- simtools/model/model_parameter.py +20 -9
- simtools/model/model_repository.py +197 -109
- simtools/model/model_utils.py +21 -6
- simtools/model/telescope_model.py +20 -0
- simtools/production_configuration/derive_corsika_limits.py +1 -1
- simtools/ray_tracing/incident_angles.py +7 -7
- simtools/ray_tracing/mirror_panel_psf.py +1 -1
- simtools/ray_tracing/psf_parameter_optimisation.py +1106 -565
- simtools/ray_tracing/ray_tracing.py +1 -3
- simtools/reporting/docs_read_parameters.py +171 -101
- simtools/resources/array_elements.yml +26 -0
- simtools/runners/corsika_simtel_runner.py +11 -17
- simtools/runners/runner_services.py +5 -6
- simtools/runners/simtools_runner.py +0 -2
- simtools/schemas/application_workflow.metaschema.yml +1 -1
- simtools/schemas/common_definitions.schema.yml +39 -0
- simtools/schemas/model_parameter.metaschema.yml +19 -13
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -12
- simtools/schemas/model_parameters/adjust_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +0 -5
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +0 -7
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +0 -7
- simtools/schemas/model_parameters/array_layouts.schema.yml +0 -5
- simtools/schemas/model_parameters/array_triggers.schema.yml +0 -5
- simtools/schemas/model_parameters/array_window.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/asum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_shaping.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +0 -5
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +0 -5
- simtools/schemas/model_parameters/axes_offsets.schema.yml +0 -7
- simtools/schemas/model_parameters/calibration_devices.schema.yml +30 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_file.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_depth.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/camera_pixels.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +0 -7
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +0 -7
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +0 -5
- simtools/schemas/model_parameters/dark_events.schema.yml +4 -3
- simtools/schemas/model_parameters/default_trigger.schema.yml +0 -7
- simtools/schemas/model_parameters/design_model.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_start.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -9
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +0 -5
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -5
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -12
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -3
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/epsg_code.schema.yml +0 -5
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +0 -3
- simtools/schemas/model_parameters/flasher_angular_distribution.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_angular_distribution_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_bunch_size.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_external_trigger.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/flasher_position.schema.yml +43 -0
- simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +29 -0
- simtools/schemas/model_parameters/flasher_pulse_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +30 -0
- simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_type.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_var_photons.schema.yml +31 -0
- simtools/schemas/model_parameters/flasher_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/focus_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/gain_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +2 -7
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/laser_events.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +4 -3
- simtools/schemas/model_parameters/led_events.schema.yml +4 -3
- simtools/schemas/model_parameters/led_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/led_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photons.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_class.schema.yml +2 -9
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_list.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +0 -7
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +0 -3
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/num_gains.schema.yml +0 -7
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +0 -7
- simtools/schemas/model_parameters/optics_properties.schema.yml +0 -7
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +0 -3
- simtools/schemas/model_parameters/pedestal_events.schema.yml +4 -7
- simtools/schemas/model_parameters/photon_delay.schema.yml +0 -7
- simtools/schemas/model_parameters/photons_per_run.schema.yml +4 -4
- simtools/schemas/model_parameters/pixel_cells.schema.yml +0 -3
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +0 -3
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -9
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/qe_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -7
- simtools/schemas/model_parameters/random_generator.schema.yml +0 -7
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +0 -7
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +0 -5
- simtools/schemas/model_parameters/sampled_output.schema.yml +0 -7
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/stars.schema.yml +0 -5
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +0 -7
- simtools/schemas/production_tables.schema.yml +8 -8
- simtools/schemas/simulation_models_info.schema.yml +78 -0
- simtools/simtel/simtel_config_writer.py +88 -14
- simtools/simtel/simulator_array.py +44 -74
- simtools/simtel/simulator_light_emission.py +336 -629
- simtools/simtel/simulator_ray_tracing.py +2 -2
- simtools/simulator.py +46 -18
- simtools/testing/configuration.py +4 -2
- simtools/testing/sim_telarray_metadata.py +4 -4
- simtools/utils/geometry.py +34 -0
- simtools/version.py +111 -0
- simtools/{corsika/corsika_histograms_visualize.py → visualization/plot_corsika_histograms.py} +109 -0
- simtools/visualization/plot_psf.py +775 -0
- simtools/visualization/plot_simtel_events.py +284 -87
- simtools/applications/maintain_simulation_model_add_production_table.py +0 -71
- simtools/model/flasher_model.py +0 -106
- {gammasimtools-0.20.0.dist-info → gammasimtools-0.22.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.20.0.dist-info → gammasimtools-0.22.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.20.0.dist-info → gammasimtools-0.22.0.dist-info}/top_level.txt +0 -0
|
@@ -61,7 +61,7 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
61
61
|
self.label = label if label is not None else self.telescope_model.label
|
|
62
62
|
|
|
63
63
|
self.io_handler = io_handler.IOHandler()
|
|
64
|
-
self._base_directory = self.io_handler.get_output_directory(
|
|
64
|
+
self._base_directory = self.io_handler.get_output_directory()
|
|
65
65
|
|
|
66
66
|
self.config = (
|
|
67
67
|
self._config_to_namedtuple(config_data)
|
|
@@ -146,7 +146,7 @@ class SimulatorRayTracing(SimtelRunner):
|
|
|
146
146
|
|
|
147
147
|
The run_number and input_file parameters are not relevant for the ray tracing simulation.
|
|
148
148
|
"""
|
|
149
|
-
self.telescope_model.write_sim_telarray_config_file(
|
|
149
|
+
self.telescope_model.write_sim_telarray_config_file(additional_models=self.site_model)
|
|
150
150
|
|
|
151
151
|
if self.config.single_mirror_mode:
|
|
152
152
|
# Note: no mirror length defined for dual-mirror telescopes
|
simtools/simulator.py
CHANGED
|
@@ -8,6 +8,7 @@ from collections import defaultdict
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
|
+
from astropy import units as u
|
|
11
12
|
|
|
12
13
|
import simtools.utils.general as gen
|
|
13
14
|
from simtools.corsika.corsika_config import CorsikaConfig
|
|
@@ -19,6 +20,7 @@ from simtools.runners.corsika_simtel_runner import CorsikaSimtelRunner
|
|
|
19
20
|
from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
|
|
20
21
|
from simtools.simtel.simulator_array import SimulatorArray
|
|
21
22
|
from simtools.testing.sim_telarray_metadata import assert_sim_telarray_metadata
|
|
23
|
+
from simtools.version import semver_to_int
|
|
22
24
|
|
|
23
25
|
__all__ = [
|
|
24
26
|
"InvalidRunsToSimulateError",
|
|
@@ -67,8 +69,8 @@ class Simulator:
|
|
|
67
69
|
self.db_config = db_config
|
|
68
70
|
|
|
69
71
|
self.simulation_software = self.args_dict.get("simulation_software", "corsika_sim_telarray")
|
|
70
|
-
self.run_mode = self.args_dict.get("run_mode")
|
|
71
72
|
self.logger.debug(f"Init Simulator {self.simulation_software}")
|
|
73
|
+
self.run_mode = args_dict.get("run_mode", None)
|
|
72
74
|
|
|
73
75
|
self.io_handler = io_handler.IOHandler()
|
|
74
76
|
|
|
@@ -140,6 +142,9 @@ class Simulator:
|
|
|
140
142
|
"seed_file_name": self.sim_telarray_seeds["seed_file_name"],
|
|
141
143
|
},
|
|
142
144
|
simtel_path=self.args_dict.get("simtel_path", None),
|
|
145
|
+
calibration_device_types=self._get_calibration_device_types(
|
|
146
|
+
self.args_dict.get("run_mode")
|
|
147
|
+
),
|
|
143
148
|
)
|
|
144
149
|
for version in versions
|
|
145
150
|
]
|
|
@@ -163,14 +168,10 @@ class Simulator:
|
|
|
163
168
|
if seed:
|
|
164
169
|
return int(seed.split(",")[0].strip())
|
|
165
170
|
|
|
166
|
-
def semver_to_int(version: str):
|
|
167
|
-
major, minor, patch = map(int, version.split("."))
|
|
168
|
-
return major * 10000 + minor * 100 + patch
|
|
169
|
-
|
|
170
171
|
seed = semver_to_int(model_version) * 10000000
|
|
171
172
|
seed = seed + 1000000 if self.args_dict.get("site") != "North" else seed + 2000000
|
|
172
|
-
seed = seed + (int)(self.args_dict
|
|
173
|
-
return seed + (int)(self.args_dict
|
|
173
|
+
seed = seed + (int)(self.args_dict.get("zenith_angle", 0.0 * u.deg).value) * 1000
|
|
174
|
+
return seed + (int)(self.args_dict.get("azimuth_angle", 0.0 * u.deg).value)
|
|
174
175
|
|
|
175
176
|
def _initialize_run_list(self):
|
|
176
177
|
"""
|
|
@@ -260,7 +261,7 @@ class Simulator:
|
|
|
260
261
|
label=self.label,
|
|
261
262
|
args_dict=self.args_dict,
|
|
262
263
|
db_config=self.db_config,
|
|
263
|
-
dummy_simulations=self._is_calibration_run(),
|
|
264
|
+
dummy_simulations=self._is_calibration_run(self.run_mode),
|
|
264
265
|
)
|
|
265
266
|
)
|
|
266
267
|
return (
|
|
@@ -299,8 +300,9 @@ class Simulator:
|
|
|
299
300
|
runner_args["sim_telarray_seeds"] = self.sim_telarray_seeds
|
|
300
301
|
if runner_class is CorsikaSimtelRunner:
|
|
301
302
|
runner_args["sequential"] = self.args_dict.get("sequential", False)
|
|
302
|
-
|
|
303
|
-
|
|
303
|
+
runner_args["calibration_config"] = (
|
|
304
|
+
self.args_dict if self._is_calibration_run(self.run_mode) else None
|
|
305
|
+
)
|
|
304
306
|
|
|
305
307
|
return runner_class(**runner_args)
|
|
306
308
|
|
|
@@ -586,9 +588,7 @@ class Simulator:
|
|
|
586
588
|
def save_file_lists(self):
|
|
587
589
|
"""Save files lists for output and log files."""
|
|
588
590
|
for file_type in ["simtel_output", "log", "corsika_log", "hist"]:
|
|
589
|
-
file_name = self.io_handler.get_output_directory(
|
|
590
|
-
f"{file_type}_files.txt"
|
|
591
|
-
)
|
|
591
|
+
file_name = self.io_handler.get_output_directory().joinpath(f"{file_type}_files.txt")
|
|
592
592
|
file_list = self.get_file_list(file_type=file_type)
|
|
593
593
|
if all(element is not None for element in file_list) and len(file_list) > 0:
|
|
594
594
|
self.logger.info(f"Saving list of {file_type} files to {file_name}")
|
|
@@ -649,9 +649,7 @@ class Simulator:
|
|
|
649
649
|
directory_for_grid_upload = (
|
|
650
650
|
Path(directory_for_grid_upload)
|
|
651
651
|
if directory_for_grid_upload
|
|
652
|
-
else self.io_handler.get_output_directory(
|
|
653
|
-
"directory_for_grid_upload"
|
|
654
|
-
)
|
|
652
|
+
else self.io_handler.get_output_directory().joinpath("directory_for_grid_upload")
|
|
655
653
|
)
|
|
656
654
|
directory_for_grid_upload.mkdir(parents=True, exist_ok=True)
|
|
657
655
|
|
|
@@ -752,13 +750,43 @@ class Simulator:
|
|
|
752
750
|
|
|
753
751
|
corsika_log_files.append(str(new_log))
|
|
754
752
|
|
|
755
|
-
|
|
753
|
+
@staticmethod
|
|
754
|
+
def _is_calibration_run(run_mode):
|
|
756
755
|
"""
|
|
757
756
|
Check if this simulation is a calibration run.
|
|
758
757
|
|
|
758
|
+
Parameters
|
|
759
|
+
----------
|
|
760
|
+
run_mode: str
|
|
761
|
+
Run mode of the simulation.
|
|
762
|
+
|
|
759
763
|
Returns
|
|
760
764
|
-------
|
|
761
765
|
bool
|
|
762
766
|
True if it is a calibration run, False otherwise.
|
|
763
767
|
"""
|
|
764
|
-
return
|
|
768
|
+
return run_mode in [
|
|
769
|
+
"pedestals",
|
|
770
|
+
"dark_pedestals",
|
|
771
|
+
"nsb_only_pedestals",
|
|
772
|
+
"direct_injection",
|
|
773
|
+
]
|
|
774
|
+
|
|
775
|
+
@staticmethod
|
|
776
|
+
def _get_calibration_device_types(run_mode):
|
|
777
|
+
"""
|
|
778
|
+
Get the list of calibration device types based on the run mode.
|
|
779
|
+
|
|
780
|
+
Parameters
|
|
781
|
+
----------
|
|
782
|
+
run_mode: str
|
|
783
|
+
Run mode of the simulation.
|
|
784
|
+
|
|
785
|
+
Returns
|
|
786
|
+
-------
|
|
787
|
+
list
|
|
788
|
+
List of calibration device types.
|
|
789
|
+
"""
|
|
790
|
+
if run_mode == "direct_injection":
|
|
791
|
+
return ["flat_fielding"]
|
|
792
|
+
return []
|
|
@@ -184,14 +184,16 @@ def _prepare_test_options(config, output_path, model_version=None):
|
|
|
184
184
|
|
|
185
185
|
tmp_config_file = output_path / "tmp_config.yml"
|
|
186
186
|
config_file_model_version = config.get("model_version")
|
|
187
|
+
if isinstance(config_file_model_version, list):
|
|
188
|
+
config_file_model_version = [str(item) for item in config_file_model_version]
|
|
189
|
+
elif config_file_model_version is not None:
|
|
190
|
+
config_file_model_version = str(config_file_model_version)
|
|
187
191
|
if model_version and "model_version" in config:
|
|
188
192
|
config.update({"model_version": model_version})
|
|
189
193
|
|
|
190
194
|
for key in ["output_path", "data_directory", "pack_for_grid_register"]:
|
|
191
195
|
if key in config:
|
|
192
196
|
config[key] = str(Path(output_path).joinpath(config[key]))
|
|
193
|
-
if key == "output_path":
|
|
194
|
-
config["use_plain_output_path"] = True
|
|
195
197
|
|
|
196
198
|
_logger.info(f"Writing config file: {tmp_config_file}")
|
|
197
199
|
ascii_handler.write_data_to_file(data=config, output_file=tmp_config_file, sort_keys=False)
|
|
@@ -35,19 +35,19 @@ def assert_sim_telarray_metadata(file, array_model):
|
|
|
35
35
|
if sim_telarray_seed_mismatch:
|
|
36
36
|
site_parameter_mismatch.append(sim_telarray_seed_mismatch)
|
|
37
37
|
|
|
38
|
-
if len(telescope_meta) != len(array_model.
|
|
38
|
+
if len(telescope_meta) != len(array_model.telescope_models):
|
|
39
39
|
raise ValueError(
|
|
40
40
|
f"Number of telescopes in sim_telarray file ({len(telescope_meta)}) does not match "
|
|
41
|
-
f"number of telescopes in array model ({len(array_model.
|
|
41
|
+
f"number of telescopes in array model ({len(array_model.telescope_models)})"
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
for telescope_name in array_model.
|
|
44
|
+
for telescope_name in array_model.telescope_models.keys():
|
|
45
45
|
if not get_sim_telarray_telescope_id(telescope_name, file):
|
|
46
46
|
raise ValueError(f"Telescope {telescope_name} not found in sim_telarray file metadata")
|
|
47
47
|
|
|
48
48
|
telescope_parameter_mismatch = [
|
|
49
49
|
_assert_model_parameters(telescope_meta[i], model)
|
|
50
|
-
for i, model in enumerate(array_model.
|
|
50
|
+
for i, model in enumerate(array_model.telescope_models.values(), start=1)
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
# ensure printout of all mismatches, not only those found first
|
simtools/utils/geometry.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""A collection of functions related to geometrical transformations."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import math
|
|
4
5
|
|
|
5
6
|
import astropy.units as u
|
|
6
7
|
import numpy as np
|
|
@@ -236,3 +237,36 @@ def transform_ground_to_shower_coordinates(x_ground, y_ground, z_ground, azimuth
|
|
|
236
237
|
z_s = -sz * x + cz * z
|
|
237
238
|
|
|
238
239
|
return x_s, y_s, z_s
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def fiducial_radius_from_shape(width, shape):
|
|
243
|
+
"""
|
|
244
|
+
Calculate minimum radius including different geometrical shapes.
|
|
245
|
+
|
|
246
|
+
Assumes definition of shapes as in 'camera_body_shape' model parameter:
|
|
247
|
+
|
|
248
|
+
- circle: shape = 0, width is diameter
|
|
249
|
+
- hexagon: shape = 1 or 3, width is flat-to-flat distance
|
|
250
|
+
- square: shape = 2, width is side length
|
|
251
|
+
|
|
252
|
+
Parameters
|
|
253
|
+
----------
|
|
254
|
+
width : float
|
|
255
|
+
Characteristic width
|
|
256
|
+
shape : int
|
|
257
|
+
Geometrical shape parameter
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
float
|
|
262
|
+
Minimum fiducial radius
|
|
263
|
+
"""
|
|
264
|
+
if shape == 0:
|
|
265
|
+
return width / 2.0
|
|
266
|
+
if shape == 2:
|
|
267
|
+
return width / math.sqrt(2.0)
|
|
268
|
+
if shape in (1, 3):
|
|
269
|
+
return width / math.sqrt(3.0)
|
|
270
|
+
raise ValueError(
|
|
271
|
+
f"Unknown shape value {shape}. Valid values are: 0 (circle), 1 or 3 (hexagon), 2 (square)."
|
|
272
|
+
)
|
simtools/version.py
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# which is adapted from https://github.com/astropy/astropy/blob/master/astropy/version.py
|
|
5
5
|
# see https://github.com/astropy/astropy/pull/10774 for a discussion on why this needed.
|
|
6
6
|
|
|
7
|
+
from packaging.version import InvalidVersion, Version
|
|
8
|
+
|
|
7
9
|
try:
|
|
8
10
|
try:
|
|
9
11
|
from ._dev_version import version
|
|
@@ -17,3 +19,112 @@ except Exception: # pylint: disable=broad-except
|
|
|
17
19
|
version = "0.0.0" # pylint: disable=invalid-name
|
|
18
20
|
|
|
19
21
|
__version__ = version
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def resolve_version_to_latest_patch(partial_version, available_versions):
|
|
25
|
+
"""
|
|
26
|
+
Resolve a partial version (major.minor) to the latest patch version.
|
|
27
|
+
|
|
28
|
+
Given a partial version string (e.g., "6.0") and a list of available versions,
|
|
29
|
+
finds the latest patch version that matches the major.minor pattern.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
partial_version : str
|
|
34
|
+
Partial version string in format "major.minor" (e.g., "6.0", "5.2")
|
|
35
|
+
available_versions : list of str
|
|
36
|
+
List of available semantic versions (e.g., ["5.0.0", "5.0.1", "6.0.0", "6.0.2"])
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
str
|
|
41
|
+
Latest patch version matching the partial version pattern
|
|
42
|
+
|
|
43
|
+
Raises
|
|
44
|
+
------
|
|
45
|
+
ValueError
|
|
46
|
+
If partial_version is not in major.minor format
|
|
47
|
+
ValueError
|
|
48
|
+
If no matching versions are found
|
|
49
|
+
|
|
50
|
+
Examples
|
|
51
|
+
--------
|
|
52
|
+
>>> versions = ["5.0.0", "5.0.1", "6.0.0", "6.0.2", "6.1.0"]
|
|
53
|
+
>>> resolve_version_to_latest_patch("6.0", versions)
|
|
54
|
+
'6.0.2'
|
|
55
|
+
>>> resolve_version_to_latest_patch("5.0", versions)
|
|
56
|
+
'5.0.1'
|
|
57
|
+
>>> resolve_version_to_latest_patch("5.0.1", versions)
|
|
58
|
+
'5.0.1'
|
|
59
|
+
"""
|
|
60
|
+
try:
|
|
61
|
+
pv = Version(partial_version)
|
|
62
|
+
except InvalidVersion as exc:
|
|
63
|
+
raise ValueError(f"Invalid version string: {partial_version}") from exc
|
|
64
|
+
|
|
65
|
+
if pv.release and len(pv.release) >= 3:
|
|
66
|
+
return str(pv)
|
|
67
|
+
|
|
68
|
+
if len(pv.release) != 2:
|
|
69
|
+
raise ValueError(f"Partial version must be major.minor, got: {partial_version}")
|
|
70
|
+
|
|
71
|
+
major, minor = pv.release
|
|
72
|
+
|
|
73
|
+
candidates = [
|
|
74
|
+
v for v in available_versions if Version(v).major == major and Version(v).minor == minor
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
if not candidates:
|
|
78
|
+
raise ValueError(
|
|
79
|
+
f"No versions found matching '{partial_version}.x' "
|
|
80
|
+
f"in available versions: {sorted(available_versions)}"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return str(max(map(Version, candidates)))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def semver_to_int(version_string):
|
|
87
|
+
"""
|
|
88
|
+
Convert a semantic version string to an integer.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
version_string : str
|
|
93
|
+
Semantic version string (e.g., "6.0.2")
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
-------
|
|
97
|
+
int
|
|
98
|
+
Integer representation of the version (e.g., 60002 for "6.0.2")
|
|
99
|
+
|
|
100
|
+
"""
|
|
101
|
+
try:
|
|
102
|
+
v = Version(version_string)
|
|
103
|
+
except InvalidVersion as exc:
|
|
104
|
+
raise ValueError(f"Invalid version: {version_string}") from exc
|
|
105
|
+
|
|
106
|
+
release = v.release + (0,) * (3 - len(v.release))
|
|
107
|
+
major, minor, patch = release[:3]
|
|
108
|
+
return major * 10000 + minor * 100 + patch
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def sort_versions(version_list, reverse=False):
|
|
112
|
+
"""
|
|
113
|
+
Sort a list of semantic version strings.
|
|
114
|
+
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
version_list : list of str
|
|
118
|
+
List of semantic version strings (e.g., ["5.0.0", "6.0.2", "5.1.0"])
|
|
119
|
+
reverse : bool, optional
|
|
120
|
+
Sort in descending order if True (default False)
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
-------
|
|
124
|
+
list of str
|
|
125
|
+
Sorted list of version strings.
|
|
126
|
+
"""
|
|
127
|
+
try:
|
|
128
|
+
return [str(v) for v in sorted(map(Version, version_list), reverse=reverse)]
|
|
129
|
+
except InvalidVersion as exc:
|
|
130
|
+
raise ValueError(f"Invalid version in list: {version_list}") from exc
|
simtools/{corsika/corsika_histograms_visualize.py → visualization/plot_corsika_histograms.py}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Visualize Cherenkov photon distributions from CORSIKA."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import re
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
import matplotlib.pyplot as plt
|
|
@@ -569,3 +570,111 @@ def save_figs_to_pdf(figs, pdf_file_name):
|
|
|
569
570
|
plt.tight_layout()
|
|
570
571
|
pdf_pages.savefig(fig)
|
|
571
572
|
pdf_pages.close()
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
def build_all_photon_figures(histograms_instance, test: bool = False):
|
|
576
|
+
"""Return list of all photon histogram figures for the given instance.
|
|
577
|
+
|
|
578
|
+
When test is True, only generate the first two figure groups to reduce runtime.
|
|
579
|
+
"""
|
|
580
|
+
plot_function_names = sorted(
|
|
581
|
+
[
|
|
582
|
+
name
|
|
583
|
+
for name, obj in globals().items()
|
|
584
|
+
if name.startswith("plot_")
|
|
585
|
+
and "event_header_distribution" not in name
|
|
586
|
+
and callable(obj)
|
|
587
|
+
]
|
|
588
|
+
)
|
|
589
|
+
if test:
|
|
590
|
+
plot_function_names = plot_function_names[:2]
|
|
591
|
+
|
|
592
|
+
figure_list = []
|
|
593
|
+
module_obj = globals()
|
|
594
|
+
for fn_name in plot_function_names:
|
|
595
|
+
plot_fn = module_obj[fn_name]
|
|
596
|
+
figs = plot_fn(histograms_instance)
|
|
597
|
+
for fig in figs:
|
|
598
|
+
figure_list.append(fig)
|
|
599
|
+
return np.array(figure_list).flatten()
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def export_all_photon_figures_pdf(histograms_instance, test: bool = False):
|
|
603
|
+
"""Build and save all photon histogram figures into a single PDF.
|
|
604
|
+
|
|
605
|
+
The PDF name is derived from the HDF5 file name core and written under output_path.
|
|
606
|
+
"""
|
|
607
|
+
figs = build_all_photon_figures(histograms_instance, test=test)
|
|
608
|
+
core_name = re.sub(r"\.hdf5$", "", Path(histograms_instance.hdf5_file_name).name)
|
|
609
|
+
output_file_name = Path(histograms_instance.output_path).joinpath(f"{core_name}.pdf")
|
|
610
|
+
save_figs_to_pdf(figs, output_file_name)
|
|
611
|
+
return output_file_name
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def derive_event_1d_histograms(
|
|
615
|
+
histograms_instance,
|
|
616
|
+
event_1d_header_keys,
|
|
617
|
+
pdf: bool,
|
|
618
|
+
hdf5: bool,
|
|
619
|
+
overwrite: bool = False,
|
|
620
|
+
):
|
|
621
|
+
"""Create 1D event header histograms; optionally save to PDF and/or HDF5."""
|
|
622
|
+
figure_list = []
|
|
623
|
+
for key in event_1d_header_keys:
|
|
624
|
+
if pdf:
|
|
625
|
+
fig = plot_1d_event_header_distribution(histograms_instance, key)
|
|
626
|
+
figure_list.append(fig)
|
|
627
|
+
if hdf5:
|
|
628
|
+
histograms_instance.export_event_header_1d_histogram(
|
|
629
|
+
key, bins=50, hist_range=None, overwrite=overwrite
|
|
630
|
+
)
|
|
631
|
+
if pdf:
|
|
632
|
+
figs_array = np.array(figure_list).flatten()
|
|
633
|
+
pdf_name = Path(histograms_instance.output_path).joinpath(
|
|
634
|
+
f"{Path(histograms_instance.hdf5_file_name).name}_event_1d_histograms.pdf"
|
|
635
|
+
)
|
|
636
|
+
save_figs_to_pdf(figs_array, pdf_name)
|
|
637
|
+
return pdf_name
|
|
638
|
+
return None
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
def derive_event_2d_histograms(
|
|
642
|
+
histograms_instance,
|
|
643
|
+
event_2d_header_keys,
|
|
644
|
+
pdf: bool,
|
|
645
|
+
hdf5: bool,
|
|
646
|
+
overwrite: bool = False,
|
|
647
|
+
):
|
|
648
|
+
"""Create 2D event header histograms in pairs; optionally save PDF and/or HDF5.
|
|
649
|
+
|
|
650
|
+
If an odd number of keys is provided, the last one is ignored (with a warning).
|
|
651
|
+
"""
|
|
652
|
+
if len(event_2d_header_keys) % 2 == 1:
|
|
653
|
+
_logger.warning(
|
|
654
|
+
"An odd number of keys was passed to generate 2D histograms.\n"
|
|
655
|
+
"The last key is being ignored."
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
figure_list = []
|
|
659
|
+
for i, _ in enumerate(event_2d_header_keys[::2]):
|
|
660
|
+
if pdf:
|
|
661
|
+
fig = plot_2d_event_header_distribution(
|
|
662
|
+
histograms_instance, event_2d_header_keys[i], event_2d_header_keys[i + 1]
|
|
663
|
+
)
|
|
664
|
+
figure_list.append(fig)
|
|
665
|
+
if hdf5:
|
|
666
|
+
histograms_instance.export_event_header_2d_histogram(
|
|
667
|
+
event_2d_header_keys[i],
|
|
668
|
+
event_2d_header_keys[i + 1],
|
|
669
|
+
bins=50,
|
|
670
|
+
hist_range=None,
|
|
671
|
+
overwrite=overwrite,
|
|
672
|
+
)
|
|
673
|
+
if pdf:
|
|
674
|
+
figs_array = np.array(figure_list).flatten()
|
|
675
|
+
pdf_name = Path(histograms_instance.output_path).joinpath(
|
|
676
|
+
f"{Path(histograms_instance.hdf5_file_name).name}_event_2d_histograms.pdf"
|
|
677
|
+
)
|
|
678
|
+
save_figs_to_pdf(figs_array, pdf_name)
|
|
679
|
+
return pdf_name
|
|
680
|
+
return None
|