gammasimtools 0.18.0__py3-none-any.whl → 0.20.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.18.0.dist-info → gammasimtools-0.20.0.dist-info}/METADATA +24 -69
- gammasimtools-0.20.0.dist-info/RECORD +395 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/entry_points.txt +11 -4
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +16 -3
- simtools/applications/calculate_incident_angles.py +182 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +17 -14
- simtools/applications/db_add_value_from_json_to_db.py +8 -10
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
- simtools/applications/db_generate_compound_indexes.py +65 -0
- simtools/applications/db_get_file_from_db.py +12 -24
- simtools/applications/db_get_parameter_from_db.py +4 -4
- simtools/applications/db_inspect_databases.py +20 -10
- simtools/applications/derive_mirror_rnda.py +17 -11
- simtools/applications/derive_psf_parameters.py +59 -309
- simtools/applications/derive_trigger_rates.py +91 -0
- simtools/applications/docs_produce_array_element_report.py +1 -1
- simtools/applications/docs_produce_calibration_reports.py +1 -1
- simtools/applications/docs_produce_model_parameter_reports.py +1 -1
- simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
- simtools/applications/generate_corsika_histograms.py +1 -1
- simtools/applications/generate_default_metadata.py +8 -24
- simtools/applications/generate_simtel_event_data.py +11 -11
- simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
- simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
- simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
- simtools/applications/merge_tables.py +2 -2
- simtools/applications/plot_array_layout.py +3 -3
- simtools/applications/plot_simtel_events.py +421 -0
- simtools/applications/plot_tabular_data.py +9 -2
- simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
- simtools/applications/print_version.py +8 -9
- simtools/applications/production_derive_corsika_limits.py +6 -7
- simtools/applications/production_derive_statistics.py +1 -1
- simtools/applications/production_generate_grid.py +2 -2
- simtools/applications/production_merge_corsika_limits.py +214 -0
- simtools/applications/run_application.py +47 -113
- simtools/applications/simulate_calibration_events.py +166 -0
- simtools/applications/simulate_flasher.py +141 -0
- simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
- simtools/applications/simulate_prod.py +6 -24
- simtools/applications/simulate_prod_htcondor_generator.py +7 -0
- simtools/applications/submit_array_layouts.py +2 -1
- simtools/applications/submit_model_parameter_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +30 -12
- simtools/applications/validate_camera_fov.py +1 -1
- simtools/applications/validate_cumulative_psf.py +1 -1
- simtools/applications/validate_file_using_schema.py +9 -5
- simtools/applications/validate_optics.py +1 -1
- simtools/camera/camera_efficiency.py +61 -45
- simtools/camera/single_photon_electron_spectrum.py +1 -1
- simtools/configuration/commandline_parser.py +46 -11
- simtools/configuration/configurator.py +4 -4
- simtools/corsika/corsika_config.py +45 -25
- simtools/corsika/corsika_histograms.py +6 -5
- simtools/data_model/data_reader.py +2 -3
- simtools/data_model/metadata_collector.py +32 -36
- simtools/data_model/metadata_model.py +15 -12
- simtools/data_model/model_data_writer.py +13 -32
- simtools/data_model/schema.py +74 -24
- simtools/data_model/validate_data.py +42 -12
- simtools/db/db_handler.py +125 -62
- simtools/db/db_model_upload.py +14 -19
- simtools/dependencies.py +98 -30
- simtools/io/ascii_handler.py +279 -0
- simtools/{io_operations → io}/io_handler.py +25 -3
- simtools/job_execution/htcondor_script_generator.py +15 -4
- simtools/layout/array_layout.py +1 -1
- simtools/layout/array_layout_utils.py +51 -12
- simtools/model/array_model.py +41 -5
- simtools/model/flasher_model.py +106 -0
- simtools/model/model_parameter.py +4 -4
- simtools/model/model_repository.py +197 -2
- simtools/model/site_model.py +25 -0
- simtools/model/telescope_model.py +3 -1
- simtools/production_configuration/derive_corsika_limits.py +336 -427
- simtools/production_configuration/derive_production_statistics_handler.py +7 -6
- simtools/production_configuration/generate_production_grid.py +9 -11
- simtools/production_configuration/merge_corsika_limits.py +528 -0
- simtools/ray_tracing/incident_angles.py +706 -0
- simtools/ray_tracing/mirror_panel_psf.py +1 -0
- simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
- simtools/ray_tracing/ray_tracing.py +6 -2
- simtools/reporting/docs_read_parameters.py +150 -62
- simtools/runners/corsika_runner.py +1 -1
- simtools/runners/corsika_simtel_runner.py +14 -5
- simtools/runners/runner_services.py +10 -5
- simtools/runners/simtools_runner.py +267 -0
- simtools/schemas/application_workflow.metaschema.yml +101 -68
- simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
- simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
- simtools/schemas/metadata.metaschema.yml +577 -3
- simtools/schemas/model_parameter.metaschema.yml +6 -6
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +4 -4
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/array_window.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +2 -2
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +23 -30
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/stars.schema.yml +2 -2
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/schemas/plot_configuration.metaschema.yml +5 -2
- simtools/schemas/production_configuration_metrics.schema.yml +12 -2
- simtools/schemas/production_tables.schema.yml +7 -2
- simtools/simtel/simtel_config_reader.py +2 -2
- simtools/simtel/simtel_config_writer.py +33 -23
- simtools/simtel/simtel_io_event_histograms.py +483 -0
- simtools/simtel/simtel_io_event_reader.py +65 -43
- simtools/simtel/simtel_io_event_writer.py +40 -20
- simtools/simtel/simtel_io_metadata.py +1 -1
- simtools/simtel/simtel_table_reader.py +95 -13
- simtools/simtel/simulator_array.py +138 -10
- simtools/simtel/simulator_camera_efficiency.py +32 -23
- simtools/simtel/simulator_light_emission.py +437 -271
- simtools/simtel/simulator_ray_tracing.py +1 -1
- simtools/simulator.py +105 -147
- simtools/telescope_trigger_rates.py +119 -0
- simtools/testing/configuration.py +24 -26
- simtools/testing/helpers.py +2 -2
- simtools/testing/log_inspector.py +52 -0
- simtools/testing/validate_output.py +87 -37
- simtools/utils/general.py +125 -255
- simtools/utils/geometry.py +56 -0
- simtools/utils/names.py +1 -1
- simtools/visualization/legend_handlers.py +180 -264
- simtools/visualization/plot_array_layout.py +20 -8
- simtools/visualization/plot_incident_angles.py +431 -0
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_simtel_event_histograms.py +376 -0
- simtools/visualization/plot_simtel_events.py +816 -0
- simtools/visualization/plot_tables.py +133 -37
- simtools/visualization/visualize.py +1 -100
- gammasimtools-0.18.0.dist-info/RECORD +0 -376
- simtools/applications/calculate_trigger_rate.py +0 -187
- simtools/applications/generate_sim_telarray_histograms.py +0 -196
- simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
- simtools/simtel/simtel_io_histogram.py +0 -621
- simtools/simtel/simtel_io_histograms.py +0 -552
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/top_level.txt +0 -0
- /simtools/{io_operations → io}/hdf5_handler.py +0 -0
- /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
- /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
simtools/db/db_handler.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Module to handle interaction with DB."""
|
|
2
2
|
|
|
3
|
+
import io
|
|
3
4
|
import logging
|
|
4
5
|
import re
|
|
5
6
|
from collections import defaultdict
|
|
@@ -8,14 +9,15 @@ from threading import Lock
|
|
|
8
9
|
|
|
9
10
|
import gridfs
|
|
10
11
|
import jsonschema
|
|
12
|
+
from astropy.table import Table
|
|
11
13
|
from bson.objectid import ObjectId
|
|
12
14
|
from packaging.version import Version
|
|
13
15
|
from pymongo import MongoClient
|
|
14
16
|
|
|
15
17
|
from simtools.data_model import validate_data
|
|
16
|
-
from simtools.
|
|
18
|
+
from simtools.io import ascii_handler, io_handler
|
|
17
19
|
from simtools.simtel import simtel_table_reader
|
|
18
|
-
from simtools.utils import
|
|
20
|
+
from simtools.utils import names, value_conversion
|
|
19
21
|
|
|
20
22
|
__all__ = ["DatabaseHandler"]
|
|
21
23
|
|
|
@@ -50,8 +52,19 @@ jsonschema_db_dict = {
|
|
|
50
52
|
"type": "string",
|
|
51
53
|
"description": "Name of simulation model database",
|
|
52
54
|
},
|
|
55
|
+
"db_simulation_model_version": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Version of simulation model database",
|
|
58
|
+
},
|
|
53
59
|
},
|
|
54
|
-
"required": [
|
|
60
|
+
"required": [
|
|
61
|
+
"db_server",
|
|
62
|
+
"db_api_port",
|
|
63
|
+
"db_api_user",
|
|
64
|
+
"db_api_pw",
|
|
65
|
+
"db_simulation_model",
|
|
66
|
+
"db_simulation_model_version",
|
|
67
|
+
],
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
|
|
@@ -81,6 +94,14 @@ class DatabaseHandler:
|
|
|
81
94
|
|
|
82
95
|
self._set_up_connection()
|
|
83
96
|
self._find_latest_simulation_model_db()
|
|
97
|
+
self.db_name = (
|
|
98
|
+
self.get_db_name(
|
|
99
|
+
model_version=self.mongo_db_config.get("db_simulation_model_version"),
|
|
100
|
+
model_name=self.mongo_db_config.get("db_simulation_model"),
|
|
101
|
+
)
|
|
102
|
+
if self.mongo_db_config
|
|
103
|
+
else None
|
|
104
|
+
)
|
|
84
105
|
|
|
85
106
|
def _set_up_connection(self):
|
|
86
107
|
"""Open the connection to MongoDB."""
|
|
@@ -89,6 +110,16 @@ class DatabaseHandler:
|
|
|
89
110
|
with lock:
|
|
90
111
|
DatabaseHandler.db_client = self._open_mongo_db()
|
|
91
112
|
|
|
113
|
+
def get_db_name(self, db_name=None, model_version=None, model_name=None):
|
|
114
|
+
"""Build DB name from configuration."""
|
|
115
|
+
if db_name:
|
|
116
|
+
return db_name
|
|
117
|
+
if model_version and model_name:
|
|
118
|
+
return f"{model_name}-{model_version.replace('.', '-')}"
|
|
119
|
+
if model_version or model_name:
|
|
120
|
+
return None
|
|
121
|
+
return None if (model_version or model_name) else self.db_name
|
|
122
|
+
|
|
92
123
|
def _validate_mongo_db_config(self, mongo_db_config):
|
|
93
124
|
"""Validate the MongoDB configuration."""
|
|
94
125
|
if mongo_db_config is None or all(value is None for value in mongo_db_config.values()):
|
|
@@ -137,8 +168,7 @@ class DatabaseHandler:
|
|
|
137
168
|
"""
|
|
138
169
|
Find the latest released version of the simulation model and update the DB config.
|
|
139
170
|
|
|
140
|
-
This is indicated by
|
|
141
|
-
(field "db_simulation_model" in the database configuration dictionary).
|
|
171
|
+
This is indicated by "LATEST" to the simulation model data base version.
|
|
142
172
|
Only released versions are considered, pre-releases are ignored.
|
|
143
173
|
|
|
144
174
|
Raises
|
|
@@ -148,27 +178,27 @@ class DatabaseHandler:
|
|
|
148
178
|
|
|
149
179
|
"""
|
|
150
180
|
try:
|
|
181
|
+
db_simulation_model_version = self.mongo_db_config["db_simulation_model_version"]
|
|
151
182
|
db_simulation_model = self.mongo_db_config["db_simulation_model"]
|
|
152
|
-
if
|
|
183
|
+
if db_simulation_model_version != "LATEST":
|
|
153
184
|
return
|
|
154
|
-
except TypeError: #
|
|
185
|
+
except TypeError: # db_simulation_model_version is None
|
|
155
186
|
return
|
|
156
187
|
|
|
157
|
-
prefix = db_simulation_model.replace("LATEST", "")
|
|
158
188
|
list_of_db_names = self.db_client.list_database_names()
|
|
159
|
-
filtered_list_of_db_names = [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
)
|
|
189
|
+
filtered_list_of_db_names = [
|
|
190
|
+
s for s in list_of_db_names if s.startswith(db_simulation_model)
|
|
191
|
+
]
|
|
192
|
+
pattern = re.compile(rf"{re.escape(db_simulation_model)}-v(\d+)-(\d+)-(\d+)(?:-(.+))?$")
|
|
164
193
|
|
|
194
|
+
versioned_strings = []
|
|
165
195
|
for s in filtered_list_of_db_names:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
196
|
+
m = pattern.match(s)
|
|
197
|
+
if m:
|
|
198
|
+
# skip pre-releases (have suffix)
|
|
199
|
+
if m.group(4) is None:
|
|
200
|
+
version_str = f"{m.group(1)}.{m.group(2)}.{m.group(3)}"
|
|
201
|
+
versioned_strings.append((s, Version(version_str)))
|
|
172
202
|
|
|
173
203
|
if versioned_strings:
|
|
174
204
|
latest_string, _ = max(versioned_strings, key=lambda x: x[1])
|
|
@@ -177,7 +207,29 @@ class DatabaseHandler:
|
|
|
177
207
|
f"Updated the DB simulation model to the latest version {latest_string}"
|
|
178
208
|
)
|
|
179
209
|
else:
|
|
180
|
-
raise ValueError("
|
|
210
|
+
raise ValueError("LATEST requested but no released versions found in DB.")
|
|
211
|
+
|
|
212
|
+
def generate_compound_indexes(self, db_name=None):
|
|
213
|
+
"""
|
|
214
|
+
Generate compound indexes for the MongoDB collections.
|
|
215
|
+
|
|
216
|
+
Indexes based on the typical query patterns.
|
|
217
|
+
"""
|
|
218
|
+
db_name = db_name or self.db_name
|
|
219
|
+
collection_names = [
|
|
220
|
+
"telescopes",
|
|
221
|
+
"sites",
|
|
222
|
+
"configuration_sim_telarray",
|
|
223
|
+
"configuration_corsika",
|
|
224
|
+
"calibration_devices",
|
|
225
|
+
]
|
|
226
|
+
for collection_name in collection_names:
|
|
227
|
+
db_collection = self.get_collection(collection_name, db_name=db_name)
|
|
228
|
+
db_collection.create_index(
|
|
229
|
+
[("instrument", 1), ("site", 1), ("parameter", 1), ("parameter_version", 1)]
|
|
230
|
+
)
|
|
231
|
+
db_collection = self.get_collection("production_tables", db_name=db_name)
|
|
232
|
+
db_collection.create_index([("collection", 1), ("model_version", 1)])
|
|
181
233
|
|
|
182
234
|
def get_model_parameter(
|
|
183
235
|
self,
|
|
@@ -333,24 +385,23 @@ class DatabaseHandler:
|
|
|
333
385
|
)
|
|
334
386
|
return DatabaseHandler.model_parameters_cached[cache_key]
|
|
335
387
|
|
|
336
|
-
def get_collection(self,
|
|
388
|
+
def get_collection(self, collection_name, db_name=None):
|
|
337
389
|
"""
|
|
338
390
|
Get a collection from the DB.
|
|
339
391
|
|
|
340
392
|
Parameters
|
|
341
393
|
----------
|
|
342
|
-
db_name: str
|
|
343
|
-
Name of the DB.
|
|
344
394
|
collection_name: str
|
|
345
395
|
Name of the collection.
|
|
396
|
+
db_name: str
|
|
397
|
+
Name of the DB.
|
|
346
398
|
|
|
347
399
|
Returns
|
|
348
400
|
-------
|
|
349
401
|
pymongo.collection.Collection
|
|
350
402
|
The collection from the DB.
|
|
351
|
-
|
|
352
403
|
"""
|
|
353
|
-
db_name = self.
|
|
404
|
+
db_name = db_name or self.db_name
|
|
354
405
|
return DatabaseHandler.db_client[db_name][collection_name]
|
|
355
406
|
|
|
356
407
|
def get_collections(self, db_name=None, model_collections_only=False):
|
|
@@ -370,7 +421,7 @@ class DatabaseHandler:
|
|
|
370
421
|
List of collection names
|
|
371
422
|
|
|
372
423
|
"""
|
|
373
|
-
db_name = db_name or self.
|
|
424
|
+
db_name = db_name or self.db_name
|
|
374
425
|
if db_name not in self.list_of_collections:
|
|
375
426
|
self.list_of_collections[db_name] = DatabaseHandler.db_client[
|
|
376
427
|
db_name
|
|
@@ -451,7 +502,7 @@ class DatabaseHandler:
|
|
|
451
502
|
file_id: dict of GridOut._id
|
|
452
503
|
Dict of database IDs of files.
|
|
453
504
|
"""
|
|
454
|
-
db_name = self.
|
|
505
|
+
db_name = db_name or self.db_name
|
|
455
506
|
|
|
456
507
|
if file_names:
|
|
457
508
|
file_names = [file_names] if not isinstance(file_names, list) else file_names
|
|
@@ -467,8 +518,8 @@ class DatabaseHandler:
|
|
|
467
518
|
if Path(dest).joinpath(file_name).exists():
|
|
468
519
|
instance_ids[file_name] = "file exists"
|
|
469
520
|
else:
|
|
470
|
-
file_path_instance = self._get_file_mongo_db(
|
|
471
|
-
self._write_file_from_mongo_to_disk(
|
|
521
|
+
file_path_instance = self._get_file_mongo_db(db_name, file_name)
|
|
522
|
+
self._write_file_from_mongo_to_disk(db_name, dest, file_path_instance)
|
|
472
523
|
instance_ids[file_name] = file_path_instance._id # pylint: disable=protected-access
|
|
473
524
|
return instance_ids
|
|
474
525
|
|
|
@@ -509,8 +560,7 @@ class DatabaseHandler:
|
|
|
509
560
|
ValueError
|
|
510
561
|
if query returned no results.
|
|
511
562
|
"""
|
|
512
|
-
|
|
513
|
-
collection = self.get_collection(db_name, collection_name)
|
|
563
|
+
collection = self.get_collection(collection_name, db_name=self.db_name)
|
|
514
564
|
posts = list(collection.find(query))
|
|
515
565
|
if not posts:
|
|
516
566
|
raise ValueError(
|
|
@@ -547,7 +597,7 @@ class DatabaseHandler:
|
|
|
547
597
|
pass
|
|
548
598
|
|
|
549
599
|
query = {"model_version": model_version, "collection": collection_name}
|
|
550
|
-
collection = self.get_collection(
|
|
600
|
+
collection = self.get_collection("production_tables", db_name=self.db_name)
|
|
551
601
|
post = collection.find_one(query)
|
|
552
602
|
if not post:
|
|
553
603
|
raise ValueError(f"The following query returned zero results: {query}")
|
|
@@ -574,7 +624,7 @@ class DatabaseHandler:
|
|
|
574
624
|
list
|
|
575
625
|
List of model versions
|
|
576
626
|
"""
|
|
577
|
-
collection = self.get_collection(
|
|
627
|
+
collection = self.get_collection("production_tables", db_name=self.db_name)
|
|
578
628
|
return sorted(
|
|
579
629
|
{post["model_version"] for post in collection.find({"collection": collection_name})}
|
|
580
630
|
)
|
|
@@ -751,27 +801,56 @@ class DatabaseHandler:
|
|
|
751
801
|
with open(Path(path).joinpath(file.filename), "wb") as output_file:
|
|
752
802
|
fs_output.download_to_stream_by_name(file.filename, output_file)
|
|
753
803
|
|
|
754
|
-
def
|
|
804
|
+
def get_ecsv_file_as_astropy_table(self, file_name, db_name=None):
|
|
755
805
|
"""
|
|
756
|
-
|
|
806
|
+
Read contents of an ECSV file from the database and return it as an Astropy Table.
|
|
807
|
+
|
|
808
|
+
Files are not written to disk.
|
|
757
809
|
|
|
758
810
|
Parameters
|
|
759
811
|
----------
|
|
812
|
+
file_name: str
|
|
813
|
+
The name of the ECSV file.
|
|
760
814
|
db_name: str
|
|
761
|
-
|
|
815
|
+
The name of the database.
|
|
816
|
+
|
|
817
|
+
Returns
|
|
818
|
+
-------
|
|
819
|
+
astropy.table.Table
|
|
820
|
+
The contents of the ECSV file as an Astropy Table.
|
|
821
|
+
"""
|
|
822
|
+
db = DatabaseHandler.db_client[db_name or self.db_name]
|
|
823
|
+
fs = gridfs.GridFSBucket(db)
|
|
824
|
+
|
|
825
|
+
buf = io.BytesIO()
|
|
826
|
+
try:
|
|
827
|
+
fs.download_to_stream_by_name(file_name, buf)
|
|
828
|
+
except gridfs.errors.NoFile as exc:
|
|
829
|
+
raise FileNotFoundError(f"ECSV file '{file_name}' not found in DB.") from exc
|
|
830
|
+
buf.seek(0)
|
|
831
|
+
return Table.read(buf.getvalue().decode("utf-8"), format="ascii.ecsv")
|
|
832
|
+
|
|
833
|
+
def add_production_table(self, production_table, db_name=None):
|
|
834
|
+
"""
|
|
835
|
+
Add a production table to the DB.
|
|
836
|
+
|
|
837
|
+
Parameters
|
|
838
|
+
----------
|
|
762
839
|
production_table: dict
|
|
763
840
|
The production table to add to the DB.
|
|
841
|
+
db_name: str
|
|
842
|
+
the name of the DB.
|
|
764
843
|
"""
|
|
765
|
-
db_name = self.
|
|
766
|
-
collection = self.get_collection(
|
|
844
|
+
db_name = db_name or self.db_name
|
|
845
|
+
collection = self.get_collection("production_tables", db_name=db_name or self.db_name)
|
|
767
846
|
self._logger.debug(f"Adding production for {production_table.get('collection')} to to DB")
|
|
768
847
|
collection.insert_one(production_table)
|
|
769
848
|
DatabaseHandler.production_table_cached.clear()
|
|
770
849
|
|
|
771
850
|
def add_new_parameter(
|
|
772
851
|
self,
|
|
773
|
-
db_name,
|
|
774
852
|
par_dict,
|
|
853
|
+
db_name=None,
|
|
775
854
|
collection_name="telescopes",
|
|
776
855
|
file_prefix=None,
|
|
777
856
|
):
|
|
@@ -783,10 +862,10 @@ class DatabaseHandler:
|
|
|
783
862
|
|
|
784
863
|
Parameters
|
|
785
864
|
----------
|
|
786
|
-
db_name: str
|
|
787
|
-
the name of the DB
|
|
788
865
|
par_dict: dict
|
|
789
866
|
dictionary with parameter data
|
|
867
|
+
db_name: str
|
|
868
|
+
the name of the DB
|
|
790
869
|
collection_name: str
|
|
791
870
|
The name of the collection to add a parameter to.
|
|
792
871
|
file_prefix: str or Path
|
|
@@ -794,8 +873,8 @@ class DatabaseHandler:
|
|
|
794
873
|
"""
|
|
795
874
|
par_dict = validate_data.DataValidator.validate_model_parameter(par_dict)
|
|
796
875
|
|
|
797
|
-
db_name = self.
|
|
798
|
-
collection = self.get_collection(
|
|
876
|
+
db_name = db_name or self.db_name
|
|
877
|
+
collection = self.get_collection(collection_name, db_name=db_name)
|
|
799
878
|
|
|
800
879
|
par_dict["value"], _base_unit, _ = value_conversion.get_value_unit_type(
|
|
801
880
|
value=par_dict["value"], unit_str=par_dict.get("unit", None)
|
|
@@ -810,7 +889,7 @@ class DatabaseHandler:
|
|
|
810
889
|
f"corresponding to the {par_dict['parameter']} parameter, must be provided."
|
|
811
890
|
)
|
|
812
891
|
file_path = Path(file_prefix).joinpath(par_dict["value"])
|
|
813
|
-
if not
|
|
892
|
+
if not ascii_handler.is_utf8_file(file_path):
|
|
814
893
|
raise ValueError(f"File is not UTF-8 encoded: {file_path}")
|
|
815
894
|
files_to_add_to_db.add(f"{file_path}")
|
|
816
895
|
|
|
@@ -825,22 +904,6 @@ class DatabaseHandler:
|
|
|
825
904
|
|
|
826
905
|
self._reset_parameter_cache()
|
|
827
906
|
|
|
828
|
-
def _get_db_name(self, db_name=None):
|
|
829
|
-
"""
|
|
830
|
-
Return database name. If not provided, return the default database name.
|
|
831
|
-
|
|
832
|
-
Parameters
|
|
833
|
-
----------
|
|
834
|
-
db_name: str
|
|
835
|
-
Database name
|
|
836
|
-
|
|
837
|
-
Returns
|
|
838
|
-
-------
|
|
839
|
-
str
|
|
840
|
-
Database name
|
|
841
|
-
"""
|
|
842
|
-
return self.mongo_db_config["db_simulation_model"] if db_name is None else db_name
|
|
843
|
-
|
|
844
907
|
def insert_file_to_db(self, file_name, db_name=None, **kwargs):
|
|
845
908
|
"""
|
|
846
909
|
Insert a file to the DB.
|
|
@@ -853,7 +916,7 @@ class DatabaseHandler:
|
|
|
853
916
|
the name of the DB
|
|
854
917
|
**kwargs (optional): keyword arguments for file creation.
|
|
855
918
|
The full list of arguments can be found in, \
|
|
856
|
-
https://
|
|
919
|
+
https://www.mongodb.com/docs/manual/core/gridfs/
|
|
857
920
|
mostly these are unnecessary though.
|
|
858
921
|
|
|
859
922
|
Returns
|
|
@@ -863,7 +926,7 @@ class DatabaseHandler:
|
|
|
863
926
|
"newly created DB GridOut._id.
|
|
864
927
|
|
|
865
928
|
"""
|
|
866
|
-
db_name = self.
|
|
929
|
+
db_name = db_name or self.db_name
|
|
867
930
|
db = DatabaseHandler.db_client[db_name]
|
|
868
931
|
file_system = gridfs.GridFS(db)
|
|
869
932
|
|
simtools/db/db_model_upload.py
CHANGED
|
@@ -3,56 +3,53 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
from simtools.io import ascii_handler
|
|
7
7
|
from simtools.utils import names
|
|
8
8
|
|
|
9
9
|
logger = logging.getLogger(__name__)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def add_values_from_json_to_db(file, collection, db,
|
|
12
|
+
def add_values_from_json_to_db(file, collection, db, file_prefix):
|
|
13
13
|
"""
|
|
14
14
|
Upload new model parameter from json files to db.
|
|
15
15
|
|
|
16
16
|
Parameters
|
|
17
17
|
----------
|
|
18
18
|
file : list
|
|
19
|
-
|
|
19
|
+
JSON file to be uploaded to the DB.
|
|
20
20
|
collection : str
|
|
21
21
|
The DB collection to which to add the file.
|
|
22
22
|
db : DatabaseHandler
|
|
23
23
|
Database handler object.
|
|
24
|
-
db_name : str
|
|
25
|
-
Name of the database to be created.
|
|
26
24
|
file_prefix : str
|
|
27
25
|
Path to location of all additional files to be uploaded.
|
|
28
26
|
"""
|
|
29
|
-
par_dict =
|
|
27
|
+
par_dict = ascii_handler.collect_data_from_file(file_name=file)
|
|
30
28
|
logger.debug(
|
|
31
29
|
f"Adding the following parameter to the DB: {par_dict['parameter']} "
|
|
32
30
|
f"version {par_dict['parameter_version']} "
|
|
33
|
-
f"(collection {collection} in database {
|
|
31
|
+
f"(collection {collection} in database {db.get_db_name()})"
|
|
34
32
|
)
|
|
35
33
|
|
|
36
34
|
db.add_new_parameter(
|
|
37
|
-
db_name=db_name,
|
|
38
35
|
par_dict=par_dict,
|
|
39
36
|
collection_name=collection,
|
|
40
37
|
file_prefix=file_prefix,
|
|
41
38
|
)
|
|
42
39
|
|
|
43
40
|
|
|
44
|
-
def add_model_parameters_to_db(
|
|
41
|
+
def add_model_parameters_to_db(input_path, db):
|
|
45
42
|
"""
|
|
46
43
|
Read model parameters from a directory and upload them to the database.
|
|
47
44
|
|
|
48
45
|
Parameters
|
|
49
46
|
----------
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
input_path : Path, str
|
|
48
|
+
Path to the directory containing the model parameters.
|
|
52
49
|
db : DatabaseHandler
|
|
53
50
|
Database handler object.
|
|
54
51
|
"""
|
|
55
|
-
input_path = Path(
|
|
52
|
+
input_path = Path(input_path)
|
|
56
53
|
logger.info(f"Reading model parameters from repository path {input_path}")
|
|
57
54
|
array_elements = [d for d in input_path.iterdir() if d.is_dir()]
|
|
58
55
|
for element in array_elements:
|
|
@@ -67,12 +64,11 @@ def add_model_parameters_to_db(args_dict, db):
|
|
|
67
64
|
file=file,
|
|
68
65
|
collection=collection,
|
|
69
66
|
db=db,
|
|
70
|
-
db_name=args_dict["db_name"],
|
|
71
67
|
file_prefix=input_path / "Files",
|
|
72
68
|
)
|
|
73
69
|
|
|
74
70
|
|
|
75
|
-
def add_production_tables_to_db(
|
|
71
|
+
def add_production_tables_to_db(input_path, db):
|
|
76
72
|
"""
|
|
77
73
|
Read production tables from a directory and upload them to the database.
|
|
78
74
|
|
|
@@ -81,12 +77,12 @@ def add_production_tables_to_db(args_dict, db):
|
|
|
81
77
|
|
|
82
78
|
Parameters
|
|
83
79
|
----------
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
input_path : Path, str
|
|
81
|
+
Path to the directory containing the production tables.
|
|
86
82
|
db : DatabaseHandler
|
|
87
83
|
Database handler object.
|
|
88
84
|
"""
|
|
89
|
-
input_path = Path(
|
|
85
|
+
input_path = Path(input_path)
|
|
90
86
|
logger.info(f"Reading production tables from repository path {input_path}")
|
|
91
87
|
|
|
92
88
|
for model in filter(Path.is_dir, input_path.iterdir()):
|
|
@@ -101,7 +97,6 @@ def add_production_tables_to_db(args_dict, db):
|
|
|
101
97
|
continue
|
|
102
98
|
logger.info(f"Adding production table for {collection} to the database")
|
|
103
99
|
db.add_production_table(
|
|
104
|
-
db_name=args_dict["db_name"],
|
|
105
100
|
production_table=data,
|
|
106
101
|
)
|
|
107
102
|
|
|
@@ -119,7 +114,7 @@ def _read_production_table(model_dict, file, model_name):
|
|
|
119
114
|
"design_model": {},
|
|
120
115
|
},
|
|
121
116
|
)
|
|
122
|
-
parameter_dict =
|
|
117
|
+
parameter_dict = ascii_handler.collect_data_from_file(file_name=file)
|
|
123
118
|
logger.debug(f"Reading production table for {array_element} (collection {collection})")
|
|
124
119
|
try:
|
|
125
120
|
if array_element in ("configuration_corsika", "configuration_sim_telarray"):
|