gammasimtools 0.8.1__py3-none-any.whl → 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/METADATA +4 -3
- gammasimtools-0.9.0.dist-info/RECORD +350 -0
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/entry_points.txt +2 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/convert_all_model_parameters_from_simtel.py +1 -1
- simtools/applications/convert_geo_coordinates_of_array_elements.py +8 -9
- simtools/applications/convert_model_parameter_from_simtel.py +1 -1
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +2 -10
- simtools/applications/db_add_value_from_json_to_db.py +1 -9
- simtools/applications/db_get_array_layouts_from_db.py +3 -1
- simtools/applications/db_get_parameter_from_db.py +1 -1
- simtools/applications/derive_mirror_rnda.py +10 -1
- simtools/applications/derive_psf_parameters.py +1 -1
- simtools/applications/generate_array_config.py +1 -5
- simtools/applications/generate_regular_arrays.py +9 -6
- simtools/applications/generate_simtel_array_histograms.py +1 -1
- simtools/applications/plot_array_layout.py +3 -1
- simtools/applications/plot_tabular_data.py +84 -0
- simtools/applications/production_scale_events.py +1 -2
- simtools/applications/simulate_light_emission.py +2 -2
- simtools/applications/simulate_prod.py +24 -59
- simtools/applications/simulate_prod_htcondor_generator.py +95 -0
- simtools/applications/submit_data_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +1 -1
- simtools/applications/validate_camera_fov.py +4 -8
- simtools/applications/validate_cumulative_psf.py +3 -7
- simtools/applications/validate_file_using_schema.py +31 -23
- simtools/applications/validate_optics.py +3 -4
- simtools/camera_efficiency.py +1 -4
- simtools/configuration/commandline_parser.py +9 -15
- simtools/configuration/configurator.py +6 -19
- simtools/constants.py +3 -3
- simtools/data_model/metadata_collector.py +19 -1
- simtools/data_model/metadata_model.py +18 -5
- simtools/data_model/model_data_writer.py +1 -1
- simtools/data_model/validate_data.py +67 -10
- simtools/db/db_handler.py +92 -315
- simtools/io_operations/legacy_data_handler.py +61 -0
- simtools/job_execution/htcondor_script_generator.py +133 -0
- simtools/job_execution/job_manager.py +77 -50
- simtools/model/array_model.py +30 -26
- simtools/model/calibration_model.py +10 -10
- simtools/model/camera.py +79 -63
- simtools/model/mirrors.py +8 -6
- simtools/model/model_parameter.py +42 -12
- simtools/model/model_utils.py +6 -6
- simtools/model/site_model.py +2 -2
- simtools/model/telescope_model.py +26 -22
- simtools/ray_tracing/mirror_panel_psf.py +47 -27
- simtools/runners/corsika_runner.py +14 -3
- simtools/runners/runner_services.py +3 -3
- simtools/runners/simtel_runner.py +27 -8
- simtools/schemas/integration_tests_config.metaschema.yml +15 -5
- simtools/schemas/model_parameter.metaschema.yml +90 -2
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +1 -1
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +32 -2
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/simtel/simtel_table_reader.py +410 -0
- simtools/simtel/simulator_camera_efficiency.py +6 -4
- simtools/simtel/simulator_light_emission.py +2 -2
- simtools/simtel/simulator_ray_tracing.py +1 -2
- simtools/simulator.py +80 -33
- simtools/testing/configuration.py +12 -8
- simtools/testing/helpers.py +5 -5
- simtools/testing/validate_output.py +28 -28
- simtools/utils/general.py +50 -3
- simtools/utils/names.py +3 -4
- simtools/utils/value_conversion.py +9 -1
- simtools/version.py +1 -1
- simtools/visualization/plot_tables.py +106 -0
- simtools/visualization/visualize.py +43 -5
- gammasimtools-0.8.1.dist-info/RECORD +0 -346
- simtools/_dev_version/scm_version.py +0 -10
- simtools/db/db_from_repo_handler.py +0 -106
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/LICENSE +0 -0
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/top_level.txt +0 -0
simtools/model/camera.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"""Definition and modeling of camera."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
import astropy.units as u
|
|
6
7
|
import numpy as np
|
|
7
|
-
from scipy.spatial import cKDTree as KDTree
|
|
8
|
-
from scipy.spatial import distance
|
|
9
8
|
|
|
10
9
|
from simtools.utils.geometry import rotate
|
|
11
10
|
|
|
@@ -20,9 +19,9 @@ class Camera:
|
|
|
20
19
|
|
|
21
20
|
Parameters
|
|
22
21
|
----------
|
|
23
|
-
telescope_model_name:
|
|
22
|
+
telescope_model_name: str
|
|
24
23
|
As provided by the telescope model method TelescopeModel (e.g., LSTN-01)
|
|
25
|
-
camera_config_file:
|
|
24
|
+
camera_config_file: str or Path
|
|
26
25
|
The sim_telarray file name.
|
|
27
26
|
focal_length: float
|
|
28
27
|
The focal length of the camera in (preferably the effective focal length), assumed to be \
|
|
@@ -34,7 +33,9 @@ class Camera:
|
|
|
34
33
|
SIPM_NEIGHBOR_RADIUS_FACTOR = 1.4
|
|
35
34
|
SIPM_ROW_COLUMN_DIST_FACTOR = 0.2
|
|
36
35
|
|
|
37
|
-
def __init__(
|
|
36
|
+
def __init__(
|
|
37
|
+
self, telescope_model_name: str, camera_config_file: str | Path, focal_length: float
|
|
38
|
+
):
|
|
38
39
|
"""
|
|
39
40
|
Initialize Camera class, defining pixel layout.
|
|
40
41
|
|
|
@@ -58,13 +59,13 @@ class Camera:
|
|
|
58
59
|
self._edge_pixel_indices = None
|
|
59
60
|
|
|
60
61
|
@staticmethod
|
|
61
|
-
def read_pixel_list(camera_config_file):
|
|
62
|
+
def read_pixel_list(camera_config_file: str | Path) -> dict:
|
|
62
63
|
"""
|
|
63
64
|
Read the pixel layout from the camera config file, assumed to be in a sim_telarray format.
|
|
64
65
|
|
|
65
66
|
Parameters
|
|
66
67
|
----------
|
|
67
|
-
camera_config_file:
|
|
68
|
+
camera_config_file: str or Path
|
|
68
69
|
The sim_telarray file name.
|
|
69
70
|
|
|
70
71
|
Returns
|
|
@@ -90,7 +91,7 @@ class Camera:
|
|
|
90
91
|
return pixels
|
|
91
92
|
|
|
92
93
|
@staticmethod
|
|
93
|
-
def initialize_pixel_dict():
|
|
94
|
+
def initialize_pixel_dict() -> dict:
|
|
94
95
|
"""
|
|
95
96
|
Initialize the pixel dictionary with default values.
|
|
96
97
|
|
|
@@ -113,16 +114,16 @@ class Camera:
|
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
@staticmethod
|
|
116
|
-
def process_line(line, pixels):
|
|
117
|
+
def process_line(line: str, pixels: dict):
|
|
117
118
|
"""
|
|
118
|
-
Process a line from the camera config file and update the
|
|
119
|
+
Process a line from the camera config file and update the pixels dictionary.
|
|
119
120
|
|
|
120
121
|
Parameters
|
|
121
122
|
----------
|
|
122
|
-
line:
|
|
123
|
+
line: str
|
|
123
124
|
A line from the camera config file.
|
|
124
125
|
pixels: dict
|
|
125
|
-
The
|
|
126
|
+
The dictionary to update with pixel information.
|
|
126
127
|
"""
|
|
127
128
|
pix_info = line.split()
|
|
128
129
|
|
|
@@ -150,9 +151,9 @@ class Camera:
|
|
|
150
151
|
pixels["pix_on"].append(True)
|
|
151
152
|
|
|
152
153
|
@staticmethod
|
|
153
|
-
def validate_pixels(pixels, camera_config_file):
|
|
154
|
+
def validate_pixels(pixels: dict, camera_config_file: str | Path):
|
|
154
155
|
"""
|
|
155
|
-
Validate the pixel dictionary to ensure
|
|
156
|
+
Validate the pixel dictionary to ensure all required fields are present.
|
|
156
157
|
|
|
157
158
|
Parameters
|
|
158
159
|
----------
|
|
@@ -174,7 +175,7 @@ class Camera:
|
|
|
174
175
|
f"Pixel shape in {camera_config_file} unrecognized (has to be 1, 2 or 3)"
|
|
175
176
|
)
|
|
176
177
|
|
|
177
|
-
def _rotate_pixels(self, pixels):
|
|
178
|
+
def _rotate_pixels(self, pixels: dict) -> dict:
|
|
178
179
|
"""
|
|
179
180
|
Rotate the pixels according to the rotation angle given in pixels['rotate_angle'].
|
|
180
181
|
|
|
@@ -184,7 +185,7 @@ class Camera:
|
|
|
184
185
|
|
|
185
186
|
Parameters
|
|
186
187
|
----------
|
|
187
|
-
pixels:
|
|
188
|
+
pixels: dict
|
|
188
189
|
The dictionary produced by the read_pixel_list method of this class
|
|
189
190
|
|
|
190
191
|
Returns
|
|
@@ -219,9 +220,9 @@ class Camera:
|
|
|
219
220
|
|
|
220
221
|
return pixels
|
|
221
222
|
|
|
222
|
-
def get_number_of_pixels(self):
|
|
223
|
+
def get_number_of_pixels(self) -> int:
|
|
223
224
|
"""
|
|
224
|
-
Get the number of pixels in the camera (all pixels, including those defined as "off".
|
|
225
|
+
Get the number of pixels in the camera (all pixels, including those defined as "off").
|
|
225
226
|
|
|
226
227
|
Returns
|
|
227
228
|
-------
|
|
@@ -230,7 +231,7 @@ class Camera:
|
|
|
230
231
|
"""
|
|
231
232
|
return len(self.pixels["x"])
|
|
232
233
|
|
|
233
|
-
def get_pixel_diameter(self):
|
|
234
|
+
def get_pixel_diameter(self) -> float:
|
|
234
235
|
"""
|
|
235
236
|
Get pixel diameter contained in _pixels.
|
|
236
237
|
|
|
@@ -241,7 +242,7 @@ class Camera:
|
|
|
241
242
|
"""
|
|
242
243
|
return self.pixels["pixel_diameter"]
|
|
243
244
|
|
|
244
|
-
def get_pixel_active_solid_angle(self):
|
|
245
|
+
def get_pixel_active_solid_angle(self) -> float:
|
|
245
246
|
"""
|
|
246
247
|
Get the active solid angle of a pixel in sr.
|
|
247
248
|
|
|
@@ -256,7 +257,7 @@ class Camera:
|
|
|
256
257
|
pixel_area *= np.sqrt(3) / 2
|
|
257
258
|
return pixel_area / (self.focal_length**2)
|
|
258
259
|
|
|
259
|
-
def get_pixel_shape(self):
|
|
260
|
+
def get_pixel_shape(self) -> int:
|
|
260
261
|
"""
|
|
261
262
|
Get pixel shape code 1, 2 or 3.
|
|
262
263
|
|
|
@@ -270,7 +271,7 @@ class Camera:
|
|
|
270
271
|
"""
|
|
271
272
|
return self.pixels["pixel_shape"]
|
|
272
273
|
|
|
273
|
-
def get_lightguide_efficiency_angle_file_name(self):
|
|
274
|
+
def get_lightguide_efficiency_angle_file_name(self) -> str:
|
|
274
275
|
"""
|
|
275
276
|
Get the file name of the light guide efficiency as a function of incidence angle.
|
|
276
277
|
|
|
@@ -281,7 +282,7 @@ class Camera:
|
|
|
281
282
|
"""
|
|
282
283
|
return self.pixels["lightguide_efficiency_angle_file"]
|
|
283
284
|
|
|
284
|
-
def get_lightguide_efficiency_wavelength_file_name(self):
|
|
285
|
+
def get_lightguide_efficiency_wavelength_file_name(self) -> str:
|
|
285
286
|
"""
|
|
286
287
|
Get the file name of the light guide efficiency as a function of wavelength.
|
|
287
288
|
|
|
@@ -292,7 +293,7 @@ class Camera:
|
|
|
292
293
|
"""
|
|
293
294
|
return self.pixels["lightguide_efficiency_wavelength_file"]
|
|
294
295
|
|
|
295
|
-
def get_camera_fill_factor(self):
|
|
296
|
+
def get_camera_fill_factor(self) -> float:
|
|
296
297
|
"""
|
|
297
298
|
Calculate the fill factor of the camera, defined as (pixel_diameter/pixel_spacing)**2.
|
|
298
299
|
|
|
@@ -301,6 +302,8 @@ class Camera:
|
|
|
301
302
|
float
|
|
302
303
|
The camera fill factor.
|
|
303
304
|
"""
|
|
305
|
+
from scipy.spatial import distance # pylint: disable=import-outside-toplevel
|
|
306
|
+
|
|
304
307
|
if self.pixels["pixel_spacing"] == 9999:
|
|
305
308
|
points = np.array([self.pixels["x"], self.pixels["y"]]).T
|
|
306
309
|
pixel_distances = distance.cdist(points, points, "euclidean")
|
|
@@ -311,7 +314,7 @@ class Camera:
|
|
|
311
314
|
|
|
312
315
|
return (self.pixels["pixel_diameter"] / self.pixels["pixel_spacing"]) ** 2
|
|
313
316
|
|
|
314
|
-
def calc_fov(self):
|
|
317
|
+
def calc_fov(self) -> tuple[float, float]:
|
|
315
318
|
"""
|
|
316
319
|
Calculate the FOV of the camera in degrees, taking into account the focal length.
|
|
317
320
|
|
|
@@ -327,7 +330,6 @@ class Camera:
|
|
|
327
330
|
The x,y pixel positions and focal length are assumed to have the same unit (usually cm)
|
|
328
331
|
"""
|
|
329
332
|
self._logger.debug("Calculating the FoV")
|
|
330
|
-
|
|
331
333
|
return self._calc_fov(
|
|
332
334
|
self.pixels["x"],
|
|
333
335
|
self.pixels["y"],
|
|
@@ -335,7 +337,13 @@ class Camera:
|
|
|
335
337
|
self.focal_length,
|
|
336
338
|
)
|
|
337
339
|
|
|
338
|
-
def _calc_fov(
|
|
340
|
+
def _calc_fov(
|
|
341
|
+
self,
|
|
342
|
+
x_pixel: list[float],
|
|
343
|
+
y_pixel: list[float],
|
|
344
|
+
edge_pixel_indices: list[int],
|
|
345
|
+
focal_length: float,
|
|
346
|
+
) -> tuple[float, float]:
|
|
339
347
|
"""
|
|
340
348
|
Calculate the FOV of the camera in degrees, taking into account the focal length.
|
|
341
349
|
|
|
@@ -374,7 +382,7 @@ class Camera:
|
|
|
374
382
|
return fov, average_edge_distance
|
|
375
383
|
|
|
376
384
|
@staticmethod
|
|
377
|
-
def _find_neighbors(x_pos, y_pos, radius):
|
|
385
|
+
def _find_neighbors(x_pos: np.ndarray, y_pos: np.ndarray, radius: float) -> list[list[int]]:
|
|
378
386
|
"""
|
|
379
387
|
Use a KD-Tree to quickly find nearest neighbors.
|
|
380
388
|
|
|
@@ -392,20 +400,18 @@ class Camera:
|
|
|
392
400
|
|
|
393
401
|
Returns
|
|
394
402
|
-------
|
|
395
|
-
|
|
396
|
-
Array of neighbor indices in a list for each
|
|
403
|
+
list of lists
|
|
404
|
+
Array of neighbor indices in a list for each pixel
|
|
397
405
|
"""
|
|
398
|
-
|
|
399
|
-
indices = np.arange(len(x_pos))
|
|
400
|
-
kdtree = KDTree(points)
|
|
401
|
-
neighbors = [kdtree.query_ball_point(p, r=radius) for p in points]
|
|
402
|
-
|
|
403
|
-
for neighbor_now, index_now in zip(neighbors, indices):
|
|
404
|
-
neighbor_now.remove(index_now) # get rid of the pixel or mirror itself
|
|
406
|
+
from scipy.spatial import cKDTree as KDTree # pylint: disable=import-outside-toplevel
|
|
405
407
|
|
|
406
|
-
|
|
408
|
+
tree = KDTree(np.column_stack([x_pos, y_pos]))
|
|
409
|
+
neighbors = tree.query_ball_tree(tree, radius)
|
|
410
|
+
return [list(np.setdiff1d(neigh, [i])) for i, neigh in enumerate(neighbors)]
|
|
407
411
|
|
|
408
|
-
def _find_adjacent_neighbor_pixels(
|
|
412
|
+
def _find_adjacent_neighbor_pixels(
|
|
413
|
+
self, x_pos: np.ndarray, y_pos: np.ndarray, radius: float, row_column_dist: float
|
|
414
|
+
) -> list[list[int]]:
|
|
409
415
|
"""
|
|
410
416
|
Find adjacent neighbor pixels in cameras with square pixels.
|
|
411
417
|
|
|
@@ -413,13 +419,13 @@ class Camera:
|
|
|
413
419
|
|
|
414
420
|
Parameters
|
|
415
421
|
----------
|
|
416
|
-
x_pos
|
|
422
|
+
x_pos: np.ndarray
|
|
417
423
|
x position of each pixel
|
|
418
|
-
y_pos
|
|
424
|
+
y_pos: np.ndarray
|
|
419
425
|
y position of each pixel
|
|
420
|
-
radius
|
|
426
|
+
radius: float
|
|
421
427
|
Radius within which to find neighbors
|
|
422
|
-
row_column_dist
|
|
428
|
+
row_column_dist: float
|
|
423
429
|
Distance to consider for row/column adjacency.
|
|
424
430
|
Should be around 20% of the pixel diameter.
|
|
425
431
|
|
|
@@ -441,23 +447,31 @@ class Camera:
|
|
|
441
447
|
|
|
442
448
|
return neighbors
|
|
443
449
|
|
|
444
|
-
def _add_additional_neighbors(
|
|
450
|
+
def _add_additional_neighbors(
|
|
451
|
+
self,
|
|
452
|
+
i_pix: int,
|
|
453
|
+
nn: list[int],
|
|
454
|
+
x_pos: np.ndarray,
|
|
455
|
+
y_pos: np.ndarray,
|
|
456
|
+
radius: float,
|
|
457
|
+
row_column_dist: float,
|
|
458
|
+
):
|
|
445
459
|
"""
|
|
446
460
|
Add neighbors for a given pixel if they are not already neighbors and are adjacent.
|
|
447
461
|
|
|
448
462
|
Parameters
|
|
449
463
|
----------
|
|
450
|
-
i_pix
|
|
464
|
+
i_pix: int
|
|
451
465
|
Index of the pixel to find neighbors for
|
|
452
|
-
nn
|
|
466
|
+
nn: list
|
|
453
467
|
Current list of neighbors for the pixel
|
|
454
|
-
x_pos
|
|
468
|
+
x_pos: np.ndarray
|
|
455
469
|
x position of each pixel
|
|
456
|
-
y_pos
|
|
470
|
+
y_pos: np.ndarray
|
|
457
471
|
y position of each pixel
|
|
458
|
-
radius
|
|
472
|
+
radius: float
|
|
459
473
|
Radius within which to find neighbors
|
|
460
|
-
row_column_dist
|
|
474
|
+
row_column_dist: float
|
|
461
475
|
Distance to consider for row/column adjacency
|
|
462
476
|
"""
|
|
463
477
|
for j_pix, _ in enumerate(x_pos):
|
|
@@ -477,20 +491,20 @@ class Camera:
|
|
|
477
491
|
) and dist < 1.2 * radius:
|
|
478
492
|
nn.append(j_pix)
|
|
479
493
|
|
|
480
|
-
def _calc_neighbor_pixels(self, pixels):
|
|
494
|
+
def _calc_neighbor_pixels(self, pixels: dict) -> list[list[int]]:
|
|
481
495
|
"""
|
|
482
496
|
Find adjacent neighbor pixels in cameras with hexagonal or square pixels.
|
|
483
497
|
|
|
484
|
-
Only directly
|
|
498
|
+
Only directly adjacent neighbors are searched for, no diagonals.
|
|
485
499
|
|
|
486
500
|
Parameters
|
|
487
501
|
----------
|
|
488
|
-
pixels:
|
|
502
|
+
pixels: dict
|
|
489
503
|
The dictionary produced by the read_pixel_list method of this class
|
|
490
504
|
|
|
491
505
|
Returns
|
|
492
506
|
-------
|
|
493
|
-
neighbors:
|
|
507
|
+
neighbors: list of lists
|
|
494
508
|
Array of neighbor indices in a list for each pixel
|
|
495
509
|
"""
|
|
496
510
|
self._logger.debug("Searching for neighbor pixels")
|
|
@@ -515,7 +529,7 @@ class Camera:
|
|
|
515
529
|
|
|
516
530
|
return self._neighbors
|
|
517
531
|
|
|
518
|
-
def get_neighbor_pixels(self, pixels=None):
|
|
532
|
+
def get_neighbor_pixels(self, pixels: dict | None = None) -> list[list[int]]:
|
|
519
533
|
"""
|
|
520
534
|
Get a list of neighbor pixels by calling calc_neighbor_pixels() when necessary.
|
|
521
535
|
|
|
@@ -529,7 +543,7 @@ class Camera:
|
|
|
529
543
|
|
|
530
544
|
Returns
|
|
531
545
|
-------
|
|
532
|
-
neighbors:
|
|
546
|
+
neighbors: list of lists
|
|
533
547
|
Array of neighbor indices in a list for each pixel.
|
|
534
548
|
"""
|
|
535
549
|
if self._neighbors is None:
|
|
@@ -539,20 +553,20 @@ class Camera:
|
|
|
539
553
|
|
|
540
554
|
return self._neighbors
|
|
541
555
|
|
|
542
|
-
def _calc_edge_pixels(self, pixels, neighbors):
|
|
556
|
+
def _calc_edge_pixels(self, pixels: dict, neighbors: list[list[int]]) -> list[int]:
|
|
543
557
|
"""
|
|
544
558
|
Find the edge pixels of the camera.
|
|
545
559
|
|
|
546
560
|
Parameters
|
|
547
561
|
----------
|
|
548
|
-
pixels:
|
|
562
|
+
pixels: dict
|
|
549
563
|
The dictionary produced by the read_pixel_list method of this class.
|
|
550
|
-
neighbors:
|
|
564
|
+
neighbors: list of lists
|
|
551
565
|
Array of neighbor indices in a list for each pixel.
|
|
552
566
|
|
|
553
567
|
Returns
|
|
554
568
|
-------
|
|
555
|
-
edge_pixel_indices:
|
|
569
|
+
edge_pixel_indices: list
|
|
556
570
|
Array of edge pixel indices.
|
|
557
571
|
"""
|
|
558
572
|
self._logger.debug("Searching for edge pixels")
|
|
@@ -574,7 +588,9 @@ class Camera:
|
|
|
574
588
|
|
|
575
589
|
return edge_pixel_indices
|
|
576
590
|
|
|
577
|
-
def get_edge_pixels(
|
|
591
|
+
def get_edge_pixels(
|
|
592
|
+
self, pixels: dict | None = None, neighbors: list[list[int]] | None = None
|
|
593
|
+
) -> list[int]:
|
|
578
594
|
"""
|
|
579
595
|
Get the indices of the edge pixels of the camera.
|
|
580
596
|
|
|
@@ -582,12 +598,12 @@ class Camera:
|
|
|
582
598
|
----------
|
|
583
599
|
pixels: dict
|
|
584
600
|
The dictionary produced by the read_pixel_list method of this class.
|
|
585
|
-
neighbors:
|
|
601
|
+
neighbors: list of lists
|
|
586
602
|
Array of neighbor indices in a list for each pixel.
|
|
587
603
|
|
|
588
604
|
Returns
|
|
589
605
|
-------
|
|
590
|
-
edge_pixel_indices:
|
|
606
|
+
edge_pixel_indices: list
|
|
591
607
|
Array of edge pixel indices.
|
|
592
608
|
"""
|
|
593
609
|
if self._edge_pixel_indices is None:
|
simtools/model/mirrors.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Definition and modeling of mirror panels."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
import astropy.io.ascii
|
|
6
7
|
import astropy.units as u
|
|
@@ -20,13 +21,13 @@ class Mirrors:
|
|
|
20
21
|
|
|
21
22
|
Parameters
|
|
22
23
|
----------
|
|
23
|
-
mirror_list_file: str
|
|
24
|
-
|
|
25
|
-
parameters: dict
|
|
24
|
+
mirror_list_file: Union[str, Path]
|
|
25
|
+
Mirror list in sim_telarray or ecsv format (with panel focal length only).
|
|
26
|
+
parameters: dict, optional
|
|
26
27
|
Dictionary of parameters from the database.
|
|
27
28
|
"""
|
|
28
29
|
|
|
29
|
-
def __init__(self, mirror_list_file, parameters=None):
|
|
30
|
+
def __init__(self, mirror_list_file: str | Path, parameters: dict | None = None):
|
|
30
31
|
"""Initialize Mirrors."""
|
|
31
32
|
self._logger = logging.getLogger(__name__)
|
|
32
33
|
self._logger.debug("Mirrors Init")
|
|
@@ -180,7 +181,7 @@ class Mirrors:
|
|
|
180
181
|
self._logger.debug(f"Mirror diameter = {self.mirror_diameter}")
|
|
181
182
|
self._logger.debug(f"Number of Mirrors = {self.number_of_mirrors}")
|
|
182
183
|
|
|
183
|
-
def get_single_mirror_parameters(self, number):
|
|
184
|
+
def get_single_mirror_parameters(self, number: int) -> tuple:
|
|
184
185
|
"""
|
|
185
186
|
Get parameters for a single mirror given by number.
|
|
186
187
|
|
|
@@ -191,7 +192,8 @@ class Mirrors:
|
|
|
191
192
|
|
|
192
193
|
Returns
|
|
193
194
|
-------
|
|
194
|
-
|
|
195
|
+
tuple
|
|
196
|
+
(pos_x, pos_y, mirror_diameter, focal_length, shape_type): tuple of float
|
|
195
197
|
X, Y positions, mirror_diameter, focal length and shape_type.
|
|
196
198
|
"""
|
|
197
199
|
mask = self.mirror_table["mirror_panel_id"] == number
|
|
@@ -6,10 +6,12 @@ import shutil
|
|
|
6
6
|
from copy import copy
|
|
7
7
|
|
|
8
8
|
import astropy.units as u
|
|
9
|
+
from astropy.table import Table
|
|
9
10
|
|
|
10
11
|
import simtools.utils.general as gen
|
|
11
12
|
from simtools.db import db_handler
|
|
12
13
|
from simtools.io_operations import io_handler
|
|
14
|
+
from simtools.simtel import simtel_table_reader
|
|
13
15
|
from simtools.simtel.simtel_config_writer import SimtelConfigWriter
|
|
14
16
|
from simtools.utils import names
|
|
15
17
|
|
|
@@ -273,7 +275,7 @@ class ModelParameter:
|
|
|
273
275
|
|
|
274
276
|
def _set_config_file_directory_and_name(self):
|
|
275
277
|
"""Set and create the directory and the name of the config file."""
|
|
276
|
-
if self.name is None:
|
|
278
|
+
if self.name is None and self.site is None:
|
|
277
279
|
return
|
|
278
280
|
|
|
279
281
|
self._config_file_directory = self.io_handler.get_output_directory(
|
|
@@ -281,15 +283,14 @@ class ModelParameter:
|
|
|
281
283
|
)
|
|
282
284
|
|
|
283
285
|
# Setting file name and the location
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
self._config_file_path = self.config_file_directory.joinpath(config_file_name)
|
|
286
|
+
config_file_name = names.simtel_config_file_name(
|
|
287
|
+
self.site,
|
|
288
|
+
self.model_version,
|
|
289
|
+
telescope_model_name=self.name,
|
|
290
|
+
label=self.label,
|
|
291
|
+
extra_label=self._extra_label,
|
|
292
|
+
)
|
|
293
|
+
self._config_file_path = self.config_file_directory.joinpath(config_file_name)
|
|
293
294
|
|
|
294
295
|
self._logger.debug(f"Config file path: {self._config_file_path}")
|
|
295
296
|
|
|
@@ -456,7 +457,7 @@ class ModelParameter:
|
|
|
456
457
|
Change values of multiple existing parameters in the model from a file.
|
|
457
458
|
|
|
458
459
|
This function does not modify the DB, it affects only the current instance.
|
|
459
|
-
|
|
460
|
+
This feature is intended for developers and lacks validation.
|
|
460
461
|
|
|
461
462
|
Parameters
|
|
462
463
|
----------
|
|
@@ -464,7 +465,7 @@ class ModelParameter:
|
|
|
464
465
|
File containing the parameters to be changed.
|
|
465
466
|
"""
|
|
466
467
|
self._logger.warning(
|
|
467
|
-
"Changing multiple parameters from file is
|
|
468
|
+
"Changing multiple parameters from file is a feature for developers."
|
|
468
469
|
"Insufficient validation of parameters."
|
|
469
470
|
)
|
|
470
471
|
self._logger.debug(f"Changing parameters from file {file_name}")
|
|
@@ -515,6 +516,35 @@ class ModelParameter:
|
|
|
515
516
|
self.db.export_model_files(pars_from_db, self.config_file_directory)
|
|
516
517
|
self._is_exported_model_files_up_to_date = True
|
|
517
518
|
|
|
519
|
+
def get_model_file_as_table(self, par_name):
|
|
520
|
+
"""
|
|
521
|
+
Return tabular data from file as astropy table.
|
|
522
|
+
|
|
523
|
+
Parameters
|
|
524
|
+
----------
|
|
525
|
+
par_name: str
|
|
526
|
+
Name of the parameter.
|
|
527
|
+
|
|
528
|
+
Returns
|
|
529
|
+
-------
|
|
530
|
+
Table
|
|
531
|
+
Astropy table.
|
|
532
|
+
"""
|
|
533
|
+
_par_entry = {}
|
|
534
|
+
try:
|
|
535
|
+
_par_entry[par_name] = self._parameters[par_name]
|
|
536
|
+
except KeyError as exc:
|
|
537
|
+
raise ValueError(f"Parameter {par_name} not found in the model.") from exc
|
|
538
|
+
self.db.export_model_files(_par_entry, self.config_file_directory)
|
|
539
|
+
if _par_entry[par_name]["value"].endswith("ecsv"):
|
|
540
|
+
return Table.read(
|
|
541
|
+
self.config_file_directory.joinpath(_par_entry[par_name]["value"]),
|
|
542
|
+
format="ascii.ecsv",
|
|
543
|
+
)
|
|
544
|
+
return simtel_table_reader.read_simtel_table(
|
|
545
|
+
par_name, self.config_file_directory.joinpath(_par_entry[par_name]["value"])
|
|
546
|
+
)
|
|
547
|
+
|
|
518
548
|
def export_config_file(self):
|
|
519
549
|
"""Export the config file used by sim_telarray."""
|
|
520
550
|
# Exporting model file
|
simtools/model/model_utils.py
CHANGED
|
@@ -11,7 +11,7 @@ __all__ = [
|
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def compute_telescope_transmission(pars, off_axis):
|
|
14
|
+
def compute_telescope_transmission(pars: list[float], off_axis: float) -> float:
|
|
15
15
|
"""
|
|
16
16
|
Compute telescope transmission (0 < T < 1) for a given off-axis angle.
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ def compute_telescope_transmission(pars, off_axis):
|
|
|
20
20
|
Parameters
|
|
21
21
|
----------
|
|
22
22
|
pars: list of float
|
|
23
|
-
Parameters of the telescope transmission. Len(pars) should be
|
|
23
|
+
Parameters of the telescope transmission. Len(pars) should be 5 or 6.
|
|
24
24
|
off_axis: float
|
|
25
25
|
Off-axis angle in deg.
|
|
26
26
|
|
|
@@ -37,19 +37,19 @@ def compute_telescope_transmission(pars, off_axis):
|
|
|
37
37
|
return pars[0] / (1.0 + pars[2] * t ** pars[4])
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def is_two_mirror_telescope(telescope_model_name):
|
|
40
|
+
def is_two_mirror_telescope(telescope_model_name: str) -> bool:
|
|
41
41
|
"""
|
|
42
|
-
|
|
42
|
+
Determine if the telescope model is a two-mirror telescope.
|
|
43
43
|
|
|
44
44
|
Parameters
|
|
45
45
|
----------
|
|
46
46
|
telescope_model_name: str
|
|
47
|
-
|
|
47
|
+
Name of the telescope model.
|
|
48
48
|
|
|
49
49
|
Returns
|
|
50
50
|
-------
|
|
51
51
|
bool
|
|
52
|
-
True if
|
|
52
|
+
True if it is a two-mirror telescope.
|
|
53
53
|
"""
|
|
54
54
|
tel_type = names.get_array_element_type_from_name(telescope_model_name)
|
|
55
55
|
if "SST" in tel_type or "SCT" in tel_type:
|
simtools/model/site_model.py
CHANGED
|
@@ -21,7 +21,7 @@ class SiteModel(ModelParameter):
|
|
|
21
21
|
MongoDB configuration.
|
|
22
22
|
model_version: str
|
|
23
23
|
Model version.
|
|
24
|
-
label: str
|
|
24
|
+
label: str, optional
|
|
25
25
|
Instance label. Important for output file naming.
|
|
26
26
|
"""
|
|
27
27
|
|
|
@@ -80,7 +80,7 @@ class SiteModel(ModelParameter):
|
|
|
80
80
|
Site-related CORSIKA parameters as dict
|
|
81
81
|
"""
|
|
82
82
|
if config_file_style:
|
|
83
|
-
model_directory = model_directory or Path(
|
|
83
|
+
model_directory = model_directory or Path()
|
|
84
84
|
return {
|
|
85
85
|
"OBSLEV": [
|
|
86
86
|
self.get_parameter_value_with_unit("corsika_observation_level").to_value("cm")
|