gammasimtools 0.6.0__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.0.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 +329 -533
- 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 -496
- simtools/model/mirrors.py +61 -44
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +7 -103
- 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 +266 -568
- 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.0.dist-info/METADATA +0 -180
- gammasimtools-0.6.0.dist-info/RECORD +0 -91
- gammasimtools-0.6.0.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 -1481
- 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.0.dist-info → gammasimtools-0.8.1.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.0.dist-info → gammasimtools-0.8.1.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
"""
|
|
3
|
+
Add parameters found in a model parameter repository to a new database.
|
|
4
|
+
|
|
5
|
+
Generates a new database with all required collections.
|
|
6
|
+
Follows the structure of the CTAO gitlab model parameters repository.
|
|
7
|
+
file as input.
|
|
8
|
+
|
|
9
|
+
This is an application for experts and should not be used by the general user.
|
|
10
|
+
|
|
11
|
+
Command line arguments
|
|
12
|
+
|
|
13
|
+
input_path (str, required)
|
|
14
|
+
Path of local copy of model parameter repository.
|
|
15
|
+
db_name (str, required)
|
|
16
|
+
Name of new DB to be created.
|
|
17
|
+
type (str, optional)
|
|
18
|
+
Type of data to be uploaded to the DB. Options are: model_parameters
|
|
19
|
+
|
|
20
|
+
Examples
|
|
21
|
+
--------
|
|
22
|
+
Upload model data repository to the DB:
|
|
23
|
+
|
|
24
|
+
.. code-block:: console
|
|
25
|
+
|
|
26
|
+
simtools-db-add_model-parameters-from-repository-to-db \
|
|
27
|
+
--input_path /path/to/repository \
|
|
28
|
+
--db_name new_db_name \
|
|
29
|
+
--type model_parameters
|
|
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.db import db_handler
|
|
38
|
+
from simtools.utils import names
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _parse(label=None, description=None):
|
|
42
|
+
"""
|
|
43
|
+
Parse command line configuration.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
label : str
|
|
48
|
+
Label describing application.
|
|
49
|
+
description : str
|
|
50
|
+
Description of application.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
CommandLineParser
|
|
55
|
+
Command line parser object.
|
|
56
|
+
"""
|
|
57
|
+
config = configurator.Configurator(label=label, description=description)
|
|
58
|
+
config.parser.add_argument(
|
|
59
|
+
"--input_path",
|
|
60
|
+
help="Path to model parameter repository.",
|
|
61
|
+
type=Path,
|
|
62
|
+
required=True,
|
|
63
|
+
)
|
|
64
|
+
config.parser.add_argument(
|
|
65
|
+
"--db_name",
|
|
66
|
+
help="Name of the new model parameter database to be created.",
|
|
67
|
+
type=str.strip,
|
|
68
|
+
required=True,
|
|
69
|
+
)
|
|
70
|
+
config.parser.add_argument(
|
|
71
|
+
"--type",
|
|
72
|
+
help="Type of data to be uploaded to the database.",
|
|
73
|
+
type=str,
|
|
74
|
+
required=False,
|
|
75
|
+
default="model_parameters",
|
|
76
|
+
choices=["model_parameters"],
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
args_dict, db_config = config.initialize(
|
|
80
|
+
output=True, require_command_line=True, db_config=True, simulation_model="version"
|
|
81
|
+
)
|
|
82
|
+
db_config["db_simulation_model"] = args_dict["db_name"] # overwrite explicitly DB configuration
|
|
83
|
+
return args_dict, db_config
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def add_values_from_json_to_db(file, collection, db, db_name, file_prefix, logger):
|
|
87
|
+
"""
|
|
88
|
+
Upload data from json files to db.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
file : list
|
|
93
|
+
Json file to be uploaded to the DB.
|
|
94
|
+
collection : str
|
|
95
|
+
The DB collection to which to add the file.
|
|
96
|
+
db : DatabaseHandler
|
|
97
|
+
Database handler object.
|
|
98
|
+
db_name : str
|
|
99
|
+
Name of the database to be created.
|
|
100
|
+
file_prefix : str
|
|
101
|
+
Path to location of all additional files to be uploaded.
|
|
102
|
+
logger : logging.Logger
|
|
103
|
+
Logger object.
|
|
104
|
+
"""
|
|
105
|
+
par_dict = gen.collect_data_from_file(file_name=file)
|
|
106
|
+
logger.info(
|
|
107
|
+
f"Adding the following parameter to the DB: {par_dict['parameter']} "
|
|
108
|
+
f"(collection {collection} in database {db_name})"
|
|
109
|
+
)
|
|
110
|
+
db.add_new_parameter(
|
|
111
|
+
db_name=db_name,
|
|
112
|
+
array_element_name=par_dict["instrument"],
|
|
113
|
+
parameter=par_dict["parameter"],
|
|
114
|
+
version=par_dict["version"],
|
|
115
|
+
value=par_dict["value"],
|
|
116
|
+
site=par_dict["site"],
|
|
117
|
+
type=par_dict["type"],
|
|
118
|
+
collection_name=collection,
|
|
119
|
+
applicable=par_dict["applicable"],
|
|
120
|
+
file=par_dict["file"],
|
|
121
|
+
unit=par_dict.get("unit", None),
|
|
122
|
+
file_prefix=file_prefix,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _add_model_parameters_to_db(args_dict, db, logger):
|
|
127
|
+
"""
|
|
128
|
+
Add model parameters to the DB.
|
|
129
|
+
|
|
130
|
+
Parameters
|
|
131
|
+
----------
|
|
132
|
+
args_dict : dict
|
|
133
|
+
Command line arguments.
|
|
134
|
+
db : DatabaseHandler
|
|
135
|
+
Database handler object.
|
|
136
|
+
logger : logging.Logger
|
|
137
|
+
Logger object.
|
|
138
|
+
|
|
139
|
+
"""
|
|
140
|
+
input_path = Path(args_dict["input_path"])
|
|
141
|
+
array_elements = [d for d in input_path.iterdir() if d.is_dir()]
|
|
142
|
+
for element in array_elements:
|
|
143
|
+
try:
|
|
144
|
+
collection = names.get_collection_name_from_array_element_name(element.name)
|
|
145
|
+
except ValueError:
|
|
146
|
+
if element.name.startswith("OBS"):
|
|
147
|
+
collection = "sites"
|
|
148
|
+
elif element.name in {"configuration_sim_telarray", "configuration_corsika"}:
|
|
149
|
+
collection = element.name
|
|
150
|
+
elif element.name == "Files":
|
|
151
|
+
logger.info("Files are uploaded with the corresponding model parameters")
|
|
152
|
+
continue
|
|
153
|
+
logger.info(f"Reading model parameters for {element.name} into collection {collection}")
|
|
154
|
+
files_to_insert = list(Path(element).rglob("*json"))
|
|
155
|
+
for file in files_to_insert:
|
|
156
|
+
if collection == "files":
|
|
157
|
+
logger.info("Not yet implemented files")
|
|
158
|
+
else:
|
|
159
|
+
add_values_from_json_to_db(
|
|
160
|
+
file=file,
|
|
161
|
+
collection=collection,
|
|
162
|
+
db=db,
|
|
163
|
+
db_name=args_dict["db_name"],
|
|
164
|
+
file_prefix=input_path / "Files",
|
|
165
|
+
logger=logger,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def main():
|
|
170
|
+
"""Application main."""
|
|
171
|
+
label = Path(__file__).stem
|
|
172
|
+
args_dict, db_config = _parse(
|
|
173
|
+
label, description="Add or update a model parameter database to the DB"
|
|
174
|
+
)
|
|
175
|
+
logger = logging.getLogger()
|
|
176
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
177
|
+
|
|
178
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
179
|
+
|
|
180
|
+
_add_model_parameters_to_db(args_dict, db, logger)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
if __name__ == "__main__":
|
|
184
|
+
main()
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Add a new parameter / value to a collection in the DB using a json file as input.
|
|
5
|
+
|
|
6
|
+
Command line arguments
|
|
7
|
+
----------------------
|
|
8
|
+
file_name (str, required)
|
|
9
|
+
Name of the file to upload including the full path.
|
|
10
|
+
db_collection (str, required)
|
|
11
|
+
The DB collection to which to add the file.
|
|
12
|
+
db (str)
|
|
13
|
+
The DB to insert the files to. \
|
|
14
|
+
The choices are either the default CTA simulation DB or a sandbox for testing.
|
|
15
|
+
|
|
16
|
+
Example
|
|
17
|
+
-------
|
|
18
|
+
|
|
19
|
+
Upload a file to sites collection:
|
|
20
|
+
|
|
21
|
+
.. code-block:: console
|
|
22
|
+
|
|
23
|
+
simtools-add-value-from-json-to-db \\
|
|
24
|
+
--file_name new_value.json --db_collection sites
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
import logging
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
import simtools.utils.general as gen
|
|
33
|
+
from simtools.configuration import configurator
|
|
34
|
+
from simtools.db import db_handler
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse():
|
|
38
|
+
config = configurator.Configurator(description="Add a new parameter to the DB.")
|
|
39
|
+
group = config.parser.add_mutually_exclusive_group(required=True)
|
|
40
|
+
group.add_argument("--file_name", help="file to be added", type=str)
|
|
41
|
+
group.add_argument(
|
|
42
|
+
"--input_path",
|
|
43
|
+
help="A directory with json files to upload to the DB.",
|
|
44
|
+
type=Path,
|
|
45
|
+
)
|
|
46
|
+
config.parser.add_argument(
|
|
47
|
+
"--db_collection", help="DB collection to which to add new values.", required=True
|
|
48
|
+
)
|
|
49
|
+
config.parser.add_argument("--db", help="Database name", type=str, required=True)
|
|
50
|
+
return config.initialize(db_config=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def main(): # noqa: D103
|
|
54
|
+
args_dict, db_config = _parse()
|
|
55
|
+
|
|
56
|
+
logger = logging.getLogger()
|
|
57
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
58
|
+
|
|
59
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
60
|
+
|
|
61
|
+
files_to_insert = []
|
|
62
|
+
if args_dict.get("file_name", None) is not None:
|
|
63
|
+
files_to_insert.append(args_dict["file_name"])
|
|
64
|
+
else:
|
|
65
|
+
files_to_insert.extend(Path(args_dict["input_path"]).glob("*json"))
|
|
66
|
+
|
|
67
|
+
if len(files_to_insert) < 1:
|
|
68
|
+
raise ValueError("No files were provided to upload")
|
|
69
|
+
plural = "s" if len(files_to_insert) > 1 else ""
|
|
70
|
+
|
|
71
|
+
print(
|
|
72
|
+
f"Should the following parameter{plural} be inserted to the "
|
|
73
|
+
f"{args_dict['db_collection']} DB collection?:\n"
|
|
74
|
+
)
|
|
75
|
+
print(*files_to_insert, sep="\n")
|
|
76
|
+
print()
|
|
77
|
+
|
|
78
|
+
if gen.user_confirm():
|
|
79
|
+
for file_to_insert_now in files_to_insert:
|
|
80
|
+
par_dict = gen.collect_data_from_file(file_name=file_to_insert_now)
|
|
81
|
+
logger.info(f"Adding the following parameter to the DB: {par_dict['parameter']}")
|
|
82
|
+
db.add_new_parameter(
|
|
83
|
+
db_name=db_config["db_simulation_model"],
|
|
84
|
+
array_element_name=par_dict["instrument"],
|
|
85
|
+
parameter=par_dict["parameter"],
|
|
86
|
+
version=par_dict["version"],
|
|
87
|
+
value=par_dict["value"],
|
|
88
|
+
site=par_dict["site"],
|
|
89
|
+
type=par_dict["type"],
|
|
90
|
+
collection_name=args_dict["db_collection"],
|
|
91
|
+
applicable=par_dict["applicable"],
|
|
92
|
+
file=par_dict["file"],
|
|
93
|
+
unit=par_dict.get("unit", None),
|
|
94
|
+
file_prefix="./",
|
|
95
|
+
)
|
|
96
|
+
logger.info(
|
|
97
|
+
f"Value for {par_dict['parameter']} added to "
|
|
98
|
+
f"{args_dict['db_collection']} collection."
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
logger.info("Aborted, no change applied to the database")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
if __name__ == "__main__":
|
|
105
|
+
main()
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
"""
|
|
3
|
+
Read array element positions from file and add them to model repository.
|
|
4
|
+
|
|
5
|
+
This is an application for experts and should not be used by the general user.
|
|
6
|
+
Reading of input is fine-tuned to the array element files as provided by CTAO.
|
|
7
|
+
|
|
8
|
+
Command line arguments
|
|
9
|
+
|
|
10
|
+
input : str
|
|
11
|
+
File containing a table of array element positions.
|
|
12
|
+
repository_path : str
|
|
13
|
+
Path of local copy of model parameter repository.
|
|
14
|
+
model_version : str
|
|
15
|
+
Model version.
|
|
16
|
+
site : str
|
|
17
|
+
Observatory site.
|
|
18
|
+
coordinate_system : str
|
|
19
|
+
Coordinate system of array element positions (ground or utm).
|
|
20
|
+
|
|
21
|
+
Examples
|
|
22
|
+
--------
|
|
23
|
+
Add array element positions to repository:
|
|
24
|
+
|
|
25
|
+
.. code-block:: console
|
|
26
|
+
|
|
27
|
+
simtools-write-array-element-positions-to-repository \
|
|
28
|
+
--input /path/to/positions.txt \
|
|
29
|
+
--repository_path /path/to/repository \
|
|
30
|
+
--model_version 1.0.0 \
|
|
31
|
+
--coordinate_system ground \
|
|
32
|
+
--site North
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
import json
|
|
37
|
+
import logging
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
|
|
40
|
+
import astropy.table
|
|
41
|
+
|
|
42
|
+
import simtools.utils.general as gen
|
|
43
|
+
from simtools.configuration import configurator
|
|
44
|
+
from simtools.data_model.model_data_writer import JsonNumpyEncoder, ModelDataWriter
|
|
45
|
+
from simtools.model.array_model import ArrayModel
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _parse(label=None, description=None):
|
|
49
|
+
"""
|
|
50
|
+
Parse command line configuration.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
label : str
|
|
55
|
+
Label describing application.
|
|
56
|
+
description : str
|
|
57
|
+
Description of application.
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
-------
|
|
61
|
+
CommandLineParser
|
|
62
|
+
Command line parser object.
|
|
63
|
+
"""
|
|
64
|
+
config = configurator.Configurator(label=label, description=description)
|
|
65
|
+
config.parser.add_argument(
|
|
66
|
+
"--input",
|
|
67
|
+
help="File containing a table of array element positions.",
|
|
68
|
+
required=False,
|
|
69
|
+
)
|
|
70
|
+
config.parser.add_argument(
|
|
71
|
+
"--repository_path",
|
|
72
|
+
help="Output path to model parameter repository.",
|
|
73
|
+
type=Path,
|
|
74
|
+
required=False,
|
|
75
|
+
)
|
|
76
|
+
config.parser.add_argument(
|
|
77
|
+
"--coordinate_system",
|
|
78
|
+
help="Coordinate system of array element positions (utm or ground).",
|
|
79
|
+
default="ground",
|
|
80
|
+
required=False,
|
|
81
|
+
type=str,
|
|
82
|
+
choices=["ground", "utm"],
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return config.initialize(db_config=True, simulation_model="site")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def write_utm_array_elements_to_repository(args_dict, logger):
|
|
89
|
+
"""
|
|
90
|
+
Write UTM position of array elements to model repository.
|
|
91
|
+
|
|
92
|
+
Read array element positions from file. The ecsv row definition might
|
|
93
|
+
include telescope_name or asset_code and sequence_number.
|
|
94
|
+
|
|
95
|
+
Parameters
|
|
96
|
+
----------
|
|
97
|
+
args_dict : dict
|
|
98
|
+
Command line arguments.
|
|
99
|
+
logger : Logger
|
|
100
|
+
Logger object.
|
|
101
|
+
|
|
102
|
+
"""
|
|
103
|
+
array_elements = astropy.table.Table.read(args_dict["input"])
|
|
104
|
+
for row in array_elements:
|
|
105
|
+
instrument = (
|
|
106
|
+
row["telescope_name"]
|
|
107
|
+
if "telescope_name" in array_elements.colnames
|
|
108
|
+
else f"{row['asset_code']}-{row['sequence_number']}"
|
|
109
|
+
)
|
|
110
|
+
output_path = Path(args_dict["repository_path"]) / f"{instrument}"
|
|
111
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
112
|
+
logger.info(f"Writing array element positions (utm) to {output_path}")
|
|
113
|
+
|
|
114
|
+
ModelDataWriter.dump_model_parameter(
|
|
115
|
+
parameter_name="array_element_position_utm",
|
|
116
|
+
instrument=instrument,
|
|
117
|
+
value=f"{row['utm_east']} {row['utm_north']} {row['altitude']}",
|
|
118
|
+
model_version=args_dict["model_version"],
|
|
119
|
+
output_path=output_path,
|
|
120
|
+
output_file="array_element_position_utm.json",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def write_ground_array_elements_to_repository(args_dict, db_config, logger):
|
|
125
|
+
"""
|
|
126
|
+
Write ground position of array elements to model repository.
|
|
127
|
+
|
|
128
|
+
Parameters
|
|
129
|
+
----------
|
|
130
|
+
args_dict : dict
|
|
131
|
+
Command line arguments.
|
|
132
|
+
db_config : dict
|
|
133
|
+
Database configuration.
|
|
134
|
+
logger : Logger
|
|
135
|
+
Logger object.
|
|
136
|
+
|
|
137
|
+
"""
|
|
138
|
+
array_model = ArrayModel(
|
|
139
|
+
mongo_db_config=db_config,
|
|
140
|
+
model_version=args_dict["model_version"],
|
|
141
|
+
site=args_dict["site"],
|
|
142
|
+
array_elements=args_dict["input"],
|
|
143
|
+
)
|
|
144
|
+
for element_name, data in array_model.array_elements.items():
|
|
145
|
+
output_path = Path(args_dict["repository_path"]) / f"{element_name}"
|
|
146
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
147
|
+
logger.info(f"Writing array element positions (ground) to {output_path}")
|
|
148
|
+
with open(
|
|
149
|
+
output_path / "array_element_position_ground.json", "w", encoding="utf-8"
|
|
150
|
+
) as file:
|
|
151
|
+
json.dump(
|
|
152
|
+
data,
|
|
153
|
+
file,
|
|
154
|
+
indent=4,
|
|
155
|
+
sort_keys=False,
|
|
156
|
+
cls=JsonNumpyEncoder,
|
|
157
|
+
)
|
|
158
|
+
file.write("\n")
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def main():
|
|
162
|
+
"""Application main."""
|
|
163
|
+
label = Path(__file__).stem
|
|
164
|
+
args_dict, db_config = _parse(
|
|
165
|
+
label, description="Add array element positions to model parameter repository"
|
|
166
|
+
)
|
|
167
|
+
logger = logging.getLogger()
|
|
168
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
169
|
+
|
|
170
|
+
if args_dict["coordinate_system"] == "utm":
|
|
171
|
+
write_utm_array_elements_to_repository(args_dict, logger)
|
|
172
|
+
elif args_dict["coordinate_system"] == "ground":
|
|
173
|
+
write_ground_array_elements_to_repository(args_dict, db_config, logger)
|
|
174
|
+
else:
|
|
175
|
+
logger.error("Invalid coordinate system. Allowed are 'utm' and 'ground'.")
|
|
176
|
+
raise ValueError
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if __name__ == "__main__":
|
|
180
|
+
main()
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Get list of array layouts or list of elements for a given layout as defined in the db.
|
|
5
|
+
|
|
6
|
+
To get the list of pre-defined array layouts, use ``--list_available_layouts``.
|
|
7
|
+
|
|
8
|
+
To get the list of array elements for a given layout, use ``--array_layout_name``.
|
|
9
|
+
|
|
10
|
+
To get the positions for a set of array elements, use ``--array_element_list``.
|
|
11
|
+
Listing of array elements follows this logic:
|
|
12
|
+
|
|
13
|
+
* explicit listing: e.g., ``-array_element_list MSTN-01, MSTN05``
|
|
14
|
+
* listing of types: e.g, ``-array_element_list MSTN`` plots all telescopes of type MSTN.
|
|
15
|
+
|
|
16
|
+
Command line arguments
|
|
17
|
+
----------------------
|
|
18
|
+
list_available_layouts : bool, optional
|
|
19
|
+
List available layouts in the database.
|
|
20
|
+
array_layout_name : str
|
|
21
|
+
Name of the layout array (e.g., test_layout, alpha, 4mst, etc.).
|
|
22
|
+
array_element_list : list
|
|
23
|
+
List of array elements (e.g., telescopes) to plot (e.g., ``LSTN-01 LSTN-02 MSTN``).
|
|
24
|
+
coordinate_system : str, optional
|
|
25
|
+
Coordinate system for the array layout (ground or utm).
|
|
26
|
+
output_file : str, optional
|
|
27
|
+
Name of the output file to be saved as astropy table (ecsv file)
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
--------
|
|
31
|
+
List pre-defined array layouts.
|
|
32
|
+
|
|
33
|
+
.. code-block:: console
|
|
34
|
+
|
|
35
|
+
simtools-db-get-array-layouts-from-db --site North --model_version "6.0.0"
|
|
36
|
+
|
|
37
|
+
Retrieve telescope positions for array layout 'test_layout' from database.
|
|
38
|
+
|
|
39
|
+
.. code-block:: console
|
|
40
|
+
|
|
41
|
+
simtools-db-get-array-layouts-from-db --site North --model_version "6.0.0"
|
|
42
|
+
--array_layout_name test_layout
|
|
43
|
+
|
|
44
|
+
Retrieve telescope positions from database (utm coordinate system) and write to an ecsv files
|
|
45
|
+
|
|
46
|
+
.. code-block:: console
|
|
47
|
+
|
|
48
|
+
simtools-db-get-array-layouts-from-db --site North --model_version "6.0.0"
|
|
49
|
+
--array_element_list LSTN-01 LSTN-02 MSTN
|
|
50
|
+
--coordinate_system utm
|
|
51
|
+
--output_file telescope_positions-test_layout.ecsv
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
import logging
|
|
55
|
+
from pathlib import Path
|
|
56
|
+
|
|
57
|
+
import simtools.data_model.model_data_writer as writer
|
|
58
|
+
import simtools.utils.general as gen
|
|
59
|
+
from simtools.configuration import configurator
|
|
60
|
+
from simtools.model.array_model import ArrayModel
|
|
61
|
+
from simtools.model.site_model import SiteModel
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _parse(label, description):
|
|
65
|
+
"""
|
|
66
|
+
Parse command line configuration.
|
|
67
|
+
|
|
68
|
+
Parameters
|
|
69
|
+
----------
|
|
70
|
+
label : str
|
|
71
|
+
Label describing the application.
|
|
72
|
+
description : str
|
|
73
|
+
Description of the application.
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
-------
|
|
77
|
+
CommandLineParser
|
|
78
|
+
Command line parser object.
|
|
79
|
+
"""
|
|
80
|
+
config = configurator.Configurator(label=label, description=description)
|
|
81
|
+
|
|
82
|
+
input_group = config.parser.add_mutually_exclusive_group()
|
|
83
|
+
input_group.add_argument(
|
|
84
|
+
"--list_available_layouts",
|
|
85
|
+
help="List available layouts in the database.",
|
|
86
|
+
action="store_true",
|
|
87
|
+
required=False,
|
|
88
|
+
)
|
|
89
|
+
config.parser.add_argument(
|
|
90
|
+
"--coordinate_system",
|
|
91
|
+
help="Coordinate system for the array layout.",
|
|
92
|
+
type=str,
|
|
93
|
+
required=False,
|
|
94
|
+
default="ground",
|
|
95
|
+
choices=["ground", "utm"],
|
|
96
|
+
)
|
|
97
|
+
return config.initialize(db_config=True, simulation_model=["site", "layout"], output=True)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _layout_from_db(args_dict, db_config):
|
|
101
|
+
"""
|
|
102
|
+
Read array elements and their positions from data base using the layout name.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
args_dict : dict
|
|
107
|
+
Dictionary with the command line arguments.
|
|
108
|
+
db_config : dict
|
|
109
|
+
Database configuration.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
astropy.table.Table
|
|
114
|
+
Table with array element positions.
|
|
115
|
+
"""
|
|
116
|
+
array_model = ArrayModel(
|
|
117
|
+
mongo_db_config=db_config,
|
|
118
|
+
model_version=args_dict["model_version"],
|
|
119
|
+
site=args_dict["site"],
|
|
120
|
+
layout_name=args_dict.get("array_layout_name", None),
|
|
121
|
+
array_elements=args_dict.get("array_element_list", None),
|
|
122
|
+
)
|
|
123
|
+
return array_model.export_array_elements_as_table(
|
|
124
|
+
coordinate_system=args_dict["coordinate_system"]
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def main():
|
|
129
|
+
"""Get list of array elements as defined in the db (array layout)."""
|
|
130
|
+
label = Path(__file__).stem
|
|
131
|
+
args_dict, db_config = _parse(
|
|
132
|
+
label,
|
|
133
|
+
"Get list of array elements as defined in the db (array layout).",
|
|
134
|
+
)
|
|
135
|
+
logger = logging.getLogger()
|
|
136
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
137
|
+
|
|
138
|
+
if args_dict.get("list_available_layouts", False):
|
|
139
|
+
if args_dict.get("site", None) is None:
|
|
140
|
+
raise ValueError("Site must be provided to list available layouts.")
|
|
141
|
+
site_model = SiteModel(
|
|
142
|
+
mongo_db_config=db_config,
|
|
143
|
+
model_version=args_dict["model_version"],
|
|
144
|
+
site=args_dict["site"],
|
|
145
|
+
)
|
|
146
|
+
print(site_model.get_list_of_array_layouts())
|
|
147
|
+
else:
|
|
148
|
+
logger.info("Array layout: %s", args_dict["array_layout_name"])
|
|
149
|
+
layout = _layout_from_db(args_dict, db_config)
|
|
150
|
+
layout.pprint()
|
|
151
|
+
|
|
152
|
+
if not args_dict.get("output_file_from_default", False):
|
|
153
|
+
writer.ModelDataWriter.dump(
|
|
154
|
+
args_dict=args_dict,
|
|
155
|
+
output_file=args_dict["output_file"],
|
|
156
|
+
metadata=None,
|
|
157
|
+
product_data=layout,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
main()
|