gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gammasimtools-0.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Application to run the StatisticalErrorEvaluator and interpolate results.
|
|
5
|
+
|
|
6
|
+
This application evaluates statistical uncertainties from DL2 MC event files
|
|
7
|
+
based on input parameters like zenith angles and offsets, and can perform interpolation
|
|
8
|
+
for a specified grid point.
|
|
9
|
+
|
|
10
|
+
Command line arguments
|
|
11
|
+
----------------------
|
|
12
|
+
base_path (str, required)
|
|
13
|
+
Path to the directory containing the DL2 MC event file for interpolation.
|
|
14
|
+
zeniths (list of int, required)
|
|
15
|
+
List of zenith angles to consider.
|
|
16
|
+
offsets (list of int, required)
|
|
17
|
+
List of offsets in degrees.
|
|
18
|
+
interpolate (bool, optional)
|
|
19
|
+
If set, performs interpolation for a specific grid point.
|
|
20
|
+
query_point (list of int, optional)
|
|
21
|
+
Grid point for interpolation (energy, azimuth, zenith, NSB, offset).
|
|
22
|
+
|
|
23
|
+
Example
|
|
24
|
+
-------
|
|
25
|
+
To evaluate statistical uncertainties and perform interpolation, run the command line script:
|
|
26
|
+
|
|
27
|
+
.. code-block:: console
|
|
28
|
+
|
|
29
|
+
simtools-production-scale-events --base_path tests/resources/production_dl2_fits/ \
|
|
30
|
+
--zeniths 20 52 40 60 --offsets 0 --interpolate --query_point 1 180 30 0 0 \
|
|
31
|
+
--science_case 1 --metrics_file "path/to/metrics.yaml"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
The output will display the scaled events for the specified grid point.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
import json
|
|
38
|
+
import logging
|
|
39
|
+
import os
|
|
40
|
+
from pathlib import Path
|
|
41
|
+
|
|
42
|
+
import astropy.units as u
|
|
43
|
+
import numpy as np
|
|
44
|
+
|
|
45
|
+
import simtools.utils.general as gen
|
|
46
|
+
from simtools.configuration import configurator
|
|
47
|
+
from simtools.configuration.commandline_parser import CommandLineParser
|
|
48
|
+
from simtools.io_operations import io_handler
|
|
49
|
+
from simtools.production_configuration.calculate_statistical_errors_grid_point import (
|
|
50
|
+
StatisticalErrorEvaluator,
|
|
51
|
+
)
|
|
52
|
+
from simtools.production_configuration.interpolation_handler import InterpolationHandler
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _parse(label, description):
|
|
56
|
+
"""
|
|
57
|
+
Parse command line arguments for the statistical error evaluator application.
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
argparse.Namespace
|
|
62
|
+
Parsed command line arguments.
|
|
63
|
+
"""
|
|
64
|
+
config = configurator.Configurator(label=label, description=description)
|
|
65
|
+
|
|
66
|
+
config.parser.add_argument(
|
|
67
|
+
"--base_path",
|
|
68
|
+
type=str,
|
|
69
|
+
required=True,
|
|
70
|
+
help="Path to the DL2 MC event files for interpolation.",
|
|
71
|
+
)
|
|
72
|
+
config.parser.add_argument(
|
|
73
|
+
"--zeniths", nargs="+", type=CommandLineParser.zenith_angle, help="List of zenith angles."
|
|
74
|
+
)
|
|
75
|
+
config.parser.add_argument(
|
|
76
|
+
"--offsets", nargs="+", type=float, help="List of offsets in degrees."
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
config.parser.add_argument(
|
|
80
|
+
"--interpolate", action="store_true", help="Interpolate results for a specific grid point."
|
|
81
|
+
)
|
|
82
|
+
config.parser.add_argument(
|
|
83
|
+
"--query_point",
|
|
84
|
+
nargs=5,
|
|
85
|
+
type=float,
|
|
86
|
+
help="Grid point for interpolation (energy, azimuth, zenith, NSB, offset).",
|
|
87
|
+
)
|
|
88
|
+
config.parser.add_argument(
|
|
89
|
+
"--output_file",
|
|
90
|
+
type=str,
|
|
91
|
+
default="interpolated_scaled_events.json",
|
|
92
|
+
help="Output file to store the results. (default: 'interpolated_scaled_events.json').",
|
|
93
|
+
)
|
|
94
|
+
config.parser.add_argument(
|
|
95
|
+
"--metrics_file",
|
|
96
|
+
type=str,
|
|
97
|
+
default="production_simulation_config_metrics.yaml",
|
|
98
|
+
help="Metrics definition file. (default: production_simulation_config_metrics.yaml)",
|
|
99
|
+
)
|
|
100
|
+
config.parser.add_argument(
|
|
101
|
+
"--science_case", type=str, required=True, help="Science case for the simulation."
|
|
102
|
+
)
|
|
103
|
+
return config.initialize(db_config=False)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def main():
|
|
107
|
+
"""Run the evaluator and interpolate."""
|
|
108
|
+
label = Path(__file__).stem
|
|
109
|
+
args_dict, _ = _parse(
|
|
110
|
+
label,
|
|
111
|
+
"Evaluate statistical uncertainties from DL2 MC event files and interpolate results.",
|
|
112
|
+
)
|
|
113
|
+
logger = logging.getLogger()
|
|
114
|
+
logger.setLevel(logging.INFO)
|
|
115
|
+
logger.info(f"args dict: {args_dict}")
|
|
116
|
+
|
|
117
|
+
output_path = io_handler.IOHandler().get_output_directory(label)
|
|
118
|
+
output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
|
|
119
|
+
|
|
120
|
+
evaluator_instances = []
|
|
121
|
+
|
|
122
|
+
metrics = (
|
|
123
|
+
gen.collect_data_from_file(args_dict["metrics_file"]) if "metrics_file" in args_dict else {}
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if args_dict["base_path"] and args_dict["zeniths"] and args_dict["offsets"]:
|
|
127
|
+
for zenith in args_dict["zeniths"]:
|
|
128
|
+
for offset in args_dict["offsets"]:
|
|
129
|
+
# Build file path based on base_path, zenith, and offset
|
|
130
|
+
file_name = f"prod6_LaPalma-{int(zenith.value)}deg_"
|
|
131
|
+
file_name += "gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits"
|
|
132
|
+
file_path = os.path.join(args_dict["base_path"], file_name)
|
|
133
|
+
|
|
134
|
+
evaluator = StatisticalErrorEvaluator(
|
|
135
|
+
file_path,
|
|
136
|
+
file_type="Gamma-cone",
|
|
137
|
+
metrics=metrics,
|
|
138
|
+
grid_point=(1 * u.TeV, 180 * u.deg, zenith, 0, offset * u.deg),
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
evaluator.calculate_metrics()
|
|
142
|
+
evaluator_instances.append(evaluator)
|
|
143
|
+
|
|
144
|
+
else:
|
|
145
|
+
logger.warning("No files read")
|
|
146
|
+
logger.warning(f"Base Path: {args_dict['base_path']}")
|
|
147
|
+
logger.warning(f"Zeniths: {args_dict['zeniths']}")
|
|
148
|
+
logger.warning(f"Offsets: {args_dict['offsets']}")
|
|
149
|
+
|
|
150
|
+
# Perform interpolation for the given query point
|
|
151
|
+
interpolation_handler = InterpolationHandler(
|
|
152
|
+
evaluator_instances, science_case=args_dict["science_case"], metrics=metrics
|
|
153
|
+
)
|
|
154
|
+
query_points = np.array([args_dict["query_point"]])
|
|
155
|
+
scaled_events = interpolation_handler.interpolate(query_points)
|
|
156
|
+
|
|
157
|
+
output_data = {
|
|
158
|
+
"query_point": args_dict["query_point"],
|
|
159
|
+
"scaled_events": scaled_events.tolist(),
|
|
160
|
+
}
|
|
161
|
+
with open(output_filepath, "w", encoding="utf-8") as f:
|
|
162
|
+
json.dump(output_data, f, indent=4)
|
|
163
|
+
logger.info(f"Output saved to {output_filepath}")
|
|
164
|
+
logger.info(f"Scaled events for grid point {args_dict['query_point']}: {scaled_events}")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
main()
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Simulate calibration devices using the light emission package.
|
|
5
|
+
|
|
6
|
+
Run the application in the command line.
|
|
7
|
+
There are two ways this application can be executed:
|
|
8
|
+
|
|
9
|
+
1. Illuminator at varying distances.
|
|
10
|
+
2. Illuminator and telescopes at fixed positions as defined in the layout.
|
|
11
|
+
|
|
12
|
+
Example Usage
|
|
13
|
+
-------------
|
|
14
|
+
|
|
15
|
+
1. Simulate light emission with varying distances:
|
|
16
|
+
|
|
17
|
+
.. code-block:: console
|
|
18
|
+
|
|
19
|
+
simtools-simulate-light-emission --telescope MSTN-04 --site North \
|
|
20
|
+
--illuminator ILLN-01 --light_source_setup variable \
|
|
21
|
+
--model_version 6.0.0 --light_source_type led
|
|
22
|
+
|
|
23
|
+
2. Simulate light emission with telescopes at fixed positions according to the layout:
|
|
24
|
+
|
|
25
|
+
.. code-block:: console
|
|
26
|
+
|
|
27
|
+
simtools-simulate-light-emission --telescope MSTN-04 --site North \
|
|
28
|
+
--illuminator ILLN-01 --light_source_setup layout \
|
|
29
|
+
--model_version 6.0.0 \
|
|
30
|
+
--light_source_type led
|
|
31
|
+
|
|
32
|
+
Command Line Arguments
|
|
33
|
+
----------------------
|
|
34
|
+
|
|
35
|
+
--telescope (str, required)
|
|
36
|
+
Telescope model name (e.g. LSTN-01, SSTS-design, SSTS-25, ...)
|
|
37
|
+
|
|
38
|
+
--site (str, required)
|
|
39
|
+
Site name (North or South).
|
|
40
|
+
|
|
41
|
+
--illuminator (str, optional)
|
|
42
|
+
Illuminator in array, e.g., ILLN-01.
|
|
43
|
+
|
|
44
|
+
--light_source_setup (str, optional)
|
|
45
|
+
Select calibration light source positioning/setup:
|
|
46
|
+
- "variable" for varying distances.
|
|
47
|
+
- "layout" for actual telescope positions.
|
|
48
|
+
|
|
49
|
+
--model_version (str, optional)
|
|
50
|
+
Version of the simulation model.
|
|
51
|
+
|
|
52
|
+
--light_source_type (str, optional)
|
|
53
|
+
Select calibration light source type: led (default) or laser.
|
|
54
|
+
This changes the pre-compiled (simtel_array) application that is used to run the
|
|
55
|
+
light emission package with. Currently we use xyzls (laser), and ls-beam can be
|
|
56
|
+
accessed by using the laser option.
|
|
57
|
+
|
|
58
|
+
--off_axis_angle (float, optional)
|
|
59
|
+
Off axis angle for light source direction.
|
|
60
|
+
|
|
61
|
+
--plot (flag, optional)
|
|
62
|
+
Produce a multiple pages pdf file with the image plots.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Example
|
|
66
|
+
-------
|
|
67
|
+
|
|
68
|
+
Simulate isotropic light source at different distances for the MSTN-04:
|
|
69
|
+
|
|
70
|
+
.. code-block:: console
|
|
71
|
+
|
|
72
|
+
simtools-simulate-light-emission --telescope MSTN-04 --site North \
|
|
73
|
+
--illuminator ILLN-01 --light_source_setup variable \
|
|
74
|
+
--model_version 6.0.0 --light_source_type led ```
|
|
75
|
+
|
|
76
|
+
Expected Output:
|
|
77
|
+
|
|
78
|
+
.. code-block:: console
|
|
79
|
+
|
|
80
|
+
light-emission package stage:
|
|
81
|
+
File '/workdir/external/simtools/simtools-output/light_emission/model/
|
|
82
|
+
atmprof_ecmwf_north_winter_fixed.dat' registered for atmospheric profile 99.
|
|
83
|
+
Atmospheric profile 99 to be read from file '/workdir/external/simtools/
|
|
84
|
+
simtools-output/light_emission/model/atmprof_ecmwf_north_winter_fixed.dat'.
|
|
85
|
+
Atmospheric profile 99 with 55 levels read from file /workdir/external/
|
|
86
|
+
simtools/simtools-output/light_emission/model/atmprof_ecmwf_north_winter_fixed.dat
|
|
87
|
+
Initialize atmosphere ranging from 0.000 to 120.000 km a.s.l.
|
|
88
|
+
IACT control parameter line: print_events 999 10 100 1000 0
|
|
89
|
+
Case 1: 1 event with 1e+10 photons.
|
|
90
|
+
Using IACT/ATMO package version 1.67 (2023-11-10) for CORSIKA 6.999
|
|
91
|
+
Output file /workdir/external/simtools/simtools-output/light_emission/xyzls.iact.gz
|
|
92
|
+
not yet created.
|
|
93
|
+
Telescope output file: '/workdir/external/simtools/simtools-output/
|
|
94
|
+
light_emission/xyzls.iact.gz'
|
|
95
|
+
....
|
|
96
|
+
....
|
|
97
|
+
Sim_telarray stage:
|
|
98
|
+
Telescope 1 triggered (1/0/0/0, mask 1), summation from 36 to 95 of 105
|
|
99
|
+
Event end data has been found.
|
|
100
|
+
Shower of 0.0000 TeV energy was seen in 1 of 1 cases.
|
|
101
|
+
Photon statistics:
|
|
102
|
+
All photons: 928518
|
|
103
|
+
Used photons: 928518
|
|
104
|
+
Not absorbed/max. Q.E.: 189560
|
|
105
|
+
Reflected on mirror: 26815
|
|
106
|
+
Camera hit: 25574
|
|
107
|
+
Pixel hit: 25574
|
|
108
|
+
Detected: 20998
|
|
109
|
+
Trigger statistics:
|
|
110
|
+
Tel. triggered: 1
|
|
111
|
+
Tel. + array: 1
|
|
112
|
+
Early readout: 0
|
|
113
|
+
Late readout: 0
|
|
114
|
+
Finish data conversion ...
|
|
115
|
+
Writing 13 histograms to output file.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
import logging
|
|
122
|
+
import subprocess
|
|
123
|
+
from pathlib import Path
|
|
124
|
+
|
|
125
|
+
import astropy.units as u
|
|
126
|
+
|
|
127
|
+
import simtools.utils.general as gen
|
|
128
|
+
from simtools.configuration import configurator
|
|
129
|
+
from simtools.corsika.corsika_histograms_visualize import save_figs_to_pdf
|
|
130
|
+
from simtools.model.calibration_model import CalibrationModel
|
|
131
|
+
from simtools.model.site_model import SiteModel
|
|
132
|
+
from simtools.model.telescope_model import TelescopeModel
|
|
133
|
+
from simtools.simtel.simulator_light_emission import SimulatorLightEmission
|
|
134
|
+
from simtools.visualization.visualize import plot_simtel_ctapipe
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _parse(label):
|
|
138
|
+
"""Parse command line configuration."""
|
|
139
|
+
config = configurator.Configurator(
|
|
140
|
+
label=label,
|
|
141
|
+
description=(
|
|
142
|
+
"Simulate the light emission by an artificial light source for calibration purposes."
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
config.parser.add_argument(
|
|
146
|
+
"--off_axis_angle",
|
|
147
|
+
help="Off axis angle for light source direction",
|
|
148
|
+
type=float,
|
|
149
|
+
default=0.0,
|
|
150
|
+
required=False,
|
|
151
|
+
)
|
|
152
|
+
config.parser.add_argument(
|
|
153
|
+
"--plot",
|
|
154
|
+
help="Produce a multiple pages pdf file with the image plots.",
|
|
155
|
+
action="store_true",
|
|
156
|
+
)
|
|
157
|
+
config.parser.add_argument(
|
|
158
|
+
"--light_source_type",
|
|
159
|
+
help="Select calibration light source type: led or laser",
|
|
160
|
+
type=str,
|
|
161
|
+
default="led",
|
|
162
|
+
choices=["led", "laser"],
|
|
163
|
+
required=False,
|
|
164
|
+
)
|
|
165
|
+
config.parser.add_argument(
|
|
166
|
+
"--light_source_setup",
|
|
167
|
+
help="Select calibration light source positioning/setup: \
|
|
168
|
+
varying distances (variable), layout positions (layout)",
|
|
169
|
+
type=str,
|
|
170
|
+
choices=["layout", "variable"],
|
|
171
|
+
default=None,
|
|
172
|
+
)
|
|
173
|
+
config.parser.add_argument(
|
|
174
|
+
"--distances_ls",
|
|
175
|
+
help="Light source distance in m (Example --distances_ls 800 1200)",
|
|
176
|
+
nargs="+",
|
|
177
|
+
required=False,
|
|
178
|
+
)
|
|
179
|
+
config.parser.add_argument(
|
|
180
|
+
"--illuminator",
|
|
181
|
+
help="Illuminator in array, i.e. ILLN-design",
|
|
182
|
+
type=str,
|
|
183
|
+
default=None,
|
|
184
|
+
)
|
|
185
|
+
config.parser.add_argument(
|
|
186
|
+
"--telescope_file",
|
|
187
|
+
help="Telescope position file (temporary)",
|
|
188
|
+
type=str,
|
|
189
|
+
default=None,
|
|
190
|
+
)
|
|
191
|
+
config.parser.add_argument(
|
|
192
|
+
"--return_cleaned",
|
|
193
|
+
help="ctapipe, if image should be cleaned, \
|
|
194
|
+
notice as well image cleaning parameters",
|
|
195
|
+
type=str,
|
|
196
|
+
default=False,
|
|
197
|
+
required=False,
|
|
198
|
+
)
|
|
199
|
+
config.parser.add_argument(
|
|
200
|
+
"--picture_thresh",
|
|
201
|
+
help="ctapipe, threshold above which all pixels are retained",
|
|
202
|
+
type=int,
|
|
203
|
+
required=False,
|
|
204
|
+
)
|
|
205
|
+
config.parser.add_argument(
|
|
206
|
+
"--boundary_thresh",
|
|
207
|
+
help="ctapipe, threshold above which pixels are retained if\
|
|
208
|
+
they have a neighbor already above the picture_thresh",
|
|
209
|
+
type=int,
|
|
210
|
+
required=False,
|
|
211
|
+
)
|
|
212
|
+
config.parser.add_argument(
|
|
213
|
+
"--min_neighbors",
|
|
214
|
+
help="ctapipe, A picture pixel survives cleaning only if it has at\
|
|
215
|
+
least this number of picture neighbors. This has no effect in\
|
|
216
|
+
case keep_isolated_pixels is True",
|
|
217
|
+
type=int,
|
|
218
|
+
required=False,
|
|
219
|
+
)
|
|
220
|
+
config.parser.add_argument(
|
|
221
|
+
"--level",
|
|
222
|
+
help="read 5",
|
|
223
|
+
type=int,
|
|
224
|
+
default=5,
|
|
225
|
+
required=False,
|
|
226
|
+
)
|
|
227
|
+
config.parser.add_argument(
|
|
228
|
+
"--integration_window",
|
|
229
|
+
help="ctapipe, A picture pixel survives cleaning only if it has at\
|
|
230
|
+
least this number of picture neighbors. This has no effect in\
|
|
231
|
+
case keep_isolated_pixels is True",
|
|
232
|
+
nargs="*",
|
|
233
|
+
default=["7", "3"],
|
|
234
|
+
required=False,
|
|
235
|
+
)
|
|
236
|
+
return config.initialize(
|
|
237
|
+
db_config=True,
|
|
238
|
+
simulation_model="telescope",
|
|
239
|
+
require_command_line=True,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def distance_list(arg):
|
|
244
|
+
"""
|
|
245
|
+
Convert distance list to astropy quantities.
|
|
246
|
+
|
|
247
|
+
Parameters
|
|
248
|
+
----------
|
|
249
|
+
arg: list
|
|
250
|
+
List of distances.
|
|
251
|
+
|
|
252
|
+
Returns
|
|
253
|
+
-------
|
|
254
|
+
values: list
|
|
255
|
+
List of distances as astropy quantities.
|
|
256
|
+
"""
|
|
257
|
+
try:
|
|
258
|
+
return [float(x) * u.m for x in arg]
|
|
259
|
+
except ValueError as exc:
|
|
260
|
+
raise ValueError("Distances must be numeric values") from exc
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def default_le_configs(le_application, args_dict):
|
|
264
|
+
"""
|
|
265
|
+
Define default light emission configurations.
|
|
266
|
+
|
|
267
|
+
Predefined angular distribution names not requiring to read any table are
|
|
268
|
+
"Isotropic", "Gauss:<rms>", "Rayleigh", "Cone:<angle>", and "FilledCone:<angle>", "Parallel",
|
|
269
|
+
with all angles given in degrees, all with respect to the given direction vector
|
|
270
|
+
(vertically downwards if missing). If the light source has a non-zero length and velocity
|
|
271
|
+
(in units of the vacuum speed of light), it is handled as a moving source,
|
|
272
|
+
in the given direction.
|
|
273
|
+
|
|
274
|
+
Parameters
|
|
275
|
+
----------
|
|
276
|
+
le_application: str
|
|
277
|
+
Light emission application.
|
|
278
|
+
|
|
279
|
+
args_dict: dict
|
|
280
|
+
Dictionary with command line arguments.
|
|
281
|
+
|
|
282
|
+
Returns
|
|
283
|
+
-------
|
|
284
|
+
default_config: dict
|
|
285
|
+
Default light emission configuration.
|
|
286
|
+
"""
|
|
287
|
+
if le_application in ("xyzls", "ls-beam") and args_dict["light_source_setup"] == "variable":
|
|
288
|
+
return {
|
|
289
|
+
"x_pos": {
|
|
290
|
+
"len": 1,
|
|
291
|
+
"unit": u.Unit("cm"),
|
|
292
|
+
"default": 0 * u.cm,
|
|
293
|
+
"names": ["x_position"],
|
|
294
|
+
},
|
|
295
|
+
"y_pos": {
|
|
296
|
+
"len": 1,
|
|
297
|
+
"unit": u.Unit("cm"),
|
|
298
|
+
"default": 0 * u.cm,
|
|
299
|
+
"names": ["y_position"],
|
|
300
|
+
},
|
|
301
|
+
"z_pos": {
|
|
302
|
+
"len": 1,
|
|
303
|
+
"unit": u.Unit("cm"),
|
|
304
|
+
"default": [i * 100 for i in [200, 300, 400, 600, 800, 1200, 2000, 4000]] * u.cm,
|
|
305
|
+
"names": ["z_position"],
|
|
306
|
+
},
|
|
307
|
+
"direction": {
|
|
308
|
+
"len": 3,
|
|
309
|
+
"unit": u.dimensionless_unscaled,
|
|
310
|
+
"default": [0, 0, -1],
|
|
311
|
+
"names": ["direction", "cx,cy,cz"],
|
|
312
|
+
},
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return {}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def select_application(args_dict):
|
|
319
|
+
"""
|
|
320
|
+
Select sim_telarray application for light emission simulations.
|
|
321
|
+
|
|
322
|
+
Parameters
|
|
323
|
+
----------
|
|
324
|
+
args_dict: dict
|
|
325
|
+
Dictionary with command line arguments.
|
|
326
|
+
|
|
327
|
+
Returns
|
|
328
|
+
-------
|
|
329
|
+
le_application: str
|
|
330
|
+
Light emission application.
|
|
331
|
+
"""
|
|
332
|
+
le_application = None
|
|
333
|
+
if args_dict["light_source_type"] == "led":
|
|
334
|
+
le_application = "xyzls"
|
|
335
|
+
elif args_dict["light_source_type"] == "laser":
|
|
336
|
+
le_application = "ls-beam"
|
|
337
|
+
|
|
338
|
+
return le_application, args_dict["light_source_setup"]
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def main():
|
|
342
|
+
"""Simulate light emission."""
|
|
343
|
+
label = Path(__file__).stem
|
|
344
|
+
args_dict, db_config = _parse(label)
|
|
345
|
+
le_application = select_application(args_dict)
|
|
346
|
+
default_le_config = default_le_configs(le_application[0], args_dict)
|
|
347
|
+
logger = logging.getLogger()
|
|
348
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
349
|
+
|
|
350
|
+
telescope_model = TelescopeModel(
|
|
351
|
+
site=args_dict["site"],
|
|
352
|
+
telescope_name=args_dict["telescope"],
|
|
353
|
+
mongo_db_config=db_config,
|
|
354
|
+
model_version=args_dict["model_version"],
|
|
355
|
+
label=label,
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
calibration_model = CalibrationModel(
|
|
359
|
+
site=args_dict["site"],
|
|
360
|
+
calibration_device_model_name=args_dict["illuminator"],
|
|
361
|
+
mongo_db_config=db_config,
|
|
362
|
+
model_version=args_dict["model_version"],
|
|
363
|
+
label=label,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
site_model = SiteModel(
|
|
367
|
+
site=args_dict["site"],
|
|
368
|
+
mongo_db_config=db_config,
|
|
369
|
+
model_version=args_dict["model_version"],
|
|
370
|
+
label=label,
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
if args_dict["light_source_setup"] == "variable":
|
|
374
|
+
if args_dict["distances_ls"] is not None:
|
|
375
|
+
default_le_config["z_pos"]["default"] = distance_list(args_dict["distances_ls"])
|
|
376
|
+
logger.info(f"Simulating for distances of {default_le_config['z_pos']['default']}")
|
|
377
|
+
figures = []
|
|
378
|
+
for distance in default_le_config["z_pos"]["default"]:
|
|
379
|
+
le_config = default_le_config.copy()
|
|
380
|
+
le_config["z_pos"]["default"] = distance
|
|
381
|
+
light_source = SimulatorLightEmission(
|
|
382
|
+
telescope_model=telescope_model,
|
|
383
|
+
calibration_model=calibration_model,
|
|
384
|
+
site_model=site_model,
|
|
385
|
+
default_le_config=le_config,
|
|
386
|
+
le_application=le_application,
|
|
387
|
+
simtel_path=args_dict["simtel_path"],
|
|
388
|
+
light_source_type=args_dict["light_source_type"],
|
|
389
|
+
)
|
|
390
|
+
run_script = light_source.prepare_script(generate_postscript=True, **args_dict)
|
|
391
|
+
log_file = f"{light_source.output_directory}/logfile.log"
|
|
392
|
+
with open(log_file, "w", encoding="utf-8") as log_file:
|
|
393
|
+
|
|
394
|
+
subprocess.run(
|
|
395
|
+
run_script,
|
|
396
|
+
shell=False,
|
|
397
|
+
check=False,
|
|
398
|
+
text=True,
|
|
399
|
+
stdout=log_file,
|
|
400
|
+
stderr=log_file,
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
try:
|
|
404
|
+
filename = (
|
|
405
|
+
f"{light_source.output_directory}/"
|
|
406
|
+
f"{light_source.le_application[0]}_"
|
|
407
|
+
f"{light_source.le_application[1]}.simtel.gz"
|
|
408
|
+
)
|
|
409
|
+
fig = plot_simtel_ctapipe(
|
|
410
|
+
filename,
|
|
411
|
+
cleaning_args=[
|
|
412
|
+
args_dict["boundary_thresh"],
|
|
413
|
+
args_dict["picture_thresh"],
|
|
414
|
+
args_dict["min_neighbors"],
|
|
415
|
+
],
|
|
416
|
+
distance=light_source.default_le_config["z_pos"]["default"],
|
|
417
|
+
return_cleaned=args_dict["return_cleaned"],
|
|
418
|
+
)
|
|
419
|
+
figures.append(fig)
|
|
420
|
+
except AttributeError:
|
|
421
|
+
msg = "telescope not triggered at distance of"
|
|
422
|
+
msg += f"{light_source.distance.to(u.meter)}"
|
|
423
|
+
logger.warning(msg)
|
|
424
|
+
|
|
425
|
+
save_figs_to_pdf(
|
|
426
|
+
figures,
|
|
427
|
+
f"{light_source.output_directory}/{args_dict['telescope']}_"
|
|
428
|
+
f"{light_source.le_application[0]}_"
|
|
429
|
+
f"{light_source.le_application[1]}.pdf",
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
elif args_dict["light_source_setup"] == "layout":
|
|
433
|
+
|
|
434
|
+
light_source = SimulatorLightEmission(
|
|
435
|
+
telescope_model=telescope_model,
|
|
436
|
+
calibration_model=calibration_model,
|
|
437
|
+
site_model=site_model,
|
|
438
|
+
default_le_config=default_le_config,
|
|
439
|
+
le_application=le_application,
|
|
440
|
+
simtel_path=args_dict["simtel_path"],
|
|
441
|
+
light_source_type=args_dict["light_source_type"],
|
|
442
|
+
)
|
|
443
|
+
run_script = light_source.prepare_script(generate_postscript=True, **args_dict)
|
|
444
|
+
log_file = f"{light_source.output_directory}/logfile.log"
|
|
445
|
+
with open(log_file, "w", encoding="utf-8") as log_file:
|
|
446
|
+
|
|
447
|
+
subprocess.run(
|
|
448
|
+
run_script, shell=False, check=False, text=True, stdout=log_file, stderr=log_file
|
|
449
|
+
)
|
|
450
|
+
try:
|
|
451
|
+
filename = (
|
|
452
|
+
f"{light_source.output_directory}/"
|
|
453
|
+
f"{light_source.le_application[0]}_{light_source.le_application[1]}.simtel.gz"
|
|
454
|
+
)
|
|
455
|
+
fig = plot_simtel_ctapipe(
|
|
456
|
+
filename,
|
|
457
|
+
cleaning_args=[
|
|
458
|
+
args_dict["boundary_thresh"],
|
|
459
|
+
args_dict["picture_thresh"],
|
|
460
|
+
args_dict["min_neighbors"],
|
|
461
|
+
],
|
|
462
|
+
distance=light_source.distance,
|
|
463
|
+
return_cleaned=args_dict["return_cleaned"],
|
|
464
|
+
)
|
|
465
|
+
except AttributeError:
|
|
466
|
+
msg = f"telescope not triggered at distance of {light_source.distance.to(u.meter)}"
|
|
467
|
+
logger.warning(msg)
|
|
468
|
+
|
|
469
|
+
save_figs_to_pdf(
|
|
470
|
+
[fig],
|
|
471
|
+
f"{light_source.output_directory}/{args_dict['telescope']}_"
|
|
472
|
+
f"{light_source.le_application[0]}_"
|
|
473
|
+
f"{light_source.le_application[1]}.pdf",
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
if __name__ == "__main__":
|
|
478
|
+
main()
|