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
simtools/utils/names.py
CHANGED
|
@@ -1,209 +1,121 @@
|
|
|
1
|
+
"""Validation of names."""
|
|
2
|
+
|
|
3
|
+
import glob
|
|
1
4
|
import logging
|
|
2
5
|
import re
|
|
6
|
+
from functools import cache
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
3
10
|
|
|
4
11
|
_logger = logging.getLogger(__name__)
|
|
5
12
|
|
|
6
13
|
__all__ = [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"camera_efficiency_simtel_file_name",
|
|
11
|
-
"convert_telescope_model_name_to_yaml_name",
|
|
12
|
-
"get_site_from_telescope_name",
|
|
13
|
-
"get_telescope_class",
|
|
14
|
+
"generate_file_name",
|
|
15
|
+
"get_array_element_type_from_name",
|
|
16
|
+
"get_site_from_array_element_name",
|
|
14
17
|
"layout_telescope_list_file_name",
|
|
15
|
-
"ray_tracing_file_name",
|
|
16
|
-
"ray_tracing_plot_file_name",
|
|
17
|
-
"ray_tracing_results_file_name",
|
|
18
18
|
"sanitize_name",
|
|
19
|
-
"
|
|
19
|
+
"simtel_config_file_name",
|
|
20
20
|
"simtel_single_mirror_list_file_name",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"split_telescope_model_name",
|
|
24
|
-
"telescope_model_name_from_array_element_id",
|
|
25
|
-
"translate_simtools_to_corsika",
|
|
26
|
-
"validate_array_layout_name",
|
|
27
|
-
"validate_model_version_name",
|
|
21
|
+
"validate_array_element_id_name",
|
|
22
|
+
"validate_array_element_name",
|
|
28
23
|
"validate_site_name",
|
|
29
|
-
"validate_sub_system_name",
|
|
30
|
-
"validate_telescope_id_name",
|
|
31
|
-
"validate_telescope_model_name",
|
|
32
|
-
"validate_telescope_name_db",
|
|
33
24
|
]
|
|
34
25
|
|
|
35
|
-
lst = "LST"
|
|
36
|
-
mst = "MST"
|
|
37
|
-
sct = "SCT"
|
|
38
|
-
sst = "SST"
|
|
39
|
-
hess = "HESS"
|
|
40
|
-
magic = "MAGIC"
|
|
41
|
-
veritas = "VERITAS"
|
|
42
|
-
|
|
43
|
-
all_telescope_class_names = {
|
|
44
|
-
lst: ["lst"],
|
|
45
|
-
mst: ["mst"],
|
|
46
|
-
sct: ["sct"],
|
|
47
|
-
sst: ["sst"],
|
|
48
|
-
hess: ["hess"],
|
|
49
|
-
magic: ["magic"],
|
|
50
|
-
veritas: ["veritas"],
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
all_subsystem_names = {
|
|
54
|
-
"SST": ["sst", "ssts", "SSTS"],
|
|
55
|
-
"ASTRI": ["astri"],
|
|
56
|
-
"GCT": ["gct", "gct-s"],
|
|
57
|
-
"1M": ["1m"],
|
|
58
|
-
"FlashCam": ["flashcam", "flash-cam", "msts", "MSTS"],
|
|
59
|
-
"NectarCam": ["nectarcam", "nectar-cam", "mstn", "MSTN"],
|
|
60
|
-
"SCT": ["sct", "scts", "SCTS"],
|
|
61
|
-
"LST": ["lst", "lsts", "LSTS", "lstn", "LSTN"],
|
|
62
|
-
"Camera": ["Camera", "camera"],
|
|
63
|
-
"Structure": ["Structure", "structure"],
|
|
64
|
-
"MAGIC": ["magic", "MAGIC"],
|
|
65
|
-
"VERITAS": ["veritas", "VERITAS"],
|
|
66
|
-
"HESS": ["hess", "HESS"],
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
all_site_names = {
|
|
70
|
-
"South": ["paranal", "south", "cta-south", "ctao-south", "s"],
|
|
71
|
-
"North": ["lapalma", "north", "cta-north", "ctao-north", "n"],
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
all_model_version_names = {
|
|
75
|
-
"2015-07-21": [""],
|
|
76
|
-
"2015-10-20-p1": [""],
|
|
77
|
-
"prod4-v0.0": [""],
|
|
78
|
-
"prod4-v0.1": [""],
|
|
79
|
-
"2018-02-16": [""],
|
|
80
|
-
"prod3_compatible": ["p3", "prod3", "prod3b"],
|
|
81
|
-
"prod4": ["p4"],
|
|
82
|
-
"post_prod3_updates": [""],
|
|
83
|
-
"2016-12-20": [""],
|
|
84
|
-
"2018-11-07": [""],
|
|
85
|
-
"2019-02-22": [""],
|
|
86
|
-
"2019-05-13": [""],
|
|
87
|
-
"2019-11-20": [""],
|
|
88
|
-
"2019-12-30": [""],
|
|
89
|
-
"2020-02-26": [""],
|
|
90
|
-
"2020-06-28": ["prod5"],
|
|
91
|
-
"prod4-prototype": [""],
|
|
92
|
-
"default": [],
|
|
93
|
-
"Released": [],
|
|
94
|
-
"Latest": [],
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
all_array_layout_names = {
|
|
98
|
-
"4LST": ["4-lst", "4lst"],
|
|
99
|
-
"1LST": ["1-lst", "1lst"],
|
|
100
|
-
"4MST": ["4-mst", "4mst"],
|
|
101
|
-
"1MST": ["1-mst", "mst"],
|
|
102
|
-
"4SST": ["4-sst", "4sst"],
|
|
103
|
-
"1SST": ["1-sst", "sst"],
|
|
104
|
-
"Prod5": ["prod5", "p5"],
|
|
105
|
-
"TestLayout": ["test-layout"],
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
# array elements as defined by CTAO
|
|
109
|
-
# (includes for now only telescopes;
|
|
110
|
-
# can be extended to other elements)
|
|
111
|
-
all_array_element_id_names = {
|
|
112
|
-
"lstn": ["LSTN", "lstn"],
|
|
113
|
-
"mstn": ["MSTN", "mstn"],
|
|
114
|
-
"lsts": ["LSTS", "lsts"],
|
|
115
|
-
"msts": ["MSTS", "msts"],
|
|
116
|
-
"ssts": ["SSTS", "ssts"],
|
|
117
|
-
"scts": ["SCTS", "scts"],
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def validate_sub_system_name(name):
|
|
122
|
-
"""
|
|
123
|
-
Validate a sub system name (optics structure or camera).
|
|
124
26
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
27
|
+
@cache
|
|
28
|
+
def array_elements():
|
|
29
|
+
"""
|
|
30
|
+
Load array elements from reference files and keep in cache.
|
|
129
31
|
|
|
130
32
|
Returns
|
|
131
33
|
-------
|
|
132
|
-
|
|
133
|
-
|
|
34
|
+
dict
|
|
35
|
+
Array elements.
|
|
134
36
|
"""
|
|
135
|
-
|
|
37
|
+
with open(files("simtools") / "schemas/array_elements.yml", encoding="utf-8") as file:
|
|
38
|
+
return yaml.safe_load(file)["data"]
|
|
136
39
|
|
|
137
40
|
|
|
138
|
-
|
|
41
|
+
@cache
|
|
42
|
+
def site_names():
|
|
139
43
|
"""
|
|
140
|
-
|
|
44
|
+
Site names from reference file.
|
|
141
45
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
name: str
|
|
145
|
-
Telescope class name.
|
|
46
|
+
The list of sites is derived from the sites listed in the model parameter
|
|
47
|
+
schema files. Return a dictionary for compatibility with the validation routines.
|
|
146
48
|
|
|
147
49
|
Returns
|
|
148
50
|
-------
|
|
149
|
-
|
|
150
|
-
|
|
51
|
+
dict
|
|
52
|
+
Site names.
|
|
151
53
|
"""
|
|
152
|
-
|
|
54
|
+
_array_elements = array_elements()
|
|
55
|
+
_sites = {entry["site"] for entry in _array_elements.values()}
|
|
56
|
+
return {site: [site.lower()] for site in _sites}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@cache
|
|
60
|
+
def load_model_parameters(class_key_list):
|
|
61
|
+
model_parameters = {}
|
|
62
|
+
schema_files = glob.glob(str(files("simtools") / "schemas/model_parameters") + "/*.yml")
|
|
63
|
+
for schema_file in schema_files:
|
|
64
|
+
with open(schema_file, encoding="utf-8") as f:
|
|
65
|
+
data = yaml.safe_load(f)
|
|
66
|
+
try:
|
|
67
|
+
if data["instrument"]["class"] in class_key_list:
|
|
68
|
+
model_parameters[data["name"]] = data
|
|
69
|
+
except KeyError:
|
|
70
|
+
pass
|
|
71
|
+
return model_parameters
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def site_parameters():
|
|
75
|
+
return load_model_parameters(class_key_list="Site")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def telescope_parameters():
|
|
79
|
+
return load_model_parameters(class_key_list=("Structure", "Camera", "Telescope"))
|
|
153
80
|
|
|
154
81
|
|
|
155
|
-
def
|
|
82
|
+
def validate_array_element_id_name(name):
|
|
156
83
|
"""
|
|
157
|
-
Validate
|
|
84
|
+
Validate array element ID.
|
|
158
85
|
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
86
|
+
Allowed IDs are
|
|
87
|
+
- design (for design array elements or testing)
|
|
88
|
+
- array element ID (e.g., 1, 5, 15)
|
|
89
|
+
- test (for testing)
|
|
162
90
|
|
|
163
91
|
Parameters
|
|
164
92
|
----------
|
|
165
93
|
name: str or int
|
|
166
|
-
|
|
94
|
+
Array element ID name.
|
|
167
95
|
|
|
168
96
|
Returns
|
|
169
97
|
-------
|
|
170
98
|
str
|
|
171
|
-
Validated
|
|
99
|
+
Validated array element ID (added leading zeros, e.g., 1 is converted to 01).
|
|
172
100
|
|
|
173
101
|
Raises
|
|
174
102
|
------
|
|
175
103
|
ValueError
|
|
176
104
|
If name is not valid.
|
|
177
105
|
"""
|
|
106
|
+
if isinstance(name, int) or name.isdigit():
|
|
107
|
+
return f"{int(name):02d}"
|
|
108
|
+
if name.lower() in ("design", "test"):
|
|
109
|
+
return str(name).lower()
|
|
178
110
|
|
|
179
|
-
|
|
180
|
-
return str(name).upper()
|
|
181
|
-
|
|
182
|
-
msg = f"Invalid telescope ID name {name}"
|
|
111
|
+
msg = f"Invalid array element ID name {name}"
|
|
183
112
|
_logger.error(msg)
|
|
184
113
|
raise ValueError(msg)
|
|
185
114
|
|
|
186
115
|
|
|
187
|
-
def validate_model_version_name(name):
|
|
188
|
-
"""
|
|
189
|
-
Validate a model version name.
|
|
190
|
-
|
|
191
|
-
Parameters
|
|
192
|
-
----------
|
|
193
|
-
name: str
|
|
194
|
-
Model version name.
|
|
195
|
-
|
|
196
|
-
Returns
|
|
197
|
-
-------
|
|
198
|
-
str
|
|
199
|
-
Validated name.
|
|
200
|
-
"""
|
|
201
|
-
return _validate_name(name, all_model_version_names)
|
|
202
|
-
|
|
203
|
-
|
|
204
116
|
def validate_site_name(name):
|
|
205
117
|
"""
|
|
206
|
-
Validate
|
|
118
|
+
Validate site name.
|
|
207
119
|
|
|
208
120
|
Parameters
|
|
209
121
|
----------
|
|
@@ -215,30 +127,15 @@ def validate_site_name(name):
|
|
|
215
127
|
str
|
|
216
128
|
Validated name.
|
|
217
129
|
"""
|
|
218
|
-
return _validate_name(name,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
def validate_array_layout_name(name):
|
|
222
|
-
"""
|
|
223
|
-
Validate a array layout name.
|
|
224
|
-
|
|
225
|
-
Parameters
|
|
226
|
-
----------
|
|
227
|
-
name: str
|
|
228
|
-
Layout array name.
|
|
229
|
-
|
|
230
|
-
Returns
|
|
231
|
-
-------
|
|
232
|
-
str
|
|
233
|
-
Validated name.
|
|
234
|
-
"""
|
|
235
|
-
return _validate_name(name, all_array_layout_names)
|
|
130
|
+
return _validate_name(name, site_names())
|
|
236
131
|
|
|
237
132
|
|
|
238
133
|
def _validate_name(name, all_names):
|
|
239
134
|
"""
|
|
240
|
-
Validate
|
|
241
|
-
|
|
135
|
+
Validate name given the all_names options.
|
|
136
|
+
|
|
137
|
+
For each key in all_names, a list of options is given.
|
|
138
|
+
If name is in this list, the key name is returned.
|
|
242
139
|
|
|
243
140
|
Parameters
|
|
244
141
|
----------
|
|
@@ -246,6 +143,7 @@ def _validate_name(name, all_names):
|
|
|
246
143
|
Name to validate.
|
|
247
144
|
all_names: dict
|
|
248
145
|
Dictionary with valid names.
|
|
146
|
+
|
|
249
147
|
Returns
|
|
250
148
|
-------
|
|
251
149
|
str
|
|
@@ -256,327 +154,257 @@ def _validate_name(name, all_names):
|
|
|
256
154
|
ValueError
|
|
257
155
|
If name is not valid.
|
|
258
156
|
"""
|
|
157
|
+
for key in all_names.keys():
|
|
158
|
+
if isinstance(all_names[key], list) and name.lower() in [
|
|
159
|
+
item.lower() for item in all_names[key]
|
|
160
|
+
]:
|
|
161
|
+
return key
|
|
162
|
+
if name.lower() == key.lower():
|
|
163
|
+
return key
|
|
259
164
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
raise ValueError(msg)
|
|
263
|
-
for main_name, list_of_names in all_names.items():
|
|
264
|
-
if name.lower() in list_of_names + [main_name.lower()]:
|
|
265
|
-
if name != main_name:
|
|
266
|
-
_logger.debug(f"Correcting name {name} -> {main_name}")
|
|
267
|
-
return main_name
|
|
268
|
-
return None
|
|
165
|
+
msg = f"Invalid name {name}"
|
|
166
|
+
raise ValueError(msg)
|
|
269
167
|
|
|
270
168
|
|
|
271
|
-
def
|
|
169
|
+
def validate_array_element_type(name):
|
|
272
170
|
"""
|
|
273
|
-
|
|
171
|
+
Validate array element type (e.g., LSTN, MSTN).
|
|
274
172
|
|
|
275
173
|
Parameters
|
|
276
174
|
----------
|
|
277
|
-
name:
|
|
278
|
-
|
|
279
|
-
all_names: dict
|
|
280
|
-
Dictionary with valid names.
|
|
175
|
+
name: str
|
|
176
|
+
Array element type.
|
|
281
177
|
|
|
282
178
|
Returns
|
|
283
179
|
-------
|
|
284
|
-
|
|
285
|
-
|
|
180
|
+
str
|
|
181
|
+
Validated name.
|
|
286
182
|
"""
|
|
287
|
-
|
|
288
|
-
if not isinstance(name, str):
|
|
289
|
-
return False
|
|
290
|
-
for main_name in all_names.keys():
|
|
291
|
-
if name.lower() in all_names[main_name] + [main_name.lower()]:
|
|
292
|
-
return True
|
|
293
|
-
return False
|
|
183
|
+
return _validate_name(name, array_elements())
|
|
294
184
|
|
|
295
185
|
|
|
296
|
-
def
|
|
186
|
+
def validate_array_element_name(name):
|
|
297
187
|
"""
|
|
298
|
-
Validate
|
|
188
|
+
Validate array element name (e.g., MSTN-design, MSTN-01).
|
|
299
189
|
|
|
300
190
|
Parameters
|
|
301
191
|
----------
|
|
302
192
|
name: str
|
|
303
|
-
|
|
193
|
+
Array element name.
|
|
304
194
|
|
|
305
195
|
Returns
|
|
306
196
|
-------
|
|
307
197
|
str
|
|
308
198
|
Validated name.
|
|
309
199
|
"""
|
|
310
|
-
|
|
311
|
-
# e.g, MSTN or MSTN-01
|
|
312
200
|
try:
|
|
313
|
-
|
|
314
|
-
except ValueError:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if len(tel_id) > 0:
|
|
323
|
-
_telescope_name += "-" + tel_id
|
|
324
|
-
return _telescope_name
|
|
201
|
+
_array_element_type, _array_element_id = name.split("-")
|
|
202
|
+
except ValueError as exc:
|
|
203
|
+
msg = f"Invalid name {name}"
|
|
204
|
+
raise ValueError(msg) from exc
|
|
205
|
+
return (
|
|
206
|
+
_validate_name(_array_element_type, array_elements())
|
|
207
|
+
+ "-"
|
|
208
|
+
+ validate_array_element_id_name(_array_element_id)
|
|
209
|
+
)
|
|
325
210
|
|
|
326
211
|
|
|
327
|
-
def
|
|
212
|
+
def get_array_element_name_from_type_site_id(array_element_type, site, array_element_id):
|
|
328
213
|
"""
|
|
329
|
-
|
|
330
|
-
Allow various inputs, e.g., MST-FlashCam-01, MST-FlashCam,
|
|
331
|
-
MSTN-01, MSTN, MST-1
|
|
214
|
+
Get array element name from type, site and ID.
|
|
332
215
|
|
|
333
216
|
Parameters
|
|
334
217
|
----------
|
|
335
|
-
|
|
336
|
-
|
|
218
|
+
array_element_type: str
|
|
219
|
+
Array element type.
|
|
220
|
+
site: str
|
|
221
|
+
Site name.
|
|
222
|
+
array_element_id: str
|
|
223
|
+
Array element ID.
|
|
337
224
|
|
|
338
225
|
Returns
|
|
339
226
|
-------
|
|
340
|
-
str
|
|
341
|
-
|
|
227
|
+
str
|
|
228
|
+
Array element name.
|
|
342
229
|
"""
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
_is_valid_name(name_parts[0], all_array_element_id_names)
|
|
347
|
-
return (
|
|
348
|
-
validate_telescope_class_name(name_parts[0][0:3]),
|
|
349
|
-
validate_sub_system_name(name_parts[0]),
|
|
350
|
-
validate_telescope_id_name(name_parts[1]) if len(name_parts) > 1 else "",
|
|
351
|
-
)
|
|
352
|
-
except ValueError:
|
|
353
|
-
pass
|
|
354
|
-
|
|
355
|
-
# e.g., MST-FlashCam or MST-FlashCam-01, MST-1
|
|
356
|
-
# (note that this complicated, as LST-1 is a valid
|
|
357
|
-
# name without explicit subsystem given in name)
|
|
358
|
-
tel_class = name_parts[0]
|
|
359
|
-
try:
|
|
360
|
-
tel_id = validate_telescope_id_name(name_parts[-1])
|
|
361
|
-
_tmp_tel_type = name_parts[1:-1]
|
|
362
|
-
except ValueError:
|
|
363
|
-
tel_id = ""
|
|
364
|
-
_tmp_tel_type = name_parts[1:]
|
|
365
|
-
if len(_tmp_tel_type) > 0:
|
|
366
|
-
tel_type = "-".join(_tmp_tel_type)
|
|
367
|
-
else:
|
|
368
|
-
try:
|
|
369
|
-
tel_type = validate_sub_system_name(tel_class)
|
|
370
|
-
except ValueError:
|
|
371
|
-
tel_type = ""
|
|
372
|
-
|
|
373
|
-
return (
|
|
374
|
-
validate_telescope_class_name(tel_class),
|
|
375
|
-
validate_sub_system_name(tel_type) if len(tel_type) > 0 else "",
|
|
376
|
-
validate_telescope_id_name(tel_id) if len(tel_id) > 0 else "",
|
|
377
|
-
)
|
|
230
|
+
_short_site = validate_site_name(site)[0]
|
|
231
|
+
_val_id = validate_array_element_id_name(array_element_id)
|
|
232
|
+
return f"{array_element_type}{_short_site}-{_val_id}"
|
|
378
233
|
|
|
379
234
|
|
|
380
|
-
def
|
|
235
|
+
def get_array_element_type_from_name(name):
|
|
381
236
|
"""
|
|
382
|
-
Get
|
|
237
|
+
Get array element type from name, e.g. "LSTN", "MSTN".
|
|
383
238
|
|
|
384
239
|
Parameters
|
|
385
240
|
----------
|
|
386
241
|
name: str
|
|
387
|
-
|
|
242
|
+
Array element name
|
|
388
243
|
|
|
389
244
|
Returns
|
|
390
245
|
-------
|
|
391
246
|
str
|
|
392
|
-
|
|
247
|
+
Array element type.
|
|
393
248
|
"""
|
|
394
|
-
|
|
395
|
-
try:
|
|
396
|
-
get_telescope_class(name)
|
|
397
|
-
return validate_site_name(name[3])
|
|
398
|
-
except ValueError:
|
|
399
|
-
pass
|
|
400
|
-
# e.g., South-MST-FlashCam
|
|
401
|
-
return validate_site_name(name.split("-")[0])
|
|
249
|
+
return _validate_name(name.split("-")[0], array_elements())
|
|
402
250
|
|
|
403
251
|
|
|
404
|
-
def
|
|
252
|
+
def get_list_of_array_element_types(
|
|
253
|
+
array_element_class="telescopes", site=None, observatory="CTAO"
|
|
254
|
+
):
|
|
405
255
|
"""
|
|
406
|
-
|
|
407
|
-
Examples are North-LST-1, North-MST-NectarCam-D, or South-SST-Structure-D.
|
|
256
|
+
Get list of array element types.
|
|
408
257
|
|
|
409
258
|
Parameters
|
|
410
259
|
----------
|
|
411
|
-
|
|
260
|
+
array_element_class: str
|
|
261
|
+
Array element class
|
|
262
|
+
site: str
|
|
263
|
+
Site name (e.g., South or North).
|
|
412
264
|
|
|
413
265
|
Returns
|
|
414
266
|
-------
|
|
415
|
-
|
|
416
|
-
|
|
267
|
+
list
|
|
268
|
+
List of array element types.
|
|
417
269
|
"""
|
|
418
|
-
|
|
419
|
-
|
|
270
|
+
return [
|
|
271
|
+
key
|
|
272
|
+
for key, value in array_elements().items()
|
|
273
|
+
if value["collection"] == array_element_class
|
|
274
|
+
and (site is None or value["site"] == site)
|
|
275
|
+
and (observatory is None or value["observatory"] == observatory)
|
|
276
|
+
]
|
|
420
277
|
|
|
421
|
-
return f"{validate_site_name(site)}-{validate_telescope_model_name(tel_model_name)}"
|
|
422
278
|
|
|
423
|
-
|
|
424
|
-
def convert_telescope_model_name_to_yaml_name(name):
|
|
279
|
+
def get_site_from_array_element_name(name):
|
|
425
280
|
"""
|
|
426
|
-
Get
|
|
281
|
+
Get site name from array element name.
|
|
427
282
|
|
|
428
283
|
Parameters
|
|
429
284
|
----------
|
|
430
285
|
name: str
|
|
431
|
-
|
|
286
|
+
Array element name.
|
|
432
287
|
|
|
433
288
|
Returns
|
|
434
289
|
-------
|
|
435
290
|
str
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
Raises
|
|
439
|
-
------
|
|
440
|
-
ValueError
|
|
441
|
-
if name is not valid.
|
|
291
|
+
Site name (South or North).
|
|
442
292
|
"""
|
|
443
|
-
|
|
444
|
-
new_name = tel_class if tel_class == tel_type else tel_class + "-" + tel_type
|
|
445
|
-
new_name = new_name + "-" + tel_id if len(tel_id) > 0 else new_name
|
|
446
|
-
old_names = {
|
|
447
|
-
"SST-D": "SST",
|
|
448
|
-
"SST-1M": "SST-1M",
|
|
449
|
-
"SST-ASTRI": "SST-2M-ASTRI",
|
|
450
|
-
"SST-GCT": "SST-2M-GCT-S",
|
|
451
|
-
"MST-FlashCam-D": "MST-FlashCam",
|
|
452
|
-
"MST-NectarCam-D": "MST-NectarCam",
|
|
453
|
-
"SCT-D": "SCT",
|
|
454
|
-
"LST-D234": "LST",
|
|
455
|
-
"LST-1": "LST",
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if new_name not in old_names:
|
|
459
|
-
raise ValueError(f"Telescope name {name}/{new_name} could not be converted to yml names")
|
|
460
|
-
|
|
461
|
-
return old_names[new_name]
|
|
293
|
+
return array_elements()[get_array_element_type_from_name(name)]["site"]
|
|
462
294
|
|
|
463
295
|
|
|
464
|
-
def
|
|
296
|
+
def get_collection_name_from_array_element_name(name):
|
|
465
297
|
"""
|
|
466
|
-
|
|
467
|
-
This returns e.g., "LSTN" for any LST telescope in the North site.
|
|
468
|
-
If a telescope number is given, it adds it as e.g., "LSTN-01".
|
|
298
|
+
Get collection name (e.g., telescopes, calibration_devices, sites) of array element from name.
|
|
469
299
|
|
|
470
300
|
Parameters
|
|
471
301
|
----------
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
telescope_class_name: str
|
|
475
|
-
Name of the telescope class (e.g. LST-1, LST-D234, MST-FlashCam-D, ...)
|
|
302
|
+
name: str
|
|
303
|
+
Array element name.
|
|
476
304
|
|
|
477
305
|
Returns
|
|
478
306
|
-------
|
|
479
307
|
str
|
|
480
|
-
|
|
481
|
-
|
|
308
|
+
Collection name .
|
|
482
309
|
"""
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
310
|
+
try:
|
|
311
|
+
return array_elements()[get_array_element_type_from_name(name)]["collection"]
|
|
312
|
+
except ValueError:
|
|
313
|
+
pass
|
|
314
|
+
try:
|
|
315
|
+
validate_site_name(name)
|
|
316
|
+
return "sites"
|
|
317
|
+
except ValueError as exc:
|
|
318
|
+
raise ValueError(f"Invalid array element name {name}: {exc}") from exc
|
|
489
319
|
|
|
490
320
|
|
|
491
|
-
def
|
|
492
|
-
|
|
321
|
+
def get_simulation_software_name_from_parameter_name(
|
|
322
|
+
par_name,
|
|
323
|
+
simulation_software="sim_telarray",
|
|
324
|
+
search_telescope_parameters=True,
|
|
325
|
+
search_site_parameters=True,
|
|
493
326
|
):
|
|
494
327
|
"""
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
328
|
+
Get the name used in the simulation software from the model parameter name.
|
|
329
|
+
|
|
330
|
+
Name convention is expected to be defined in the schema.
|
|
331
|
+
Returns the parameter name if no simulation software name is found.
|
|
498
332
|
|
|
499
333
|
Parameters
|
|
500
334
|
----------
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
335
|
+
par_name: str
|
|
336
|
+
Model parameter name.
|
|
337
|
+
simulation_software: str
|
|
338
|
+
Simulation software name.
|
|
339
|
+
search_telescope_parameters: bool
|
|
340
|
+
If True, telescope model parameters are included.
|
|
341
|
+
search_site_parameters: bool
|
|
342
|
+
If True, site model parameters are included.
|
|
505
343
|
|
|
506
344
|
Returns
|
|
507
345
|
-------
|
|
508
346
|
str
|
|
509
|
-
|
|
347
|
+
Simtel parameter name.
|
|
510
348
|
"""
|
|
349
|
+
_parameter_names = {}
|
|
350
|
+
if search_telescope_parameters:
|
|
351
|
+
_parameter_names.update(telescope_parameters())
|
|
352
|
+
if search_site_parameters:
|
|
353
|
+
_parameter_names.update(site_parameters())
|
|
511
354
|
|
|
512
|
-
name_parts = array_element_id.split("-")
|
|
513
355
|
try:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
356
|
+
_parameter = _parameter_names[par_name]
|
|
357
|
+
except KeyError as err:
|
|
358
|
+
_logger.error(f"Parameter {par_name} without schema definition")
|
|
359
|
+
raise err
|
|
360
|
+
|
|
519
361
|
try:
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
elif _class == "MST" and sub_system_name.lower() == "camera":
|
|
527
|
-
sub_system_name = "NectarCam" if _site == "North" else "FlashCam"
|
|
528
|
-
|
|
529
|
-
_simtools_name = get_telescope_name_db(
|
|
530
|
-
site=_site,
|
|
531
|
-
telescope_class_name=_class,
|
|
532
|
-
sub_system_name=sub_system_name,
|
|
533
|
-
telescope_id_name=_id,
|
|
534
|
-
)
|
|
535
|
-
if available_telescopes is not None and _simtools_name not in available_telescopes:
|
|
536
|
-
_logger.debug("Telescope %s not available", _simtools_name)
|
|
537
|
-
_simtools_name = get_telescope_name_db(
|
|
538
|
-
site=_site,
|
|
539
|
-
telescope_class_name=_class,
|
|
540
|
-
sub_system_name=sub_system_name,
|
|
541
|
-
telescope_id_name="D234" if _site == "North" and _class == "LST" else "D",
|
|
542
|
-
)
|
|
543
|
-
return _simtools_name.split("-", 1)[1]
|
|
362
|
+
for software in _parameter.get("simulation_software", []):
|
|
363
|
+
if software.get("name") == simulation_software:
|
|
364
|
+
return software.get("internal_parameter_name", par_name)
|
|
365
|
+
except TypeError: # catches cases for which 'simulation_software' is None
|
|
366
|
+
pass
|
|
367
|
+
return None
|
|
544
368
|
|
|
545
369
|
|
|
546
|
-
def
|
|
370
|
+
def get_parameter_name_from_simtel_name(simtel_name):
|
|
547
371
|
"""
|
|
548
|
-
|
|
549
|
-
|
|
372
|
+
Get the model parameter name from the simtel parameter name.
|
|
373
|
+
|
|
374
|
+
Assumes that both names are equal if not defined otherwise in names.py.
|
|
550
375
|
|
|
551
376
|
Parameters
|
|
552
377
|
----------
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
telescope_class_name: str
|
|
556
|
-
LST, MST, ...
|
|
557
|
-
sub_system_name: str or None
|
|
558
|
-
FlashCam, NectarCam, Structure
|
|
559
|
-
telescope_id_name: str
|
|
560
|
-
telescope ID (e.g., D, numerical value)
|
|
378
|
+
simtel_name: str
|
|
379
|
+
Simtel parameter name.
|
|
561
380
|
|
|
562
381
|
Returns
|
|
563
382
|
-------
|
|
564
|
-
|
|
565
|
-
|
|
383
|
+
str
|
|
384
|
+
Model parameter name.
|
|
566
385
|
"""
|
|
386
|
+
_parameters = {**telescope_parameters(), **site_parameters()}
|
|
567
387
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
388
|
+
for par_name, par_info in _parameters.items():
|
|
389
|
+
try:
|
|
390
|
+
for software in par_info["simulation_software"]:
|
|
391
|
+
if (
|
|
392
|
+
software["name"] == "sim_telarray"
|
|
393
|
+
and software["internal_parameter_name"] == simtel_name
|
|
394
|
+
):
|
|
395
|
+
return par_name
|
|
396
|
+
except (KeyError, TypeError): # catches cases for which 'simulation_software' is None
|
|
397
|
+
pass
|
|
398
|
+
return simtel_name
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def simtel_config_file_name(
|
|
402
|
+
site,
|
|
403
|
+
model_version,
|
|
404
|
+
array_name=None,
|
|
405
|
+
telescope_model_name=None,
|
|
406
|
+
label=None,
|
|
407
|
+
extra_label=None,
|
|
580
408
|
):
|
|
581
409
|
"""
|
|
582
410
|
sim_telarray config file name for a telescope.
|
|
@@ -599,39 +427,17 @@ def simtel_telescope_config_file_name(
|
|
|
599
427
|
str
|
|
600
428
|
File name.
|
|
601
429
|
"""
|
|
602
|
-
name =
|
|
430
|
+
name = "CTA"
|
|
431
|
+
name += f"-{array_name}" if array_name is not None else ""
|
|
432
|
+
name += f"-{site}"
|
|
433
|
+
name += f"-{telescope_model_name}" if telescope_model_name is not None else ""
|
|
434
|
+
name += f"-{model_version}"
|
|
603
435
|
name += f"_{label}" if label is not None else ""
|
|
604
436
|
name += f"_{extra_label}" if extra_label is not None else ""
|
|
605
437
|
name += ".cfg"
|
|
606
438
|
return name
|
|
607
439
|
|
|
608
440
|
|
|
609
|
-
def simtel_array_config_file_name(array_name, site, model_version, label):
|
|
610
|
-
"""
|
|
611
|
-
sim_telarray config file name for an array.
|
|
612
|
-
|
|
613
|
-
Parameters
|
|
614
|
-
----------
|
|
615
|
-
array_name: str
|
|
616
|
-
Prod5, ...
|
|
617
|
-
site: str
|
|
618
|
-
South or North.
|
|
619
|
-
model_version: str
|
|
620
|
-
Version of the model.
|
|
621
|
-
label: str
|
|
622
|
-
Instance label.
|
|
623
|
-
|
|
624
|
-
Returns
|
|
625
|
-
-------
|
|
626
|
-
str
|
|
627
|
-
File name.
|
|
628
|
-
"""
|
|
629
|
-
name = f"CTA-{array_name}-{site}-{model_version}"
|
|
630
|
-
name += f"_{label}" if label is not None else ""
|
|
631
|
-
name += ".cfg"
|
|
632
|
-
return name
|
|
633
|
-
|
|
634
|
-
|
|
635
441
|
def simtel_single_mirror_list_file_name(
|
|
636
442
|
site, telescope_model_name, model_version, mirror_number, label
|
|
637
443
|
):
|
|
@@ -685,258 +491,66 @@ def layout_telescope_list_file_name(name, label):
|
|
|
685
491
|
return file_name
|
|
686
492
|
|
|
687
493
|
|
|
688
|
-
def
|
|
494
|
+
def generate_file_name(
|
|
495
|
+
file_type,
|
|
496
|
+
suffix,
|
|
689
497
|
site,
|
|
690
498
|
telescope_model_name,
|
|
691
|
-
source_distance,
|
|
692
499
|
zenith_angle,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
500
|
+
azimuth_angle=None,
|
|
501
|
+
off_axis_angle=None,
|
|
502
|
+
source_distance=None,
|
|
503
|
+
mirror_number=None,
|
|
504
|
+
label=None,
|
|
505
|
+
extra_label=None,
|
|
697
506
|
):
|
|
698
507
|
"""
|
|
699
|
-
|
|
508
|
+
Generate a file name for output, config, or plotting.
|
|
509
|
+
|
|
510
|
+
Used e.g., to generate camera-efficiency and ray-tracing output files.
|
|
700
511
|
|
|
701
512
|
Parameters
|
|
702
513
|
----------
|
|
514
|
+
file_type: str
|
|
515
|
+
Type of file (e.g., config, output, plot)
|
|
516
|
+
suffix: str
|
|
517
|
+
File suffix
|
|
703
518
|
site: str
|
|
704
519
|
South or North.
|
|
705
520
|
telescope_model_name: str
|
|
706
|
-
|
|
707
|
-
source_distance: float
|
|
708
|
-
Source distance (km).
|
|
521
|
+
LSTN-01, MSTS-01, ...
|
|
709
522
|
zenith_angle: float
|
|
710
523
|
Zenith angle (deg).
|
|
524
|
+
azimuth_angle: float
|
|
525
|
+
Azimuth angle (deg).
|
|
711
526
|
off_axis_angle: float
|
|
712
527
|
Off-axis angle (deg).
|
|
713
|
-
mirror_number: int
|
|
714
|
-
Mirror number. None if not single mirror case.
|
|
715
|
-
label: str
|
|
716
|
-
Instance label.
|
|
717
|
-
base: str
|
|
718
|
-
Photons, stars or log.
|
|
719
|
-
|
|
720
|
-
Returns
|
|
721
|
-
-------
|
|
722
|
-
str
|
|
723
|
-
File name.
|
|
724
|
-
"""
|
|
725
|
-
name = (
|
|
726
|
-
f"{base}-{site}-{telescope_model_name}-d{source_distance:.1f}"
|
|
727
|
-
f"-za{zenith_angle:.1f}-off{off_axis_angle:.3f}"
|
|
728
|
-
)
|
|
729
|
-
name += f"_mirror{mirror_number}" if mirror_number is not None else ""
|
|
730
|
-
name += f"_{label}" if label is not None else ""
|
|
731
|
-
name += ".log" if base == "log" else ".lis"
|
|
732
|
-
return name
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
def ray_tracing_results_file_name(site, telescope_model_name, source_distance, zenith_angle, label):
|
|
736
|
-
"""
|
|
737
|
-
Ray tracing results file name.
|
|
738
|
-
|
|
739
|
-
Parameters
|
|
740
|
-
----------
|
|
741
|
-
site: str
|
|
742
|
-
South or North.
|
|
743
|
-
telescope_model_name: str
|
|
744
|
-
LST-1, MST-FlashCam, ...
|
|
745
528
|
source_distance: float
|
|
746
529
|
Source distance (km).
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
label: str
|
|
750
|
-
Instance label.
|
|
751
|
-
|
|
752
|
-
Returns
|
|
753
|
-
-------
|
|
754
|
-
str
|
|
755
|
-
File name.
|
|
756
|
-
"""
|
|
757
|
-
name = f"ray-tracing-{site}-{telescope_model_name}-d{source_distance:.1f}-za{zenith_angle:.1f}"
|
|
758
|
-
name += f"_{label}" if label is not None else ""
|
|
759
|
-
name += ".ecsv"
|
|
760
|
-
return name
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
def ray_tracing_plot_file_name(
|
|
764
|
-
key, site, telescope_model_name, source_distance, zenith_angle, label
|
|
765
|
-
):
|
|
766
|
-
"""
|
|
767
|
-
Ray tracing plot file name.
|
|
768
|
-
|
|
769
|
-
Parameters
|
|
770
|
-
----------
|
|
771
|
-
key: str
|
|
772
|
-
Quantity to be plotted (d80_cm, d80_deg, eff_area or eff_flen)
|
|
773
|
-
site: str
|
|
774
|
-
South or North.
|
|
775
|
-
telescope_model_name: str
|
|
776
|
-
LST-1, MST-FlashCam, ...
|
|
777
|
-
source_distance: float
|
|
778
|
-
Source distance (km).
|
|
779
|
-
zenith_angle: float
|
|
780
|
-
Zenith angle (deg).
|
|
530
|
+
mirror_number: int
|
|
531
|
+
Mirror number.
|
|
781
532
|
label: str
|
|
782
533
|
Instance label.
|
|
534
|
+
extra_label: str
|
|
535
|
+
Extra label.
|
|
783
536
|
|
|
784
537
|
Returns
|
|
785
538
|
-------
|
|
786
539
|
str
|
|
787
540
|
File name.
|
|
788
541
|
"""
|
|
789
|
-
name =
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
542
|
+
name = f"{file_type}-{site}-{telescope_model_name}"
|
|
543
|
+
name += f"-d{source_distance:.1f}km" if source_distance is not None else ""
|
|
544
|
+
name += f"-za{float(zenith_angle):.1f}deg"
|
|
545
|
+
name += f"-off{off_axis_angle:.3f}deg" if off_axis_angle is not None else ""
|
|
546
|
+
name += f"_azm{round(azimuth_angle):03}deg" if azimuth_angle is not None else ""
|
|
547
|
+
name += f"_mirror{mirror_number}" if mirror_number is not None else ""
|
|
793
548
|
name += f"_{label}" if label is not None else ""
|
|
794
|
-
name += "
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
def camera_efficiency_results_file_name(
|
|
799
|
-
site, telescope_model_name, zenith_angle, azimuth_angle, label
|
|
800
|
-
):
|
|
801
|
-
"""
|
|
802
|
-
Camera efficiency results file name.
|
|
803
|
-
|
|
804
|
-
Parameters
|
|
805
|
-
----------
|
|
806
|
-
site: str
|
|
807
|
-
South or North.
|
|
808
|
-
telescope_model_name: str
|
|
809
|
-
LST-1, MST-FlashCam, ...
|
|
810
|
-
zenith_angle: float
|
|
811
|
-
Zenith angle (deg).
|
|
812
|
-
azimuth_angle: float
|
|
813
|
-
Azimuth angle (deg).
|
|
814
|
-
label: str
|
|
815
|
-
Instance label.
|
|
816
|
-
|
|
817
|
-
Returns
|
|
818
|
-
-------
|
|
819
|
-
str
|
|
820
|
-
File name.
|
|
821
|
-
"""
|
|
822
|
-
_label = f"_{label}" if label is not None else ""
|
|
823
|
-
name = (
|
|
824
|
-
f"camera-efficiency-table-{site}-{telescope_model_name}-"
|
|
825
|
-
f"za{round(zenith_angle):03}deg_azm{round(azimuth_angle):03}deg"
|
|
826
|
-
f"{_label}.ecsv"
|
|
827
|
-
)
|
|
828
|
-
return name
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
def camera_efficiency_simtel_file_name(
|
|
832
|
-
site, telescope_model_name, zenith_angle, azimuth_angle, label
|
|
833
|
-
):
|
|
834
|
-
"""
|
|
835
|
-
Camera efficiency simtel output file name.
|
|
836
|
-
|
|
837
|
-
Parameters
|
|
838
|
-
----------
|
|
839
|
-
site: str
|
|
840
|
-
South or North.
|
|
841
|
-
telescope_model_name: str
|
|
842
|
-
LST-1, MST-FlashCam-D, ...
|
|
843
|
-
zenith_angle: float
|
|
844
|
-
Zenith angle (deg).
|
|
845
|
-
azimuth_angle: float
|
|
846
|
-
Azimuth angle (deg).
|
|
847
|
-
label: str
|
|
848
|
-
Instance label.
|
|
849
|
-
|
|
850
|
-
Returns
|
|
851
|
-
-------
|
|
852
|
-
str
|
|
853
|
-
File name.
|
|
854
|
-
"""
|
|
855
|
-
_label = f"_{label}" if label is not None else ""
|
|
856
|
-
name = (
|
|
857
|
-
f"camera-efficiency-{site}-{telescope_model_name}-"
|
|
858
|
-
f"za{round(zenith_angle):03}deg_azm{round(azimuth_angle):03}deg"
|
|
859
|
-
f"{_label}.dat"
|
|
860
|
-
)
|
|
861
|
-
return name
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
def camera_efficiency_log_file_name(site, telescope_model_name, zenith_angle, azimuth_angle, label):
|
|
865
|
-
"""
|
|
866
|
-
Camera efficiency log file name.
|
|
867
|
-
|
|
868
|
-
Parameters
|
|
869
|
-
----------
|
|
870
|
-
site: str
|
|
871
|
-
South or North.
|
|
872
|
-
telescope_model_name: str
|
|
873
|
-
LST-1, MST-FlashCam-D, ...
|
|
874
|
-
zenith_angle: float
|
|
875
|
-
Zenith angle (deg).
|
|
876
|
-
azimuth_angle: float
|
|
877
|
-
Azimuth angle (deg).
|
|
878
|
-
label: str
|
|
879
|
-
Instance label.
|
|
880
|
-
|
|
881
|
-
Returns
|
|
882
|
-
-------
|
|
883
|
-
str
|
|
884
|
-
File name.
|
|
885
|
-
"""
|
|
886
|
-
_label = f"_{label}" if label is not None else ""
|
|
887
|
-
name = (
|
|
888
|
-
f"camera-efficiency-{site}-{telescope_model_name}"
|
|
889
|
-
f"-za{round(zenith_angle):03}deg_azm{round(azimuth_angle):03}deg"
|
|
890
|
-
f"{_label}.log"
|
|
891
|
-
)
|
|
549
|
+
name += f"_{extra_label}" if extra_label is not None else ""
|
|
550
|
+
name += f"{suffix}"
|
|
892
551
|
return name
|
|
893
552
|
|
|
894
553
|
|
|
895
|
-
def get_telescope_class(telescope_name):
|
|
896
|
-
"""
|
|
897
|
-
Guess telescope class from name, e.g. "LST", "MST", ...
|
|
898
|
-
|
|
899
|
-
Parameters
|
|
900
|
-
----------
|
|
901
|
-
telescope_name: str
|
|
902
|
-
Telescope name
|
|
903
|
-
|
|
904
|
-
Returns
|
|
905
|
-
-------
|
|
906
|
-
str
|
|
907
|
-
Telescope type.
|
|
908
|
-
"""
|
|
909
|
-
|
|
910
|
-
_tel_class, _, _ = split_telescope_model_name(telescope_name)
|
|
911
|
-
return _tel_class
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
def translate_simtools_to_corsika(simtools_par):
|
|
915
|
-
"""
|
|
916
|
-
Translate the name of a simtools parameter to the name used in CORSIKA.
|
|
917
|
-
|
|
918
|
-
TODO - this will go with the new simulation model
|
|
919
|
-
|
|
920
|
-
Parameters
|
|
921
|
-
----------
|
|
922
|
-
simtools_par: str
|
|
923
|
-
Name of the simtools parameter to be translated.
|
|
924
|
-
"""
|
|
925
|
-
|
|
926
|
-
corsika_to_simtools_names = {"OBSLEV": "corsika_obs_level"}
|
|
927
|
-
|
|
928
|
-
simtools_to_corsika_names = {
|
|
929
|
-
new_key: new_value for new_value, new_key in corsika_to_simtools_names.items()
|
|
930
|
-
}
|
|
931
|
-
try:
|
|
932
|
-
return simtools_to_corsika_names[simtools_par]
|
|
933
|
-
except KeyError:
|
|
934
|
-
msg = f"Translation not found. We will proceed with the original parameter name:\
|
|
935
|
-
{simtools_par}."
|
|
936
|
-
_logger.debug(msg)
|
|
937
|
-
return simtools_par
|
|
938
|
-
|
|
939
|
-
|
|
940
554
|
def sanitize_name(name):
|
|
941
555
|
"""
|
|
942
556
|
Sanitize name to be a valid Python identifier.
|
|
@@ -959,9 +573,8 @@ def sanitize_name(name):
|
|
|
959
573
|
Raises
|
|
960
574
|
------
|
|
961
575
|
ValueError:
|
|
962
|
-
if the string
|
|
576
|
+
if the string name can not be sanitized.
|
|
963
577
|
"""
|
|
964
|
-
|
|
965
578
|
# Convert to lowercase
|
|
966
579
|
sanitized = name.lower()
|
|
967
580
|
|
|
@@ -973,5 +586,5 @@ def sanitize_name(name):
|
|
|
973
586
|
if not sanitized.isidentifier():
|
|
974
587
|
msg = f"The string {name} could not be sanitized."
|
|
975
588
|
_logger.error(msg)
|
|
976
|
-
raise ValueError
|
|
589
|
+
raise ValueError(msg)
|
|
977
590
|
return sanitized
|