gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gammasimtools-0.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Derives the mirror alignment parameters using cumulative PSF measurement.
|
|
5
|
+
|
|
6
|
+
This includes parameters mirror_reflection_random_angle, \
|
|
7
|
+
mirror_align_random_horizontal and mirror_align_random_vertical.
|
|
8
|
+
|
|
9
|
+
The telescope zenith angle and the source distance can be set by command line arguments.
|
|
10
|
+
|
|
11
|
+
The measured cumulative PSF should be provided by using the command line argument data. \
|
|
12
|
+
A file name is expected, in which the file should contain 3 columns: radial distance in mm, \
|
|
13
|
+
differential value of photon intensity and its integral value.
|
|
14
|
+
|
|
15
|
+
The derivation is performed through a random search. A number of random combination of the \
|
|
16
|
+
parameters are tested and the best ones are selected based on the minimum value of \
|
|
17
|
+
the Root Mean Squared Deviation between data and simulations. The range in which the \
|
|
18
|
+
parameter are drawn uniformly are defined based on the previous value on the telescope model.
|
|
19
|
+
|
|
20
|
+
The assumption are:
|
|
21
|
+
|
|
22
|
+
a) mirror_align_random_horizontal and mirror_align_random_vertical are the same.
|
|
23
|
+
|
|
24
|
+
b) mirror_align_random_horizontal/vertical have no dependence on the zenith angle.
|
|
25
|
+
|
|
26
|
+
One example of the plot generated by this applications are shown below.
|
|
27
|
+
|
|
28
|
+
.. _derive_psf_parameters_plot:
|
|
29
|
+
.. image:: images/derive_psf_parameters.png
|
|
30
|
+
:width: 49 %
|
|
31
|
+
|
|
32
|
+
Command line arguments
|
|
33
|
+
----------------------
|
|
34
|
+
site (str, required)
|
|
35
|
+
North or South.
|
|
36
|
+
telescope (str, required)
|
|
37
|
+
Telescope model name (e.g. LST-1, SST-D, ...).
|
|
38
|
+
model_version (str, optional)
|
|
39
|
+
Model version.
|
|
40
|
+
src_distance (float, optional)
|
|
41
|
+
Source distance in km.
|
|
42
|
+
zenith (float, optional)
|
|
43
|
+
Zenith angle in deg.
|
|
44
|
+
data (str, optional)
|
|
45
|
+
Name of the data file with the measured cumulative PSF.
|
|
46
|
+
plot_all (activation mode, optional)
|
|
47
|
+
If activated, plots will be generated for all values tested during tuning.
|
|
48
|
+
fixed (activation mode, optional)
|
|
49
|
+
Keep the first entry of mirror_reflection_random_angle fixed.
|
|
50
|
+
test (activation mode, optional)
|
|
51
|
+
If activated, application will be faster by simulating fewer photons.
|
|
52
|
+
|
|
53
|
+
Example
|
|
54
|
+
-------
|
|
55
|
+
LSTN-01 5.0.0
|
|
56
|
+
|
|
57
|
+
Runtime < 3 min.
|
|
58
|
+
|
|
59
|
+
Get PSF data from the DB:
|
|
60
|
+
|
|
61
|
+
.. code-block:: console
|
|
62
|
+
|
|
63
|
+
simtools-db-get-file-from-db --file_name PSFcurve_data_v2.txt
|
|
64
|
+
|
|
65
|
+
Run the application:
|
|
66
|
+
|
|
67
|
+
.. code-block:: console
|
|
68
|
+
|
|
69
|
+
simtools-derive-psf-parameters --site North --telescope LSTN-01 \\
|
|
70
|
+
--model_version 6.0.0 --data PSFcurve_data_v2.txt --plot_all --test
|
|
71
|
+
|
|
72
|
+
The output is saved in simtools-output/derive_psf_parameters.
|
|
73
|
+
|
|
74
|
+
Expected final print-out message:
|
|
75
|
+
|
|
76
|
+
.. code-block:: console
|
|
77
|
+
|
|
78
|
+
Best parameters:
|
|
79
|
+
mirror_reflection_random_angle = [0.006, 0.133, 0.005]
|
|
80
|
+
mirror_align_random_horizontal = [0.005, 28.0, 0.0, 0.0]
|
|
81
|
+
mirror_align_random_vertical = [0.005, 28.0, 0.0, 0.0]
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
import logging
|
|
85
|
+
from collections import OrderedDict
|
|
86
|
+
|
|
87
|
+
import astropy.units as u
|
|
88
|
+
import matplotlib.pyplot as plt
|
|
89
|
+
import numpy as np
|
|
90
|
+
from matplotlib.backends.backend_pdf import PdfPages
|
|
91
|
+
|
|
92
|
+
import simtools.utils.general as gen
|
|
93
|
+
from simtools.configuration import configurator
|
|
94
|
+
from simtools.io_operations import io_handler
|
|
95
|
+
from simtools.model.telescope_model import TelescopeModel
|
|
96
|
+
from simtools.ray_tracing.ray_tracing import RayTracing
|
|
97
|
+
from simtools.visualization import visualize
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def load_data(data_file):
|
|
101
|
+
"""
|
|
102
|
+
Load data from a text file containing cumulative PSF measurements.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
data_file : str
|
|
107
|
+
Name of the data file with the measured cumulative PSF.
|
|
108
|
+
|
|
109
|
+
Returns
|
|
110
|
+
-------
|
|
111
|
+
numpy.ndarray
|
|
112
|
+
Loaded and processed data from the file.
|
|
113
|
+
"""
|
|
114
|
+
radius_cm = "Radius [cm]"
|
|
115
|
+
cumulative_psf = "Cumulative PSF"
|
|
116
|
+
d_type = {"names": (radius_cm, cumulative_psf), "formats": ("f8", "f8")}
|
|
117
|
+
data = np.loadtxt(data_file, dtype=d_type, usecols=(0, 2))
|
|
118
|
+
data[radius_cm] *= 0.1
|
|
119
|
+
data[cumulative_psf] /= np.max(np.abs(data[cumulative_psf]))
|
|
120
|
+
return data
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _parse():
|
|
124
|
+
config = configurator.Configurator(
|
|
125
|
+
description=(
|
|
126
|
+
"Derive mirror_reflection_random_angle, mirror_align_random_horizontal "
|
|
127
|
+
"and mirror_align_random_vertical using cumulative PSF measurement."
|
|
128
|
+
)
|
|
129
|
+
)
|
|
130
|
+
config.parser.add_argument(
|
|
131
|
+
"--src_distance",
|
|
132
|
+
help="Source distance in km",
|
|
133
|
+
type=float,
|
|
134
|
+
default=10,
|
|
135
|
+
)
|
|
136
|
+
config.parser.add_argument("--zenith", help="Zenith angle in deg", type=float, default=20)
|
|
137
|
+
config.parser.add_argument(
|
|
138
|
+
"--data", help="Data file name with the measured PSF vs radius [cm]", type=str
|
|
139
|
+
)
|
|
140
|
+
config.parser.add_argument(
|
|
141
|
+
"--plot_all",
|
|
142
|
+
help=(
|
|
143
|
+
"On: plot cumulative PSF for all tested combinations, "
|
|
144
|
+
"Off: plot it only for the best set of values"
|
|
145
|
+
),
|
|
146
|
+
action="store_true",
|
|
147
|
+
)
|
|
148
|
+
config.parser.add_argument(
|
|
149
|
+
"--fixed",
|
|
150
|
+
help=("Keep the first entry of mirror_reflection_random_angle fixed."),
|
|
151
|
+
action="store_true",
|
|
152
|
+
)
|
|
153
|
+
return config.initialize(db_config=True, simulation_model="telescope")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def add_parameters(
|
|
157
|
+
all_parameters,
|
|
158
|
+
mirror_reflection,
|
|
159
|
+
mirror_align,
|
|
160
|
+
mirror_reflection_fraction=0.15,
|
|
161
|
+
mirror_reflection_2=0.035,
|
|
162
|
+
):
|
|
163
|
+
"""
|
|
164
|
+
Transform and add parameters to the all_parameters list.
|
|
165
|
+
|
|
166
|
+
Parameters
|
|
167
|
+
----------
|
|
168
|
+
mirror_reflection : float
|
|
169
|
+
The random angle of mirror reflection.
|
|
170
|
+
|
|
171
|
+
mirror_align : float
|
|
172
|
+
The random angle for mirror alignment (both horizontal and vertical).
|
|
173
|
+
|
|
174
|
+
mirror_reflection_fraction : float, optional
|
|
175
|
+
The fraction of the mirror reflection. Default is 0.15.
|
|
176
|
+
|
|
177
|
+
mirror_reflection_2 : float, optional
|
|
178
|
+
A secondary random angle for mirror reflection. Default is 0.035.
|
|
179
|
+
|
|
180
|
+
Returns
|
|
181
|
+
-------
|
|
182
|
+
None
|
|
183
|
+
Updates the all_parameters list in place.
|
|
184
|
+
"""
|
|
185
|
+
# If we want to start from values different than the ones currently in the model:
|
|
186
|
+
# align = 0.0046
|
|
187
|
+
# pars_to_change = {
|
|
188
|
+
# 'mirror_reflection_random_angle': '0.0075 0.125 0.0037',
|
|
189
|
+
# 'mirror_align_random_horizontal': f'{align} 28 0 0',
|
|
190
|
+
# 'mirror_align_random_vertical': f'{align} 28 0 0',
|
|
191
|
+
# }
|
|
192
|
+
# tel_model.change_multiple_parameters(**pars_to_change)
|
|
193
|
+
pars = {
|
|
194
|
+
"mirror_reflection_random_angle": [
|
|
195
|
+
mirror_reflection,
|
|
196
|
+
mirror_reflection_fraction,
|
|
197
|
+
mirror_reflection_2,
|
|
198
|
+
],
|
|
199
|
+
"mirror_align_random_horizontal": [mirror_align, 28.0, 0.0, 0.0],
|
|
200
|
+
"mirror_align_random_vertical": [mirror_align, 28.0, 0.0, 0.0],
|
|
201
|
+
}
|
|
202
|
+
all_parameters.append(pars)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def get_previous_values(tel_model, logger):
|
|
206
|
+
"""
|
|
207
|
+
Retrieve previous parameter values from the telescope model.
|
|
208
|
+
|
|
209
|
+
Parameters
|
|
210
|
+
----------
|
|
211
|
+
tel_model : TelescopeModel
|
|
212
|
+
Telescope model object.
|
|
213
|
+
logger : logging.Logger
|
|
214
|
+
Logger object for logging messages.
|
|
215
|
+
|
|
216
|
+
Returns
|
|
217
|
+
-------
|
|
218
|
+
tuple
|
|
219
|
+
Tuple containing the previous values of mirror_reflection_random_angle (first entry),
|
|
220
|
+
mirror_reflection_fraction, second entry), mirror_reflection_random_angle (third entry),
|
|
221
|
+
and mirror_align_random_horizontal/vertical.
|
|
222
|
+
"""
|
|
223
|
+
split_par = tel_model.get_parameter_value("mirror_reflection_random_angle")
|
|
224
|
+
mrra_0, mfr_0, mrra2_0 = split_par[0], split_par[1], split_par[2]
|
|
225
|
+
mar_0 = tel_model.get_parameter_value("mirror_align_random_horizontal")[0]
|
|
226
|
+
|
|
227
|
+
logger.debug(
|
|
228
|
+
"Previous parameter values:\n"
|
|
229
|
+
f"MRRA = {mrra_0!s}\n"
|
|
230
|
+
f"MRF = {mfr_0!s}\n"
|
|
231
|
+
f"MRRA2 = {mrra2_0!s}\n"
|
|
232
|
+
f"MAR = {mar_0!s}\n"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
return mrra_0, mfr_0, mrra2_0, mar_0
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def generate_random_parameters(
|
|
239
|
+
all_parameters, n_runs, args_dict, mrra_0, mfr_0, mrra2_0, mar_0, logger
|
|
240
|
+
):
|
|
241
|
+
"""
|
|
242
|
+
Generate random parameters for tuning.
|
|
243
|
+
|
|
244
|
+
Parameters
|
|
245
|
+
----------
|
|
246
|
+
all_parameters : list
|
|
247
|
+
List to store all parameter sets.
|
|
248
|
+
n_runs : int
|
|
249
|
+
Number of random parameter combinations to test.
|
|
250
|
+
args_dict : dict
|
|
251
|
+
Dictionary containing parsed command-line arguments.
|
|
252
|
+
mrra_0 : float
|
|
253
|
+
Initial value of mirror_reflection_random_angle.
|
|
254
|
+
mfr_0 : float
|
|
255
|
+
Initial value of mirror_reflection_fraction.
|
|
256
|
+
mrra2_0 : float
|
|
257
|
+
Initial value of the second mirror_reflection_random_angle.
|
|
258
|
+
mar_0 : float
|
|
259
|
+
Initial value of mirror_align_random_horizontal/vertical.
|
|
260
|
+
logger : logging.Logger
|
|
261
|
+
Logger object for logging messages.
|
|
262
|
+
"""
|
|
263
|
+
# Range around the previous values are hardcoded
|
|
264
|
+
# Number of runs is hardcoded
|
|
265
|
+
if args_dict["fixed"]:
|
|
266
|
+
logger.debug("fixed=True - First entry of mirror_reflection_random_angle is kept fixed.")
|
|
267
|
+
|
|
268
|
+
for _ in range(n_runs):
|
|
269
|
+
mrra_range = 0.004 if not args_dict["fixed"] else 0
|
|
270
|
+
mrf_range = 0.1
|
|
271
|
+
mrra2_range = 0.03
|
|
272
|
+
mar_range = 0.005
|
|
273
|
+
rng = np.random.default_rng()
|
|
274
|
+
mrra = rng.uniform(max(mrra_0 - mrra_range, 0), mrra_0 + mrra_range)
|
|
275
|
+
mrf = rng.uniform(max(mfr_0 - mrf_range, 0), mfr_0 + mrf_range)
|
|
276
|
+
mrra2 = rng.uniform(max(mrra2_0 - mrra2_range, 0), mrra2_0 + mrra2_range)
|
|
277
|
+
mar = rng.uniform(max(mar_0 - mar_range, 0), mar_0 + mar_range)
|
|
278
|
+
add_parameters(all_parameters, mrra, mar, mrf, mrra2)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def load_and_process_data(args_dict):
|
|
282
|
+
"""
|
|
283
|
+
Load and process data if specified in the command-line arguments.
|
|
284
|
+
|
|
285
|
+
Returns
|
|
286
|
+
-------
|
|
287
|
+
- data_to_plot: OrderedDict containing loaded and processed data.
|
|
288
|
+
- radius: Radius data from loaded data (if available).
|
|
289
|
+
"""
|
|
290
|
+
data_to_plot = OrderedDict()
|
|
291
|
+
radius = None
|
|
292
|
+
|
|
293
|
+
if args_dict["data"] is not None:
|
|
294
|
+
data_file = gen.find_file(args_dict["data"], args_dict["model_path"])
|
|
295
|
+
data_to_plot["measured"] = load_data(data_file)
|
|
296
|
+
radius = data_to_plot["measured"]["Radius [cm]"]
|
|
297
|
+
|
|
298
|
+
return data_to_plot, radius
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def calculate_rmsd(data, sim):
|
|
302
|
+
"""Calculate Root Mean Squared Deviation to be used as metric to find the best parameters."""
|
|
303
|
+
return np.sqrt(np.mean((data - sim) ** 2))
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def run_pars(tel_model, args_dict, pars, data_to_plot, radius, pdf_pages):
|
|
307
|
+
"""
|
|
308
|
+
Run the tuning for one set of parameters, add a plot to the pdfPages and return RMSD and D80.
|
|
309
|
+
|
|
310
|
+
Plotting is optional (if plot=True).
|
|
311
|
+
"""
|
|
312
|
+
cumulative_psf = "Cumulative PSF"
|
|
313
|
+
|
|
314
|
+
if pars is not None:
|
|
315
|
+
tel_model.change_multiple_parameters(**pars)
|
|
316
|
+
else:
|
|
317
|
+
raise ValueError("No best parameters found")
|
|
318
|
+
|
|
319
|
+
ray = RayTracing(
|
|
320
|
+
telescope_model=tel_model,
|
|
321
|
+
simtel_path=args_dict["simtel_path"],
|
|
322
|
+
zenith_angle=args_dict["zenith"] * u.deg,
|
|
323
|
+
source_distance=args_dict["src_distance"] * u.km,
|
|
324
|
+
off_axis_angle=[0.0] * u.deg,
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
ray.simulate(test=args_dict["test"], force=True)
|
|
328
|
+
ray.analyze(force=True, use_rx=False)
|
|
329
|
+
|
|
330
|
+
# Plotting cumulative PSF
|
|
331
|
+
im = ray.images()[0]
|
|
332
|
+
d80 = im.get_psf()
|
|
333
|
+
|
|
334
|
+
if radius is not None:
|
|
335
|
+
# Simulated cumulative PSF
|
|
336
|
+
data_to_plot["simulated"] = im.get_cumulative_data(radius * u.cm)
|
|
337
|
+
else:
|
|
338
|
+
raise ValueError("Radius data is not available.")
|
|
339
|
+
|
|
340
|
+
rmsd = calculate_rmsd(
|
|
341
|
+
data_to_plot["measured"][cumulative_psf], data_to_plot["simulated"][cumulative_psf]
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
if args_dict["plot_all"]:
|
|
345
|
+
fig = visualize.plot_1d(
|
|
346
|
+
data_to_plot,
|
|
347
|
+
plot_difference=True,
|
|
348
|
+
no_markers=True,
|
|
349
|
+
)
|
|
350
|
+
ax = fig.get_axes()[0]
|
|
351
|
+
ax.set_ylim(0, 1.05)
|
|
352
|
+
ax.set_title(
|
|
353
|
+
f"refl_rnd={pars['mirror_reflection_random_angle']}, "
|
|
354
|
+
f"align_rnd={pars['mirror_align_random_vertical']}"
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
ax.text(
|
|
358
|
+
0.8,
|
|
359
|
+
0.3,
|
|
360
|
+
f"D80 = {d80:.3f} cm\nRMSD = {rmsd:.4f}",
|
|
361
|
+
verticalalignment="center",
|
|
362
|
+
horizontalalignment="center",
|
|
363
|
+
transform=ax.transAxes,
|
|
364
|
+
)
|
|
365
|
+
plt.tight_layout()
|
|
366
|
+
pdf_pages.savefig(fig)
|
|
367
|
+
plt.clf()
|
|
368
|
+
|
|
369
|
+
return d80, rmsd
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def find_best_parameters(all_parameters, tel_model, args_dict, data_to_plot, radius, pdf_pages):
|
|
373
|
+
"""
|
|
374
|
+
Find the best parameters from all parameter sets.
|
|
375
|
+
|
|
376
|
+
Returns
|
|
377
|
+
-------
|
|
378
|
+
- Tuple of best parameters and their D80 value.
|
|
379
|
+
"""
|
|
380
|
+
min_rmsd = 100
|
|
381
|
+
best_pars = None
|
|
382
|
+
|
|
383
|
+
for pars in all_parameters:
|
|
384
|
+
_, rmsd = run_pars(tel_model, args_dict, pars, data_to_plot, radius, pdf_pages)
|
|
385
|
+
if rmsd < min_rmsd:
|
|
386
|
+
min_rmsd = rmsd
|
|
387
|
+
best_pars = pars
|
|
388
|
+
|
|
389
|
+
return best_pars, min_rmsd
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
def main(): # noqa: D103
|
|
393
|
+
args_dict, db_config = _parse()
|
|
394
|
+
|
|
395
|
+
label = "tune_psf"
|
|
396
|
+
logger = logging.getLogger()
|
|
397
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
398
|
+
|
|
399
|
+
# Output directory to save files related directly to this app
|
|
400
|
+
_io_handler = io_handler.IOHandler()
|
|
401
|
+
output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
|
|
402
|
+
tel_model = TelescopeModel(
|
|
403
|
+
site=args_dict["site"],
|
|
404
|
+
telescope_name=args_dict["telescope"],
|
|
405
|
+
mongo_db_config=db_config,
|
|
406
|
+
model_version=args_dict["model_version"],
|
|
407
|
+
label=label,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
all_parameters = []
|
|
411
|
+
mrra_0, mfr_0, mrra2_0, mar_0 = get_previous_values(tel_model, logger)
|
|
412
|
+
|
|
413
|
+
n_runs = 5 if args_dict["test"] else 50
|
|
414
|
+
generate_random_parameters(
|
|
415
|
+
all_parameters, n_runs, args_dict, mrra_0, mfr_0, mrra2_0, mar_0, logger
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
data_to_plot, radius = load_and_process_data(args_dict)
|
|
419
|
+
|
|
420
|
+
# Preparing figure name
|
|
421
|
+
plot_file_name = "_".join((label, tel_model.name + ".pdf"))
|
|
422
|
+
plot_file = output_dir.joinpath(plot_file_name)
|
|
423
|
+
pdf_pages = PdfPages(plot_file)
|
|
424
|
+
|
|
425
|
+
best_pars, _ = find_best_parameters(
|
|
426
|
+
all_parameters, tel_model, args_dict, data_to_plot, radius, pdf_pages
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
# Rerunning and plotting the best pars
|
|
430
|
+
run_pars(tel_model, args_dict, best_pars, data_to_plot, radius, pdf_pages)
|
|
431
|
+
plt.close()
|
|
432
|
+
pdf_pages.close()
|
|
433
|
+
|
|
434
|
+
# Printing the results
|
|
435
|
+
print("Best parameters:")
|
|
436
|
+
for par, value in best_pars.items():
|
|
437
|
+
print(f"{par} = {value}")
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
if __name__ == "__main__":
|
|
441
|
+
main()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
"""
|
|
3
|
+
Generate sim_telarray configuration files for a given array.
|
|
4
|
+
|
|
5
|
+
The applications generates the sim_telarray configuration files for a given array, site,
|
|
6
|
+
and model_version using the model parameters stored in the database.
|
|
7
|
+
|
|
8
|
+
To change model parameters, clone the model parameters repository and apply the changes.
|
|
9
|
+
Forward the path to the repository to the application using the ``--db_simulation_model_url``
|
|
10
|
+
argument.
|
|
11
|
+
|
|
12
|
+
Command line arguments
|
|
13
|
+
----------------------
|
|
14
|
+
site : str
|
|
15
|
+
Site name (e.g., North, South).
|
|
16
|
+
array_layout_name : str
|
|
17
|
+
Name of the layout array (e.g., test_layout, alpha, 4mst, etc.).
|
|
18
|
+
array_element_list : list
|
|
19
|
+
List of array elements (e.g., telescopes) to plot (e.g., ``LSTN-01 LSTN-02 MSTN``).
|
|
20
|
+
|
|
21
|
+
Example
|
|
22
|
+
-------
|
|
23
|
+
North - 5.0.0:
|
|
24
|
+
|
|
25
|
+
.. code-block:: console
|
|
26
|
+
|
|
27
|
+
simtools-generate-array-config --site North --array_layout_name alpha --model_version 5.0.0
|
|
28
|
+
|
|
29
|
+
The output is saved in simtools-output/test/model.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
import logging
|
|
33
|
+
from pathlib import Path
|
|
34
|
+
|
|
35
|
+
import simtools.utils.general as gen
|
|
36
|
+
from simtools.configuration import configurator
|
|
37
|
+
from simtools.model.array_model import ArrayModel
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse(label, description):
|
|
41
|
+
"""
|
|
42
|
+
Parse command line configuration.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
label : str
|
|
47
|
+
Label describing the application.
|
|
48
|
+
description : str
|
|
49
|
+
Description of the application.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
CommandLineParser
|
|
54
|
+
Command line parser object.
|
|
55
|
+
"""
|
|
56
|
+
config = configurator.Configurator(label=label, description=description)
|
|
57
|
+
return config.initialize(db_config=True, simulation_model=["site", "layout"])
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def main():
|
|
61
|
+
"""Generate sim_telarray configuration files for a given array."""
|
|
62
|
+
args_dict, db_config = _parse(
|
|
63
|
+
label=Path(__file__).stem,
|
|
64
|
+
description=("Generate sim_telarray configuration files for a given array."),
|
|
65
|
+
)
|
|
66
|
+
logger = logging.getLogger("simtools")
|
|
67
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
68
|
+
|
|
69
|
+
array_model = ArrayModel(
|
|
70
|
+
label=args_dict["label"],
|
|
71
|
+
model_version=args_dict["model_version"],
|
|
72
|
+
mongo_db_config=db_config,
|
|
73
|
+
site=args_dict.get("site"),
|
|
74
|
+
layout_name=args_dict.get("array_layout_name"),
|
|
75
|
+
array_elements=args_dict.get("array_elements"),
|
|
76
|
+
)
|
|
77
|
+
array_model.print_telescope_list()
|
|
78
|
+
array_model.export_all_simtel_config_files()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
main()
|