gammasimtools 0.6.1__py3-none-any.whl → 0.8.1__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.1.dist-info/METADATA +172 -0
- gammasimtools-0.8.1.dist-info/RECORD +346 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.1.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.1.dist-info/entry_points.txt +31 -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 +113 -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 +210 -184
- 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 +305 -256
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +233 -493
- simtools/model/mirrors.py +61 -44
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +7 -35
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +127 -621
- 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 +258 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +2 -0
- 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/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.1.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.1.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
simtools/utils/names.py
CHANGED
|
@@ -1,209 +1,122 @@
|
|
|
1
|
+
"""Validation of names."""
|
|
2
|
+
|
|
3
|
+
import glob
|
|
1
4
|
import logging
|
|
2
5
|
import re
|
|
6
|
+
from functools import cache
|
|
7
|
+
from pathlib import Path
|
|
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
|
+
base_path = Path(__file__).parent
|
|
38
|
+
with open(base_path / "../schemas/array_elements.yml", encoding="utf-8") as file:
|
|
39
|
+
return yaml.safe_load(file)["data"]
|
|
136
40
|
|
|
137
41
|
|
|
138
|
-
|
|
42
|
+
@cache
|
|
43
|
+
def site_names():
|
|
139
44
|
"""
|
|
140
|
-
|
|
45
|
+
Site names from reference file.
|
|
141
46
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
name: str
|
|
145
|
-
Telescope class name.
|
|
47
|
+
The list of sites is derived from the sites listed in the model parameter
|
|
48
|
+
schema files. Return a dictionary for compatibility with the validation routines.
|
|
146
49
|
|
|
147
50
|
Returns
|
|
148
51
|
-------
|
|
149
|
-
|
|
150
|
-
|
|
52
|
+
dict
|
|
53
|
+
Site names.
|
|
151
54
|
"""
|
|
152
|
-
|
|
55
|
+
_array_elements = array_elements()
|
|
56
|
+
_sites = {entry["site"] for entry in _array_elements.values()}
|
|
57
|
+
return {site: [site.lower()] for site in _sites}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@cache
|
|
61
|
+
def load_model_parameters(class_key_list):
|
|
62
|
+
model_parameters = {}
|
|
63
|
+
schema_files = glob.glob(str(Path(__file__).parent / "../schemas/model_parameters") + "/*.yml")
|
|
64
|
+
for schema_file in schema_files:
|
|
65
|
+
with open(schema_file, encoding="utf-8") as f:
|
|
66
|
+
data = yaml.safe_load(f)
|
|
67
|
+
try:
|
|
68
|
+
if data["instrument"]["class"] in class_key_list:
|
|
69
|
+
model_parameters[data["name"]] = data
|
|
70
|
+
except KeyError:
|
|
71
|
+
pass
|
|
72
|
+
return model_parameters
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def site_parameters():
|
|
76
|
+
return load_model_parameters(class_key_list="Site")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def telescope_parameters():
|
|
80
|
+
return load_model_parameters(class_key_list=("Structure", "Camera", "Telescope"))
|
|
153
81
|
|
|
154
82
|
|
|
155
|
-
def
|
|
83
|
+
def validate_array_element_id_name(name):
|
|
156
84
|
"""
|
|
157
|
-
Validate
|
|
85
|
+
Validate array element ID.
|
|
158
86
|
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
87
|
+
Allowed IDs are
|
|
88
|
+
- design (for design array elements or testing)
|
|
89
|
+
- array element ID (e.g., 1, 5, 15)
|
|
90
|
+
- test (for testing)
|
|
162
91
|
|
|
163
92
|
Parameters
|
|
164
93
|
----------
|
|
165
94
|
name: str or int
|
|
166
|
-
|
|
95
|
+
Array element ID name.
|
|
167
96
|
|
|
168
97
|
Returns
|
|
169
98
|
-------
|
|
170
99
|
str
|
|
171
|
-
Validated
|
|
100
|
+
Validated array element ID (added leading zeros, e.g., 1 is converted to 01).
|
|
172
101
|
|
|
173
102
|
Raises
|
|
174
103
|
------
|
|
175
104
|
ValueError
|
|
176
105
|
If name is not valid.
|
|
177
106
|
"""
|
|
107
|
+
if isinstance(name, int) or name.isdigit():
|
|
108
|
+
return f"{int(name):02d}"
|
|
109
|
+
if name.lower() in ("design", "test"):
|
|
110
|
+
return str(name).lower()
|
|
178
111
|
|
|
179
|
-
|
|
180
|
-
return str(name).upper()
|
|
181
|
-
|
|
182
|
-
msg = f"Invalid telescope ID name {name}"
|
|
112
|
+
msg = f"Invalid array element ID name {name}"
|
|
183
113
|
_logger.error(msg)
|
|
184
114
|
raise ValueError(msg)
|
|
185
115
|
|
|
186
116
|
|
|
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
117
|
def validate_site_name(name):
|
|
205
118
|
"""
|
|
206
|
-
Validate
|
|
119
|
+
Validate site name.
|
|
207
120
|
|
|
208
121
|
Parameters
|
|
209
122
|
----------
|
|
@@ -215,30 +128,15 @@ def validate_site_name(name):
|
|
|
215
128
|
str
|
|
216
129
|
Validated name.
|
|
217
130
|
"""
|
|
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)
|
|
131
|
+
return _validate_name(name, site_names())
|
|
236
132
|
|
|
237
133
|
|
|
238
134
|
def _validate_name(name, all_names):
|
|
239
135
|
"""
|
|
240
|
-
Validate
|
|
241
|
-
|
|
136
|
+
Validate name given the all_names options.
|
|
137
|
+
|
|
138
|
+
For each key in all_names, a list of options is given.
|
|
139
|
+
If name is in this list, the key name is returned.
|
|
242
140
|
|
|
243
141
|
Parameters
|
|
244
142
|
----------
|
|
@@ -246,6 +144,7 @@ def _validate_name(name, all_names):
|
|
|
246
144
|
Name to validate.
|
|
247
145
|
all_names: dict
|
|
248
146
|
Dictionary with valid names.
|
|
147
|
+
|
|
249
148
|
Returns
|
|
250
149
|
-------
|
|
251
150
|
str
|
|
@@ -256,327 +155,257 @@ def _validate_name(name, all_names):
|
|
|
256
155
|
ValueError
|
|
257
156
|
If name is not valid.
|
|
258
157
|
"""
|
|
158
|
+
for key in all_names.keys():
|
|
159
|
+
if isinstance(all_names[key], list) and name.lower() in [
|
|
160
|
+
item.lower() for item in all_names[key]
|
|
161
|
+
]:
|
|
162
|
+
return key
|
|
163
|
+
if name.lower() == key.lower():
|
|
164
|
+
return key
|
|
259
165
|
|
|
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
|
|
166
|
+
msg = f"Invalid name {name}"
|
|
167
|
+
raise ValueError(msg)
|
|
269
168
|
|
|
270
169
|
|
|
271
|
-
def
|
|
170
|
+
def validate_array_element_type(name):
|
|
272
171
|
"""
|
|
273
|
-
|
|
172
|
+
Validate array element type (e.g., LSTN, MSTN).
|
|
274
173
|
|
|
275
174
|
Parameters
|
|
276
175
|
----------
|
|
277
|
-
name:
|
|
278
|
-
|
|
279
|
-
all_names: dict
|
|
280
|
-
Dictionary with valid names.
|
|
176
|
+
name: str
|
|
177
|
+
Array element type.
|
|
281
178
|
|
|
282
179
|
Returns
|
|
283
180
|
-------
|
|
284
|
-
|
|
285
|
-
|
|
181
|
+
str
|
|
182
|
+
Validated name.
|
|
286
183
|
"""
|
|
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
|
|
184
|
+
return _validate_name(name, array_elements())
|
|
294
185
|
|
|
295
186
|
|
|
296
|
-
def
|
|
187
|
+
def validate_array_element_name(name):
|
|
297
188
|
"""
|
|
298
|
-
Validate
|
|
189
|
+
Validate array element name (e.g., MSTN-design, MSTN-01).
|
|
299
190
|
|
|
300
191
|
Parameters
|
|
301
192
|
----------
|
|
302
193
|
name: str
|
|
303
|
-
|
|
194
|
+
Array element name.
|
|
304
195
|
|
|
305
196
|
Returns
|
|
306
197
|
-------
|
|
307
198
|
str
|
|
308
199
|
Validated name.
|
|
309
200
|
"""
|
|
310
|
-
|
|
311
|
-
# e.g, MSTN or MSTN-01
|
|
312
201
|
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
|
|
202
|
+
_array_element_type, _array_element_id = name.split("-")
|
|
203
|
+
except ValueError as exc:
|
|
204
|
+
msg = f"Invalid name {name}"
|
|
205
|
+
raise ValueError(msg) from exc
|
|
206
|
+
return (
|
|
207
|
+
_validate_name(_array_element_type, array_elements())
|
|
208
|
+
+ "-"
|
|
209
|
+
+ validate_array_element_id_name(_array_element_id)
|
|
210
|
+
)
|
|
325
211
|
|
|
326
212
|
|
|
327
|
-
def
|
|
213
|
+
def get_array_element_name_from_type_site_id(array_element_type, site, array_element_id):
|
|
328
214
|
"""
|
|
329
|
-
|
|
330
|
-
Allow various inputs, e.g., MST-FlashCam-01, MST-FlashCam,
|
|
331
|
-
MSTN-01, MSTN, MST-1
|
|
215
|
+
Get array element name from type, site and ID.
|
|
332
216
|
|
|
333
217
|
Parameters
|
|
334
218
|
----------
|
|
335
|
-
|
|
336
|
-
|
|
219
|
+
array_element_type: str
|
|
220
|
+
Array element type.
|
|
221
|
+
site: str
|
|
222
|
+
Site name.
|
|
223
|
+
array_element_id: str
|
|
224
|
+
Array element ID.
|
|
337
225
|
|
|
338
226
|
Returns
|
|
339
227
|
-------
|
|
340
|
-
str
|
|
341
|
-
|
|
228
|
+
str
|
|
229
|
+
Array element name.
|
|
342
230
|
"""
|
|
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
|
-
)
|
|
231
|
+
_short_site = validate_site_name(site)[0]
|
|
232
|
+
_val_id = validate_array_element_id_name(array_element_id)
|
|
233
|
+
return f"{array_element_type}{_short_site}-{_val_id}"
|
|
378
234
|
|
|
379
235
|
|
|
380
|
-
def
|
|
236
|
+
def get_array_element_type_from_name(name):
|
|
381
237
|
"""
|
|
382
|
-
Get
|
|
238
|
+
Get array element type from name, e.g. "LSTN", "MSTN".
|
|
383
239
|
|
|
384
240
|
Parameters
|
|
385
241
|
----------
|
|
386
242
|
name: str
|
|
387
|
-
|
|
243
|
+
Array element name
|
|
388
244
|
|
|
389
245
|
Returns
|
|
390
246
|
-------
|
|
391
247
|
str
|
|
392
|
-
|
|
248
|
+
Array element type.
|
|
393
249
|
"""
|
|
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])
|
|
250
|
+
return _validate_name(name.split("-")[0], array_elements())
|
|
402
251
|
|
|
403
252
|
|
|
404
|
-
def
|
|
253
|
+
def get_list_of_array_element_types(
|
|
254
|
+
array_element_class="telescopes", site=None, observatory="CTAO"
|
|
255
|
+
):
|
|
405
256
|
"""
|
|
406
|
-
|
|
407
|
-
Examples are North-LST-1, North-MST-NectarCam-D, or South-SST-Structure-D.
|
|
257
|
+
Get list of array element types.
|
|
408
258
|
|
|
409
259
|
Parameters
|
|
410
260
|
----------
|
|
411
|
-
|
|
261
|
+
array_element_class: str
|
|
262
|
+
Array element class
|
|
263
|
+
site: str
|
|
264
|
+
Site name (e.g., South or North).
|
|
412
265
|
|
|
413
266
|
Returns
|
|
414
267
|
-------
|
|
415
|
-
|
|
416
|
-
|
|
268
|
+
list
|
|
269
|
+
List of array element types.
|
|
417
270
|
"""
|
|
418
|
-
|
|
419
|
-
|
|
271
|
+
return [
|
|
272
|
+
key
|
|
273
|
+
for key, value in array_elements().items()
|
|
274
|
+
if value["collection"] == array_element_class
|
|
275
|
+
and (site is None or value["site"] == site)
|
|
276
|
+
and (observatory is None or value["observatory"] == observatory)
|
|
277
|
+
]
|
|
420
278
|
|
|
421
|
-
return f"{validate_site_name(site)}-{validate_telescope_model_name(tel_model_name)}"
|
|
422
279
|
|
|
423
|
-
|
|
424
|
-
def convert_telescope_model_name_to_yaml_name(name):
|
|
280
|
+
def get_site_from_array_element_name(name):
|
|
425
281
|
"""
|
|
426
|
-
Get
|
|
282
|
+
Get site name from array element name.
|
|
427
283
|
|
|
428
284
|
Parameters
|
|
429
285
|
----------
|
|
430
286
|
name: str
|
|
431
|
-
|
|
287
|
+
Array element name.
|
|
432
288
|
|
|
433
289
|
Returns
|
|
434
290
|
-------
|
|
435
291
|
str
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
Raises
|
|
439
|
-
------
|
|
440
|
-
ValueError
|
|
441
|
-
if name is not valid.
|
|
292
|
+
Site name (South or North).
|
|
442
293
|
"""
|
|
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]
|
|
294
|
+
return array_elements()[get_array_element_type_from_name(name)]["site"]
|
|
462
295
|
|
|
463
296
|
|
|
464
|
-
def
|
|
297
|
+
def get_collection_name_from_array_element_name(name):
|
|
465
298
|
"""
|
|
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".
|
|
299
|
+
Get collection name (e.g., telescopes, calibration_devices, sites) of array element from name.
|
|
469
300
|
|
|
470
301
|
Parameters
|
|
471
302
|
----------
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
telescope_class_name: str
|
|
475
|
-
Name of the telescope class (e.g. LST-1, LST-D234, MST-FlashCam-D, ...)
|
|
303
|
+
name: str
|
|
304
|
+
Array element name.
|
|
476
305
|
|
|
477
306
|
Returns
|
|
478
307
|
-------
|
|
479
308
|
str
|
|
480
|
-
|
|
481
|
-
|
|
309
|
+
Collection name .
|
|
482
310
|
"""
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
311
|
+
try:
|
|
312
|
+
return array_elements()[get_array_element_type_from_name(name)]["collection"]
|
|
313
|
+
except ValueError:
|
|
314
|
+
pass
|
|
315
|
+
try:
|
|
316
|
+
validate_site_name(name)
|
|
317
|
+
return "sites"
|
|
318
|
+
except ValueError as exc:
|
|
319
|
+
raise ValueError(f"Invalid array element name {name}: {exc}") from exc
|
|
489
320
|
|
|
490
321
|
|
|
491
|
-
def
|
|
492
|
-
|
|
322
|
+
def get_simulation_software_name_from_parameter_name(
|
|
323
|
+
par_name,
|
|
324
|
+
simulation_software="sim_telarray",
|
|
325
|
+
search_telescope_parameters=True,
|
|
326
|
+
search_site_parameters=True,
|
|
493
327
|
):
|
|
494
328
|
"""
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
329
|
+
Get the name used in the simulation software from the model parameter name.
|
|
330
|
+
|
|
331
|
+
Name convention is expected to be defined in the schema.
|
|
332
|
+
Returns the parameter name if no simulation software name is found.
|
|
498
333
|
|
|
499
334
|
Parameters
|
|
500
335
|
----------
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
336
|
+
par_name: str
|
|
337
|
+
Model parameter name.
|
|
338
|
+
simulation_software: str
|
|
339
|
+
Simulation software name.
|
|
340
|
+
search_telescope_parameters: bool
|
|
341
|
+
If True, telescope model parameters are included.
|
|
342
|
+
search_site_parameters: bool
|
|
343
|
+
If True, site model parameters are included.
|
|
505
344
|
|
|
506
345
|
Returns
|
|
507
346
|
-------
|
|
508
347
|
str
|
|
509
|
-
|
|
348
|
+
Simtel parameter name.
|
|
510
349
|
"""
|
|
350
|
+
_parameter_names = {}
|
|
351
|
+
if search_telescope_parameters:
|
|
352
|
+
_parameter_names.update(telescope_parameters())
|
|
353
|
+
if search_site_parameters:
|
|
354
|
+
_parameter_names.update(site_parameters())
|
|
511
355
|
|
|
512
|
-
name_parts = array_element_id.split("-")
|
|
513
356
|
try:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
357
|
+
_parameter = _parameter_names[par_name]
|
|
358
|
+
except KeyError as err:
|
|
359
|
+
_logger.error(f"Parameter {par_name} without schema definition")
|
|
360
|
+
raise err
|
|
361
|
+
|
|
519
362
|
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]
|
|
363
|
+
for software in _parameter.get("simulation_software", []):
|
|
364
|
+
if software.get("name") == simulation_software:
|
|
365
|
+
return software.get("internal_parameter_name", par_name)
|
|
366
|
+
except TypeError: # catches cases for which 'simulation_software' is None
|
|
367
|
+
pass
|
|
368
|
+
return None
|
|
544
369
|
|
|
545
370
|
|
|
546
|
-
def
|
|
371
|
+
def get_parameter_name_from_simtel_name(simtel_name):
|
|
547
372
|
"""
|
|
548
|
-
|
|
549
|
-
|
|
373
|
+
Get the model parameter name from the simtel parameter name.
|
|
374
|
+
|
|
375
|
+
Assumes that both names are equal if not defined otherwise in names.py.
|
|
550
376
|
|
|
551
377
|
Parameters
|
|
552
378
|
----------
|
|
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)
|
|
379
|
+
simtel_name: str
|
|
380
|
+
Simtel parameter name.
|
|
561
381
|
|
|
562
382
|
Returns
|
|
563
383
|
-------
|
|
564
|
-
|
|
565
|
-
|
|
384
|
+
str
|
|
385
|
+
Model parameter name.
|
|
566
386
|
"""
|
|
387
|
+
_parameters = {**telescope_parameters(), **site_parameters()}
|
|
567
388
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
389
|
+
for par_name, par_info in _parameters.items():
|
|
390
|
+
try:
|
|
391
|
+
for software in par_info["simulation_software"]:
|
|
392
|
+
if (
|
|
393
|
+
software["name"] == "sim_telarray"
|
|
394
|
+
and software["internal_parameter_name"] == simtel_name
|
|
395
|
+
):
|
|
396
|
+
return par_name
|
|
397
|
+
except (KeyError, TypeError): # catches cases for which 'simulation_software' is None
|
|
398
|
+
pass
|
|
399
|
+
return simtel_name
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
def simtel_config_file_name(
|
|
403
|
+
site,
|
|
404
|
+
model_version,
|
|
405
|
+
array_name=None,
|
|
406
|
+
telescope_model_name=None,
|
|
407
|
+
label=None,
|
|
408
|
+
extra_label=None,
|
|
580
409
|
):
|
|
581
410
|
"""
|
|
582
411
|
sim_telarray config file name for a telescope.
|
|
@@ -599,39 +428,17 @@ def simtel_telescope_config_file_name(
|
|
|
599
428
|
str
|
|
600
429
|
File name.
|
|
601
430
|
"""
|
|
602
|
-
name =
|
|
431
|
+
name = "CTA"
|
|
432
|
+
name += f"-{array_name}" if array_name is not None else ""
|
|
433
|
+
name += f"-{site}"
|
|
434
|
+
name += f"-{telescope_model_name}" if telescope_model_name is not None else ""
|
|
435
|
+
name += f"-{model_version}"
|
|
603
436
|
name += f"_{label}" if label is not None else ""
|
|
604
437
|
name += f"_{extra_label}" if extra_label is not None else ""
|
|
605
438
|
name += ".cfg"
|
|
606
439
|
return name
|
|
607
440
|
|
|
608
441
|
|
|
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
442
|
def simtel_single_mirror_list_file_name(
|
|
636
443
|
site, telescope_model_name, model_version, mirror_number, label
|
|
637
444
|
):
|
|
@@ -685,258 +492,66 @@ def layout_telescope_list_file_name(name, label):
|
|
|
685
492
|
return file_name
|
|
686
493
|
|
|
687
494
|
|
|
688
|
-
def
|
|
495
|
+
def generate_file_name(
|
|
496
|
+
file_type,
|
|
497
|
+
suffix,
|
|
689
498
|
site,
|
|
690
499
|
telescope_model_name,
|
|
691
|
-
source_distance,
|
|
692
500
|
zenith_angle,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
501
|
+
azimuth_angle=None,
|
|
502
|
+
off_axis_angle=None,
|
|
503
|
+
source_distance=None,
|
|
504
|
+
mirror_number=None,
|
|
505
|
+
label=None,
|
|
506
|
+
extra_label=None,
|
|
697
507
|
):
|
|
698
508
|
"""
|
|
699
|
-
|
|
509
|
+
Generate a file name for output, config, or plotting.
|
|
510
|
+
|
|
511
|
+
Used e.g., to generate camera-efficiency and ray-tracing output files.
|
|
700
512
|
|
|
701
513
|
Parameters
|
|
702
514
|
----------
|
|
515
|
+
file_type: str
|
|
516
|
+
Type of file (e.g., config, output, plot)
|
|
517
|
+
suffix: str
|
|
518
|
+
File suffix
|
|
703
519
|
site: str
|
|
704
520
|
South or North.
|
|
705
521
|
telescope_model_name: str
|
|
706
|
-
|
|
707
|
-
source_distance: float
|
|
708
|
-
Source distance (km).
|
|
522
|
+
LSTN-01, MSTS-01, ...
|
|
709
523
|
zenith_angle: float
|
|
710
524
|
Zenith angle (deg).
|
|
525
|
+
azimuth_angle: float
|
|
526
|
+
Azimuth angle (deg).
|
|
711
527
|
off_axis_angle: float
|
|
712
528
|
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
529
|
source_distance: float
|
|
746
530
|
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).
|
|
531
|
+
mirror_number: int
|
|
532
|
+
Mirror number.
|
|
781
533
|
label: str
|
|
782
534
|
Instance label.
|
|
535
|
+
extra_label: str
|
|
536
|
+
Extra label.
|
|
783
537
|
|
|
784
538
|
Returns
|
|
785
539
|
-------
|
|
786
540
|
str
|
|
787
541
|
File name.
|
|
788
542
|
"""
|
|
789
|
-
name =
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
543
|
+
name = f"{file_type}-{site}-{telescope_model_name}"
|
|
544
|
+
name += f"-d{source_distance:.1f}km" if source_distance is not None else ""
|
|
545
|
+
name += f"-za{float(zenith_angle):.1f}deg"
|
|
546
|
+
name += f"-off{off_axis_angle:.3f}deg" if off_axis_angle is not None else ""
|
|
547
|
+
name += f"_azm{round(azimuth_angle):03}deg" if azimuth_angle is not None else ""
|
|
548
|
+
name += f"_mirror{mirror_number}" if mirror_number is not None else ""
|
|
793
549
|
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
|
-
)
|
|
550
|
+
name += f"_{extra_label}" if extra_label is not None else ""
|
|
551
|
+
name += f"{suffix}"
|
|
892
552
|
return name
|
|
893
553
|
|
|
894
554
|
|
|
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
555
|
def sanitize_name(name):
|
|
941
556
|
"""
|
|
942
557
|
Sanitize name to be a valid Python identifier.
|
|
@@ -959,9 +574,8 @@ def sanitize_name(name):
|
|
|
959
574
|
Raises
|
|
960
575
|
------
|
|
961
576
|
ValueError:
|
|
962
|
-
if the string
|
|
577
|
+
if the string name can not be sanitized.
|
|
963
578
|
"""
|
|
964
|
-
|
|
965
579
|
# Convert to lowercase
|
|
966
580
|
sanitized = name.lower()
|
|
967
581
|
|
|
@@ -973,5 +587,5 @@ def sanitize_name(name):
|
|
|
973
587
|
if not sanitized.isidentifier():
|
|
974
588
|
msg = f"The string {name} could not be sanitized."
|
|
975
589
|
_logger.error(msg)
|
|
976
|
-
raise ValueError
|
|
590
|
+
raise ValueError(msg)
|
|
977
591
|
return sanitized
|