gammasimtools 0.21.0__py3-none-any.whl → 0.23.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/METADATA +3 -3
- gammasimtools-0.23.0.dist-info/RECORD +414 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/entry_points.txt +2 -1
- simtools/_version.py +2 -2
- simtools/application_control.py +118 -0
- simtools/applications/calculate_incident_angles.py +17 -25
- simtools/applications/convert_all_model_parameters_from_simtel.py +29 -45
- simtools/applications/convert_geo_coordinates_of_array_elements.py +26 -45
- simtools/applications/convert_model_parameter_from_simtel.py +21 -42
- simtools/applications/db_add_file_to_db.py +12 -13
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +20 -33
- simtools/applications/db_add_value_from_json_to_db.py +28 -23
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +19 -34
- simtools/applications/db_generate_compound_indexes.py +12 -27
- simtools/applications/db_get_array_layouts_from_db.py +19 -39
- simtools/applications/db_get_file_from_db.py +15 -17
- simtools/applications/db_get_parameter_from_db.py +33 -35
- simtools/applications/db_inspect_databases.py +10 -11
- simtools/applications/db_upload_model_repository.py +104 -0
- simtools/applications/derive_ctao_array_layouts.py +16 -21
- simtools/applications/derive_mirror_rnda.py +9 -14
- simtools/applications/derive_photon_electron_spectrum.py +7 -10
- simtools/applications/derive_psf_parameters.py +24 -21
- simtools/applications/derive_trigger_rates.py +6 -9
- simtools/applications/docs_produce_array_element_report.py +22 -23
- simtools/applications/docs_produce_calibration_reports.py +26 -24
- simtools/applications/docs_produce_model_parameter_reports.py +15 -22
- simtools/applications/docs_produce_simulation_configuration_report.py +21 -22
- simtools/applications/generate_array_config.py +14 -33
- simtools/applications/generate_corsika_histograms.py +22 -43
- simtools/applications/generate_default_metadata.py +15 -36
- simtools/applications/generate_regular_arrays.py +11 -15
- simtools/applications/generate_simtel_event_data.py +23 -33
- simtools/applications/maintain_simulation_model_add_production.py +17 -48
- simtools/applications/maintain_simulation_model_compare_productions.py +10 -12
- simtools/applications/maintain_simulation_model_verify_production_tables.py +8 -11
- simtools/applications/merge_tables.py +15 -24
- simtools/applications/plot_array_layout.py +77 -55
- simtools/applications/plot_simtel_events.py +11 -13
- simtools/applications/plot_tabular_data.py +17 -38
- simtools/applications/plot_tabular_data_for_model_parameter.py +16 -23
- simtools/applications/print_version.py +14 -42
- simtools/applications/production_derive_corsika_limits.py +5 -9
- simtools/applications/production_derive_statistics.py +12 -26
- simtools/applications/production_generate_grid.py +20 -48
- simtools/applications/production_merge_corsika_limits.py +17 -21
- simtools/applications/run_application.py +12 -32
- simtools/applications/simulate_flasher.py +79 -81
- simtools/applications/simulate_illuminator.py +56 -197
- simtools/applications/{simulate_calibration_events.py → simulate_pedestals.py} +22 -68
- simtools/applications/simulate_prod.py +21 -33
- simtools/applications/simulate_prod_htcondor_generator.py +11 -25
- simtools/applications/submit_array_layouts.py +15 -18
- simtools/applications/submit_data_from_external.py +18 -34
- simtools/applications/submit_model_parameter_from_external.py +27 -41
- simtools/applications/validate_camera_efficiency.py +23 -22
- simtools/applications/validate_camera_fov.py +21 -27
- simtools/applications/validate_cumulative_psf.py +28 -37
- simtools/applications/validate_file_using_schema.py +35 -45
- simtools/applications/validate_optics.py +27 -33
- simtools/camera/camera_efficiency.py +8 -13
- simtools/configuration/commandline_parser.py +33 -11
- simtools/configuration/configurator.py +0 -7
- simtools/corsika/corsika_config.py +9 -16
- simtools/corsika/corsika_histograms.py +1 -1
- simtools/data_model/data_reader.py +0 -2
- simtools/data_model/metadata_collector.py +0 -2
- simtools/data_model/model_data_writer.py +87 -27
- simtools/data_model/schema.py +61 -2
- simtools/data_model/validate_data.py +1 -3
- simtools/db/db_handler.py +58 -39
- simtools/db/db_model_upload.py +210 -5
- simtools/io/hdf5_handler.py +0 -5
- simtools/io/io_handler.py +31 -83
- simtools/io/legacy_data_handler.py +0 -5
- simtools/job_execution/job_manager.py +43 -1
- simtools/layout/array_layout.py +0 -2
- simtools/layout/array_layout_utils.py +1 -5
- simtools/layout/telescope_position.py +0 -2
- simtools/model/array_model.py +95 -46
- simtools/model/calibration_model.py +0 -2
- simtools/model/camera.py +0 -2
- simtools/model/mirrors.py +0 -2
- simtools/model/model_parameter.py +50 -16
- simtools/model/model_repository.py +139 -106
- simtools/model/model_utils.py +21 -11
- simtools/model/site_model.py +0 -2
- simtools/model/telescope_model.py +20 -2
- simtools/production_configuration/calculate_statistical_uncertainties_grid_point.py +0 -2
- simtools/production_configuration/derive_corsika_limits.py +1 -1
- simtools/production_configuration/derive_production_statistics.py +0 -2
- simtools/production_configuration/interpolation_handler.py +0 -2
- simtools/ray_tracing/incident_angles.py +7 -7
- simtools/ray_tracing/mirror_panel_psf.py +1 -1
- simtools/ray_tracing/psf_analysis.py +0 -2
- simtools/ray_tracing/psf_parameter_optimisation.py +180 -73
- simtools/ray_tracing/ray_tracing.py +1 -5
- simtools/reporting/docs_auto_report_generator.py +108 -0
- simtools/reporting/docs_read_parameters.py +168 -104
- simtools/resources/array_elements.yml +26 -0
- simtools/runners/corsika_runner.py +0 -2
- simtools/runners/corsika_simtel_runner.py +11 -19
- simtools/runners/runner_services.py +5 -6
- simtools/runners/simtel_runner.py +0 -2
- simtools/runners/simtools_runner.py +0 -2
- simtools/schemas/application_workflow.metaschema.yml +1 -1
- simtools/schemas/common_definitions.schema.yml +39 -0
- simtools/schemas/model_parameter.metaschema.yml +19 -13
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -12
- simtools/schemas/model_parameters/adjust_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +0 -5
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +0 -7
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +0 -7
- simtools/schemas/model_parameters/array_layouts.schema.yml +0 -5
- simtools/schemas/model_parameters/array_triggers.schema.yml +0 -5
- simtools/schemas/model_parameters/array_window.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/asum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_shaping.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +0 -5
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +0 -5
- simtools/schemas/model_parameters/axes_offsets.schema.yml +0 -7
- simtools/schemas/model_parameters/calibration_devices.schema.yml +30 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_file.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_depth.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/camera_pixels.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +0 -7
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +0 -7
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +0 -5
- simtools/schemas/model_parameters/dark_events.schema.yml +4 -3
- simtools/schemas/model_parameters/default_trigger.schema.yml +0 -7
- simtools/schemas/model_parameters/design_model.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_start.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -9
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +0 -5
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -5
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -12
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -3
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/epsg_code.schema.yml +0 -5
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +0 -3
- simtools/schemas/model_parameters/flasher_angular_distribution.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_angular_distribution_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_bunch_size.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_external_trigger.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/flasher_position.schema.yml +43 -0
- simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +29 -0
- simtools/schemas/model_parameters/flasher_pulse_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +30 -0
- simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_type.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_var_photons.schema.yml +31 -0
- simtools/schemas/model_parameters/flasher_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/focus_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/gain_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +2 -7
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/laser_events.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +4 -3
- simtools/schemas/model_parameters/led_events.schema.yml +4 -3
- simtools/schemas/model_parameters/led_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/led_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photons.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_class.schema.yml +2 -9
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_list.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +0 -7
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +0 -3
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/num_gains.schema.yml +0 -7
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +0 -7
- simtools/schemas/model_parameters/optics_properties.schema.yml +0 -7
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +0 -3
- simtools/schemas/model_parameters/pedestal_events.schema.yml +4 -7
- simtools/schemas/model_parameters/photon_delay.schema.yml +0 -7
- simtools/schemas/model_parameters/photons_per_run.schema.yml +4 -4
- simtools/schemas/model_parameters/pixel_cells.schema.yml +0 -3
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +0 -3
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -9
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/qe_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -7
- simtools/schemas/model_parameters/random_generator.schema.yml +0 -7
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +0 -7
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +0 -5
- simtools/schemas/model_parameters/sampled_output.schema.yml +0 -7
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/stars.schema.yml +0 -5
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_random.schema.yml +29 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +0 -7
- simtools/schemas/production_tables.schema.yml +8 -8
- simtools/schemas/simulation_models_info.schema.yml +78 -0
- simtools/simtel/simtel_config_reader.py +0 -2
- simtools/simtel/simtel_config_writer.py +118 -26
- simtools/simtel/simtel_io_metadata.py +3 -3
- simtools/simtel/simulator_array.py +43 -85
- simtools/simtel/simulator_camera_efficiency.py +0 -2
- simtools/simtel/simulator_light_emission.py +336 -631
- simtools/simtel/simulator_ray_tracing.py +2 -4
- simtools/simulator.py +45 -19
- simtools/testing/assertions.py +2 -2
- simtools/testing/configuration.py +21 -6
- simtools/testing/sim_telarray_metadata.py +4 -4
- simtools/utils/general.py +5 -13
- simtools/utils/geometry.py +34 -5
- simtools/utils/names.py +1 -13
- simtools/version.py +83 -0
- simtools/visualization/plot_array_layout.py +129 -23
- simtools/visualization/plot_incident_angles.py +0 -2
- simtools/visualization/plot_psf.py +163 -61
- simtools/visualization/plot_simtel_events.py +1 -12
- simtools/visualization/visualize.py +0 -12
- gammasimtools-0.21.0.dist-info/RECORD +0 -396
- simtools/model/flasher_model.py +0 -106
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/top_level.txt +0 -0
|
@@ -25,18 +25,21 @@ r"""
|
|
|
25
25
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
import logging
|
|
29
28
|
import uuid
|
|
30
29
|
from pathlib import Path
|
|
31
30
|
|
|
32
31
|
import simtools.utils.general as gen
|
|
32
|
+
from simtools.application_control import get_application_label, startup_application
|
|
33
33
|
from simtools.configuration import configurator
|
|
34
34
|
from simtools.db import db_handler
|
|
35
35
|
from simtools.io import ascii_handler
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def _parse():
|
|
39
|
-
|
|
39
|
+
"""Parse command line configuration."""
|
|
40
|
+
config = configurator.Configurator(
|
|
41
|
+
label=get_application_label(__file__), description="Add a new parameter to the DB."
|
|
42
|
+
)
|
|
40
43
|
group = config.parser.add_mutually_exclusive_group(required=True)
|
|
41
44
|
group.add_argument("--file_name", help="file to be added", type=str)
|
|
42
45
|
group.add_argument(
|
|
@@ -55,22 +58,22 @@ def _parse():
|
|
|
55
58
|
return config.initialize(db_config=True)
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
def main():
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
logger = logging.getLogger()
|
|
62
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
61
|
+
def main():
|
|
62
|
+
"""Add value from JSON to database."""
|
|
63
|
+
app_context = startup_application(_parse)
|
|
63
64
|
|
|
64
|
-
if
|
|
65
|
-
db_config["db_simulation_model_version"] = str(uuid.uuid4())
|
|
66
|
-
logger.info(
|
|
67
|
-
|
|
65
|
+
if app_context.args.get("test_db", False):
|
|
66
|
+
app_context.db_config["db_simulation_model_version"] = str(uuid.uuid4())
|
|
67
|
+
app_context.logger.info(
|
|
68
|
+
f"Using test database version {app_context.db_config['db_simulation_model_version']}"
|
|
69
|
+
)
|
|
70
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
68
71
|
|
|
69
72
|
files_to_insert = []
|
|
70
|
-
if
|
|
71
|
-
files_to_insert.append(
|
|
73
|
+
if app_context.args.get("file_name", None) is not None:
|
|
74
|
+
files_to_insert.append(app_context.args["file_name"])
|
|
72
75
|
else:
|
|
73
|
-
files_to_insert.extend(Path(
|
|
76
|
+
files_to_insert.extend(Path(app_context.args["input_path"]).glob("*json"))
|
|
74
77
|
|
|
75
78
|
if len(files_to_insert) < 1:
|
|
76
79
|
raise ValueError("No files were provided to upload")
|
|
@@ -78,32 +81,34 @@ def main(): # noqa: D103
|
|
|
78
81
|
|
|
79
82
|
print(
|
|
80
83
|
f"Should the following parameter{plural} be inserted to the "
|
|
81
|
-
f"{
|
|
84
|
+
f"{app_context.args['db_collection']} DB collection?:\n"
|
|
82
85
|
)
|
|
83
86
|
print(*files_to_insert, sep="\n")
|
|
84
87
|
print()
|
|
85
88
|
|
|
86
|
-
logger.info(f"DB {db.get_db_name()} selected.")
|
|
89
|
+
app_context.logger.info(f"DB {db.get_db_name()} selected.")
|
|
87
90
|
|
|
88
91
|
if gen.user_confirm():
|
|
89
92
|
for file_to_insert_now in files_to_insert:
|
|
90
93
|
par_dict = ascii_handler.collect_data_from_file(file_name=file_to_insert_now)
|
|
91
|
-
logger.info(
|
|
94
|
+
app_context.logger.info(
|
|
95
|
+
f"Adding the following parameter to the DB: {par_dict['parameter']}"
|
|
96
|
+
)
|
|
92
97
|
db.add_new_parameter(
|
|
93
98
|
par_dict=par_dict,
|
|
94
|
-
collection_name=
|
|
99
|
+
collection_name=app_context.args["db_collection"],
|
|
95
100
|
file_prefix="./",
|
|
96
101
|
)
|
|
97
|
-
logger.info(
|
|
102
|
+
app_context.logger.info(
|
|
98
103
|
f"Value for {par_dict['parameter']} added to "
|
|
99
|
-
f"{
|
|
104
|
+
f"{app_context.args['db_collection']} collection."
|
|
100
105
|
)
|
|
101
106
|
else:
|
|
102
|
-
logger.info("Aborted, no change applied to the database")
|
|
107
|
+
app_context.logger.info("Aborted, no change applied to the database")
|
|
103
108
|
|
|
104
109
|
# drop test database; be safe and required DB name is sandbox
|
|
105
|
-
if
|
|
106
|
-
logger.info(f"Test database used. Dropping all data from {db.get_db_name()}")
|
|
110
|
+
if app_context.args.get("test_db", False) and "sandbox" in db.get_db_name():
|
|
111
|
+
app_context.logger.info(f"Test database used. Dropping all data from {db.get_db_name()}")
|
|
107
112
|
db.db_client.drop_database(db.get_db_name())
|
|
108
113
|
|
|
109
114
|
|
|
@@ -33,35 +33,23 @@
|
|
|
33
33
|
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
import logging
|
|
37
36
|
from pathlib import Path
|
|
38
37
|
|
|
39
38
|
import astropy.table
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
from simtools.application_control import get_application_label, startup_application
|
|
42
41
|
from simtools.configuration import configurator
|
|
43
42
|
from simtools.data_model.model_data_writer import ModelDataWriter
|
|
44
43
|
from simtools.io import ascii_handler
|
|
45
44
|
from simtools.model.array_model import ArrayModel
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
def _parse(
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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)
|
|
47
|
+
def _parse():
|
|
48
|
+
"""Parse command line configuration."""
|
|
49
|
+
config = configurator.Configurator(
|
|
50
|
+
label=get_application_label(__file__),
|
|
51
|
+
description="Add array element positions to model parameter repository",
|
|
52
|
+
)
|
|
65
53
|
config.parser.add_argument(
|
|
66
54
|
"--input",
|
|
67
55
|
help="File containing a table of array element positions.",
|
|
@@ -96,8 +84,8 @@ def write_utm_array_elements_to_repository(args_dict, logger):
|
|
|
96
84
|
----------
|
|
97
85
|
args_dict : dict
|
|
98
86
|
Command line arguments.
|
|
99
|
-
logger :
|
|
100
|
-
|
|
87
|
+
app_context.logger : app_context.logger
|
|
88
|
+
app_context.logger object.
|
|
101
89
|
|
|
102
90
|
"""
|
|
103
91
|
array_elements = astropy.table.Table.read(args_dict["input"])
|
|
@@ -131,8 +119,8 @@ def write_ground_array_elements_to_repository(args_dict, db_config, logger):
|
|
|
131
119
|
Command line arguments.
|
|
132
120
|
db_config : dict
|
|
133
121
|
Database configuration.
|
|
134
|
-
logger :
|
|
135
|
-
|
|
122
|
+
logger : logger
|
|
123
|
+
logger object.
|
|
136
124
|
|
|
137
125
|
"""
|
|
138
126
|
array_model = ArrayModel(
|
|
@@ -155,19 +143,16 @@ def write_ground_array_elements_to_repository(args_dict, db_config, logger):
|
|
|
155
143
|
|
|
156
144
|
def main():
|
|
157
145
|
"""Application main."""
|
|
158
|
-
|
|
159
|
-
args_dict, db_config = _parse(
|
|
160
|
-
label, description="Add array element positions to model parameter repository"
|
|
161
|
-
)
|
|
162
|
-
logger = logging.getLogger()
|
|
163
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
146
|
+
app_context = startup_application(_parse)
|
|
164
147
|
|
|
165
|
-
if
|
|
166
|
-
write_utm_array_elements_to_repository(
|
|
167
|
-
elif
|
|
168
|
-
write_ground_array_elements_to_repository(
|
|
148
|
+
if app_context.args["coordinate_system"] == "utm":
|
|
149
|
+
write_utm_array_elements_to_repository(app_context.args, app_context.logger)
|
|
150
|
+
elif app_context.args["coordinate_system"] == "ground":
|
|
151
|
+
write_ground_array_elements_to_repository(
|
|
152
|
+
app_context.args, app_context.db_config, app_context.logger
|
|
153
|
+
)
|
|
169
154
|
else:
|
|
170
|
-
logger.error("Invalid coordinate system. Allowed are 'utm' and 'ground'.")
|
|
155
|
+
app_context.logger.error("Invalid coordinate system. Allowed are 'utm' and 'ground'.")
|
|
171
156
|
raise ValueError
|
|
172
157
|
|
|
173
158
|
|
|
@@ -13,16 +13,16 @@ db_name (str, optional)
|
|
|
13
13
|
Database name (use "all" for all databases)
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
import simtools.utils.general as gen
|
|
16
|
+
from simtools.application_control import get_application_label, startup_application
|
|
19
17
|
from simtools.configuration import configurator
|
|
20
18
|
from simtools.db import db_handler
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
def _parse():
|
|
22
|
+
"""Parse command line configuration."""
|
|
24
23
|
config = configurator.Configurator(
|
|
25
|
-
description="Generate compound indexes for a specific database"
|
|
24
|
+
description="Generate compound indexes for a specific database",
|
|
25
|
+
label=get_application_label(__file__),
|
|
26
26
|
)
|
|
27
27
|
config.parser.add_argument(
|
|
28
28
|
"--db_name",
|
|
@@ -33,32 +33,17 @@ def _parse():
|
|
|
33
33
|
return config.initialize(db_config=True)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def main():
|
|
37
|
-
|
|
36
|
+
def main():
|
|
37
|
+
"""Generate compound indexes for the specified database."""
|
|
38
|
+
app_context = startup_application(_parse, setup_io_handler=False)
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
40
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
41
41
|
|
|
42
|
-
db
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]
|
|
47
|
-
requested = db.get_db_name(
|
|
48
|
-
db_name=args_dict["db_name"],
|
|
49
|
-
db_simulation_model_version=args_dict.get("db_simulation_model_version"),
|
|
50
|
-
model_name=args_dict.get("db_simulation_model"),
|
|
42
|
+
db.generate_compound_indexes_for_databases(
|
|
43
|
+
db_name=app_context.args["db_name"],
|
|
44
|
+
db_simulation_model=app_context.args.get("db_simulation_model"),
|
|
45
|
+
db_simulation_model_version=app_context.args.get("db_simulation_model_version"),
|
|
51
46
|
)
|
|
52
|
-
if requested != "all" and requested not in databases:
|
|
53
|
-
raise ValueError(
|
|
54
|
-
f"Requested database '{requested}' not found. "
|
|
55
|
-
f"Following databases are available: {', '.join(databases)}"
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
databases = databases if requested == "all" else [requested]
|
|
59
|
-
for db_name in databases:
|
|
60
|
-
logger.info(f"Generating compound indexes for database: {db_name}")
|
|
61
|
-
db.generate_compound_indexes(db_name=db_name)
|
|
62
47
|
|
|
63
48
|
|
|
64
49
|
if __name__ == "__main__":
|
|
@@ -51,33 +51,19 @@ Retrieve telescope positions from database (utm coordinate system) and write to
|
|
|
51
51
|
--output_file telescope_positions-test_layout.ecsv
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
|
-
import logging
|
|
55
|
-
from pathlib import Path
|
|
56
|
-
|
|
57
54
|
import simtools.data_model.model_data_writer as writer
|
|
58
|
-
|
|
55
|
+
from simtools.application_control import get_application_label, startup_application
|
|
59
56
|
from simtools.configuration import configurator
|
|
60
57
|
from simtools.model.array_model import ArrayModel
|
|
61
58
|
from simtools.model.site_model import SiteModel
|
|
62
59
|
|
|
63
60
|
|
|
64
|
-
def _parse(
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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)
|
|
61
|
+
def _parse():
|
|
62
|
+
"""Parse command line configuration."""
|
|
63
|
+
config = configurator.Configurator(
|
|
64
|
+
label=get_application_label(__file__),
|
|
65
|
+
description="Get list of array elements as defined in the db (array layout).",
|
|
66
|
+
)
|
|
81
67
|
|
|
82
68
|
input_group = config.parser.add_mutually_exclusive_group()
|
|
83
69
|
input_group.add_argument(
|
|
@@ -128,33 +114,27 @@ def _layout_from_db(args_dict, db_config):
|
|
|
128
114
|
|
|
129
115
|
|
|
130
116
|
def main():
|
|
131
|
-
"""Get list of array elements as defined in the db
|
|
132
|
-
|
|
133
|
-
args_dict, db_config = _parse(
|
|
134
|
-
label,
|
|
135
|
-
"Get list of array elements as defined in the db (array layout).",
|
|
136
|
-
)
|
|
137
|
-
logger = logging.getLogger()
|
|
138
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
117
|
+
"""Get list of array layouts or list of elements for a given layout as defined in the db."""
|
|
118
|
+
app_context = startup_application(_parse)
|
|
139
119
|
|
|
140
|
-
if
|
|
141
|
-
if
|
|
120
|
+
if app_context.args.get("list_available_layouts", False):
|
|
121
|
+
if app_context.args.get("site", None) is None:
|
|
142
122
|
raise ValueError("Site must be provided to list available layouts.")
|
|
143
123
|
site_model = SiteModel(
|
|
144
|
-
mongo_db_config=db_config,
|
|
145
|
-
model_version=
|
|
146
|
-
site=
|
|
124
|
+
mongo_db_config=app_context.db_config,
|
|
125
|
+
model_version=app_context.args["model_version"],
|
|
126
|
+
site=app_context.args["site"],
|
|
147
127
|
)
|
|
148
128
|
print(site_model.get_list_of_array_layouts())
|
|
149
129
|
else:
|
|
150
|
-
logger.info("Array layout: %s",
|
|
151
|
-
layout = _layout_from_db(
|
|
130
|
+
app_context.logger.info("Array layout: %s", app_context.args["array_layout_name"])
|
|
131
|
+
layout = _layout_from_db(app_context.args, app_context.db_config)
|
|
152
132
|
layout.pprint()
|
|
153
133
|
|
|
154
|
-
if not
|
|
134
|
+
if not app_context.args.get("output_file_from_default", False):
|
|
155
135
|
writer.ModelDataWriter.dump(
|
|
156
|
-
args_dict=
|
|
157
|
-
output_file=
|
|
136
|
+
args_dict=app_context.args,
|
|
137
|
+
output_file=app_context.args["output_file"],
|
|
158
138
|
metadata=None,
|
|
159
139
|
product_data=layout,
|
|
160
140
|
)
|
|
@@ -33,16 +33,15 @@
|
|
|
33
33
|
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
import simtools.utils.general as gen
|
|
36
|
+
from simtools.application_control import get_application_label, startup_application
|
|
39
37
|
from simtools.configuration import configurator
|
|
40
38
|
from simtools.db import db_handler
|
|
41
|
-
from simtools.io import io_handler
|
|
42
39
|
|
|
43
40
|
|
|
44
41
|
def _parse():
|
|
42
|
+
"""Parse command line configuration."""
|
|
45
43
|
config = configurator.Configurator(
|
|
44
|
+
label=get_application_label(__file__),
|
|
46
45
|
description="Get file(s) from the DB.",
|
|
47
46
|
usage="simtools-get-file-from-db --file_name mirror_CTA-S-LST_v2020-04-07.dat",
|
|
48
47
|
)
|
|
@@ -57,24 +56,23 @@ def _parse():
|
|
|
57
56
|
return config.initialize(db_config=True, output=True)
|
|
58
57
|
|
|
59
58
|
|
|
60
|
-
def main():
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
logger = logging.getLogger()
|
|
64
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
65
|
-
_io_handler = io_handler.IOHandler()
|
|
59
|
+
def main():
|
|
60
|
+
"""Get file from database."""
|
|
61
|
+
app_context = startup_application(_parse)
|
|
66
62
|
|
|
67
|
-
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
63
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
68
64
|
file_id = db.export_model_files(
|
|
69
|
-
dest=
|
|
70
|
-
file_names=
|
|
65
|
+
dest=app_context.io_handler.get_output_directory(),
|
|
66
|
+
file_names=app_context.args["file_name"],
|
|
71
67
|
)
|
|
72
68
|
if file_id is None:
|
|
73
|
-
logger.error(
|
|
69
|
+
app_context.logger.error(
|
|
70
|
+
f"The file {app_context.args['file_name']} was not found in {db.db_name}."
|
|
71
|
+
)
|
|
74
72
|
raise FileNotFoundError
|
|
75
|
-
logger.info(
|
|
76
|
-
f"Got file {
|
|
77
|
-
f"and saved into {
|
|
73
|
+
app_context.logger.info(
|
|
74
|
+
f"Got file {app_context.args['file_name']} from DB {db.db_name} "
|
|
75
|
+
f"and saved into {app_context.io_handler.get_output_directory()}"
|
|
78
76
|
)
|
|
79
77
|
|
|
80
78
|
|
|
@@ -60,23 +60,23 @@ r"""
|
|
|
60
60
|
|
|
61
61
|
"""
|
|
62
62
|
|
|
63
|
-
import logging
|
|
64
|
-
from pathlib import Path
|
|
65
63
|
from pprint import pprint
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
from simtools.application_control import get_application_label, startup_application
|
|
68
66
|
from simtools.configuration import configurator
|
|
69
67
|
from simtools.db import db_handler
|
|
70
|
-
from simtools.io import ascii_handler
|
|
68
|
+
from simtools.io import ascii_handler
|
|
71
69
|
|
|
72
70
|
|
|
73
71
|
def _parse():
|
|
72
|
+
"""Parse command line configuration."""
|
|
74
73
|
config = configurator.Configurator(
|
|
74
|
+
label=get_application_label(__file__),
|
|
75
75
|
description=(
|
|
76
76
|
"Get a parameter entry from DB for a specific telescope or a site. "
|
|
77
77
|
"The application receives a parameter name, a site, a telescope (if applicable), "
|
|
78
78
|
"and a version. It then prints out the parameter entry. "
|
|
79
|
-
)
|
|
79
|
+
),
|
|
80
80
|
)
|
|
81
81
|
|
|
82
82
|
config.parser.add_argument("--parameter", help="Parameter name", type=str, required=True)
|
|
@@ -104,48 +104,46 @@ def _parse():
|
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
def main():
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
logger = logging.getLogger()
|
|
111
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
107
|
+
def main():
|
|
108
|
+
"""Get a parameter entry from DB for a specific telescope or a site."""
|
|
109
|
+
app_context = startup_application(_parse)
|
|
112
110
|
|
|
113
|
-
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
111
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
114
112
|
|
|
115
113
|
pars = db.get_model_parameter(
|
|
116
|
-
parameter=
|
|
117
|
-
site=
|
|
118
|
-
array_element_name=
|
|
119
|
-
parameter_version=
|
|
120
|
-
model_version=
|
|
114
|
+
parameter=app_context.args["parameter"],
|
|
115
|
+
site=app_context.args["site"],
|
|
116
|
+
array_element_name=app_context.args.get("telescope"),
|
|
117
|
+
parameter_version=app_context.args.get("parameter_version"),
|
|
118
|
+
model_version=app_context.args.get("model_version"),
|
|
121
119
|
)
|
|
122
|
-
if
|
|
120
|
+
if app_context.args["export_model_file"] or app_context.args["export_model_file_as_table"]:
|
|
123
121
|
table = db.export_model_file(
|
|
124
|
-
parameter=
|
|
125
|
-
site=
|
|
126
|
-
array_element_name=
|
|
127
|
-
parameter_version=
|
|
128
|
-
model_version=
|
|
129
|
-
export_file_as_table=
|
|
122
|
+
parameter=app_context.args["parameter"],
|
|
123
|
+
site=app_context.args["site"],
|
|
124
|
+
array_element_name=app_context.args["telescope"],
|
|
125
|
+
parameter_version=app_context.args.get("parameter_version"),
|
|
126
|
+
model_version=app_context.args.get("model_version"),
|
|
127
|
+
export_file_as_table=app_context.args["export_model_file_as_table"],
|
|
130
128
|
)
|
|
131
|
-
param_value = pars[
|
|
132
|
-
table_file =
|
|
133
|
-
logger.info(f"Exported model file {param_value} to {table_file}")
|
|
129
|
+
param_value = pars[app_context.args["parameter"]]["value"]
|
|
130
|
+
table_file = app_context.io_handler.get_output_file(param_value)
|
|
131
|
+
app_context.logger.info(f"Exported model file {param_value} to {table_file}")
|
|
134
132
|
if table and table_file.suffix != ".ecsv":
|
|
135
133
|
table.write(table_file.with_suffix(".ecsv"), format="ascii.ecsv", overwrite=True)
|
|
136
|
-
logger.info(
|
|
134
|
+
app_context.logger.info(
|
|
135
|
+
f"Exported model file {param_value} to {table_file.with_suffix('.ecsv')}"
|
|
136
|
+
)
|
|
137
137
|
|
|
138
|
-
if
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)
|
|
142
|
-
pars[args_dict["parameter"]].pop("_id")
|
|
143
|
-
pars[args_dict["parameter"]].pop("entry_date")
|
|
138
|
+
if app_context.args["output_file"] is not None:
|
|
139
|
+
pars[app_context.args["parameter"]].pop("_id")
|
|
140
|
+
pars[app_context.args["parameter"]].pop("entry_date")
|
|
144
141
|
ascii_handler.write_data_to_file(
|
|
145
|
-
data=pars[
|
|
142
|
+
data=pars[app_context.args["parameter"]],
|
|
143
|
+
output_file=app_context.io_handler.get_output_file(app_context.args["output_file"]),
|
|
146
144
|
)
|
|
147
145
|
else:
|
|
148
|
-
pprint(pars[
|
|
146
|
+
pprint(pars[app_context.args["parameter"]])
|
|
149
147
|
|
|
150
148
|
|
|
151
149
|
if __name__ == "__main__":
|
|
@@ -9,15 +9,16 @@ db_name (str, optional)
|
|
|
9
9
|
Database name (use "all" for all databases)
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import simtools.utils.general as gen
|
|
12
|
+
from simtools.application_control import get_application_label, startup_application
|
|
15
13
|
from simtools.configuration import configurator
|
|
16
14
|
from simtools.db import db_handler
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
def _parse():
|
|
20
|
-
|
|
18
|
+
"""Parse command line configuration."""
|
|
19
|
+
config = configurator.Configurator(
|
|
20
|
+
label=get_application_label(__file__), description="Inspect databases"
|
|
21
|
+
)
|
|
21
22
|
config.parser.add_argument(
|
|
22
23
|
"--db_name",
|
|
23
24
|
help="Database name",
|
|
@@ -27,18 +28,16 @@ def _parse():
|
|
|
27
28
|
return config.initialize(db_config=True)
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
def main():
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
logger = logging.getLogger()
|
|
34
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
31
|
+
def main():
|
|
32
|
+
"""Inspect databases."""
|
|
33
|
+
app_context = startup_application(_parse, setup_io_handler=False)
|
|
35
34
|
|
|
36
|
-
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
35
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
37
36
|
# databases without internal databases we don't have rights to modify
|
|
38
37
|
databases = [
|
|
39
38
|
d for d in db.db_client.list_database_names() if d not in ("config", "admin", "local")
|
|
40
39
|
]
|
|
41
|
-
requested =
|
|
40
|
+
requested = app_context.args["db_name"]
|
|
42
41
|
if requested != "all" and requested not in databases:
|
|
43
42
|
raise ValueError(
|
|
44
43
|
f"Requested database '{requested}' not found. "
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
r"""
|
|
3
|
+
Upload model parameters from simulation model repository to a local or remote database.
|
|
4
|
+
|
|
5
|
+
This script clones the CTAO simulation model repository and uploads model parameters
|
|
6
|
+
and production tables to a MongoDB database. It includes retry functionality for
|
|
7
|
+
network operations and confirmation prompts for remote database uploads.
|
|
8
|
+
|
|
9
|
+
Command line arguments
|
|
10
|
+
----------------------
|
|
11
|
+
db_simulation_model (str, required)
|
|
12
|
+
Name of the database simulation model.
|
|
13
|
+
db_simulation_model_version (str, required)
|
|
14
|
+
Version of the database simulation model.
|
|
15
|
+
branch (str, optional)
|
|
16
|
+
Repository branch to clone (if not provided, uses the version tag).
|
|
17
|
+
tmp_dir (str, optional)
|
|
18
|
+
Temporary directory for cloning the repository (default: ./tmp_model_parameters).
|
|
19
|
+
|
|
20
|
+
Examples
|
|
21
|
+
--------
|
|
22
|
+
Upload model repository to database using a version tag
|
|
23
|
+
(see simulation model repository for available tags):
|
|
24
|
+
|
|
25
|
+
.. code-block:: console
|
|
26
|
+
|
|
27
|
+
simtools-db-upload-model-repository \\
|
|
28
|
+
--db_simulation_model CTAO-Simulation-Model \\
|
|
29
|
+
--db_simulation_model_version v10.10.10
|
|
30
|
+
|
|
31
|
+
Upload model repository using specific branch (the version tag is
|
|
32
|
+
used to name the database, but no tag checkout is done):
|
|
33
|
+
|
|
34
|
+
.. code-block:: console
|
|
35
|
+
|
|
36
|
+
simtools-db-upload-model-repository \\
|
|
37
|
+
--db_simulation_model CTAO-Simulation-Model \\
|
|
38
|
+
--db_simulation_model_version v10.10.10 \\
|
|
39
|
+
--branch main
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
from simtools.application_control import get_application_label, startup_application
|
|
44
|
+
from simtools.configuration import configurator
|
|
45
|
+
from simtools.db import db_handler, db_model_upload
|
|
46
|
+
|
|
47
|
+
DEFAULT_REPOSITORY_URL = (
|
|
48
|
+
"https://gitlab.cta-observatory.org/cta-science/simulations/"
|
|
49
|
+
"simulation-model/simulation-models.git"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _parse():
|
|
54
|
+
"""Parse command line configuration."""
|
|
55
|
+
config = configurator.Configurator(
|
|
56
|
+
label=get_application_label(__file__),
|
|
57
|
+
description="Upload model parameters from repository to database",
|
|
58
|
+
)
|
|
59
|
+
config.parser.add_argument(
|
|
60
|
+
"--branch",
|
|
61
|
+
help="Repository branch to clone (optional, defaults to using version tag).",
|
|
62
|
+
type=str,
|
|
63
|
+
required=False,
|
|
64
|
+
)
|
|
65
|
+
config.parser.add_argument(
|
|
66
|
+
"--tmp_dir",
|
|
67
|
+
help="Temporary directory for cloning the repository (default: ./tmp_model_parameters).",
|
|
68
|
+
type=str,
|
|
69
|
+
default="tmp_model_parameters",
|
|
70
|
+
required=False,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
args_dict, db_config = config.initialize(output=True, require_command_line=True, db_config=True)
|
|
74
|
+
|
|
75
|
+
if args_dict.get("db_simulation_model_version"):
|
|
76
|
+
db_config["db_simulation_model"] = args_dict.get(
|
|
77
|
+
"db_simulation_model", "CTAO-Simulation-Model"
|
|
78
|
+
)
|
|
79
|
+
db_config["db_simulation_model_version"] = args_dict["db_simulation_model_version"]
|
|
80
|
+
else:
|
|
81
|
+
raise ValueError("Setting of db_simulation_model_version is required.")
|
|
82
|
+
|
|
83
|
+
return args_dict, db_config
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def main():
|
|
87
|
+
"""Application main."""
|
|
88
|
+
app_context = startup_application(_parse)
|
|
89
|
+
|
|
90
|
+
db = db_handler.DatabaseHandler(mongo_db_config=app_context.db_config)
|
|
91
|
+
db.print_connection_info()
|
|
92
|
+
|
|
93
|
+
db_model_upload.add_complete_model(
|
|
94
|
+
tmp_dir=app_context.args.get("tmp_dir"),
|
|
95
|
+
db=db,
|
|
96
|
+
db_simulation_model=app_context.args.get("db_simulation_model"),
|
|
97
|
+
db_simulation_model_version=app_context.args.get("db_simulation_model_version"),
|
|
98
|
+
repository_url=DEFAULT_REPOSITORY_URL,
|
|
99
|
+
repository_branch=app_context.args.get("branch"),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
main()
|