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/_version.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
3
|
|
|
4
|
-
__all__ = [
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
5
12
|
|
|
6
13
|
TYPE_CHECKING = False
|
|
7
14
|
if TYPE_CHECKING:
|
|
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
|
|
|
9
16
|
from typing import Union
|
|
10
17
|
|
|
11
18
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
12
20
|
else:
|
|
13
21
|
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
14
23
|
|
|
15
24
|
version: str
|
|
16
25
|
__version__: str
|
|
17
26
|
__version_tuple__: VERSION_TUPLE
|
|
18
27
|
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
19
30
|
|
|
20
|
-
__version__ = version = '0.
|
|
21
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.20.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 20, 0)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
r"""
|
|
3
|
+
Calculate photon incident angles on focal plane and primary/secondary mirrors.
|
|
4
|
+
|
|
5
|
+
Creates photon files with additional columns for incident angles calculation.
|
|
6
|
+
Outputs files and histograms of the incidence angles at
|
|
7
|
+
the focal plane, primary mirror, and if available, secondary mirror.
|
|
8
|
+
Optional debug plots can be also generated.
|
|
9
|
+
Note that this application does not include a full raytracing of telescope structures,
|
|
10
|
+
and their non symmetric shadowing at off-axis angles.
|
|
11
|
+
|
|
12
|
+
Example usage
|
|
13
|
+
-------------
|
|
14
|
+
|
|
15
|
+
.. code-block:: console
|
|
16
|
+
|
|
17
|
+
simtools-calculate-incident-angles \
|
|
18
|
+
--off_axis_angles 0 1 2 3 4 \
|
|
19
|
+
--source_distance 10 \
|
|
20
|
+
--number_of_photons 1000000 \
|
|
21
|
+
--model_version 6.0.0 \
|
|
22
|
+
--telescope MSTN-04 \
|
|
23
|
+
--site North
|
|
24
|
+
|
|
25
|
+
Command line arguments
|
|
26
|
+
----------------------
|
|
27
|
+
|
|
28
|
+
- off_axis_angles (float, optional)
|
|
29
|
+
One or more off-axis angles in degrees (space-separated). Default: [0.0].
|
|
30
|
+
- source_distance (float, optional)
|
|
31
|
+
Source distance in kilometers. Default: 10.0.
|
|
32
|
+
- number_of_photons (int, optional)
|
|
33
|
+
Number of photons of the light source to trace per run. Default: 10000.
|
|
34
|
+
- perfect_mirror (flag, optional)
|
|
35
|
+
Assume perfect mirror shape/alignment/reflection.
|
|
36
|
+
- debug_plots (flag, optional)
|
|
37
|
+
Generate additional debug plots (radius histograms, XY heatmaps, radius vs angle).
|
|
38
|
+
- calculate_primary_secondary_angles / no-calculate_primary_secondary_angles
|
|
39
|
+
Include or skip angles on primary/secondary mirrors. Default: include.
|
|
40
|
+
|
|
41
|
+
The application writes:
|
|
42
|
+
|
|
43
|
+
- imaging list (photons) file
|
|
44
|
+
- stars list file
|
|
45
|
+
- a histogram of incident angles (PNG)
|
|
46
|
+
- a results table in ECSV format
|
|
47
|
+
|
|
48
|
+
Example of a focal-plane incident angle plot for a SST:
|
|
49
|
+
|
|
50
|
+
.. _plot_calculate_incident_angles_plot:
|
|
51
|
+
.. image:: images/incident_angles_multi_calculate_incident_angles_SSTS-04.png
|
|
52
|
+
:width: 49 %
|
|
53
|
+
|
|
54
|
+
Example of a primary mirror incident angle plot for a SST:
|
|
55
|
+
|
|
56
|
+
.. _plot_calculate_incident_angles_plot_primary:
|
|
57
|
+
.. image:: images/incident_angles_primary_multi_calculate_incident_angles_SSTS-04.png
|
|
58
|
+
:width: 49 %
|
|
59
|
+
|
|
60
|
+
Note also the relation between radius and primary mirror incident angles, and how this relates to
|
|
61
|
+
the peak seen in the primary mirror incident angle distribution:
|
|
62
|
+
|
|
63
|
+
.. _plot_calculate_incident_angles_plot_angle_vs_radius:
|
|
64
|
+
.. image:: images/primary_angle_vs_radius.png
|
|
65
|
+
:width: 49 %
|
|
66
|
+
|
|
67
|
+
Example of a secondary mirror incident angle plot for a SST:
|
|
68
|
+
|
|
69
|
+
.. _plot_calculate_incident_angles_plot_secondary:
|
|
70
|
+
.. image:: images/incident_angles_secondary_multi_calculate_incident_angles_SSTS-04.png
|
|
71
|
+
:width: 49 %
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
import logging
|
|
75
|
+
from pathlib import Path
|
|
76
|
+
|
|
77
|
+
from simtools.configuration import configurator
|
|
78
|
+
from simtools.ray_tracing.incident_angles import IncidentAnglesCalculator
|
|
79
|
+
from simtools.visualization.plot_incident_angles import plot_incident_angles
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _parse(label):
|
|
83
|
+
"""Parse command line configuration."""
|
|
84
|
+
config = configurator.Configurator(
|
|
85
|
+
label=label,
|
|
86
|
+
description=(
|
|
87
|
+
"Calculate photon incident angles on focal plane and primary/secondary mirrors."
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
config.parser.add_argument(
|
|
91
|
+
"--off_axis_angles",
|
|
92
|
+
help="One or more off-axis angles in degrees (space-separated)",
|
|
93
|
+
type=float,
|
|
94
|
+
nargs="+",
|
|
95
|
+
required=False,
|
|
96
|
+
)
|
|
97
|
+
config.parser.add_argument(
|
|
98
|
+
"--source_distance",
|
|
99
|
+
help="Source distance in kilometers",
|
|
100
|
+
type=float,
|
|
101
|
+
default=10.0,
|
|
102
|
+
required=False,
|
|
103
|
+
)
|
|
104
|
+
config.parser.add_argument(
|
|
105
|
+
"--number_of_photons",
|
|
106
|
+
help="Number of star photons to trace (per run)",
|
|
107
|
+
type=int,
|
|
108
|
+
default=10000,
|
|
109
|
+
required=False,
|
|
110
|
+
)
|
|
111
|
+
config.parser.add_argument(
|
|
112
|
+
"--perfect_mirror",
|
|
113
|
+
help="Assume perfect mirror shape/alignment/reflection",
|
|
114
|
+
action="store_true",
|
|
115
|
+
required=False,
|
|
116
|
+
)
|
|
117
|
+
config.parser.add_argument(
|
|
118
|
+
"--debug_plots",
|
|
119
|
+
dest="debug_plots",
|
|
120
|
+
help="Generate additional debug plots (radius histograms, XY heatmaps, radius vs angle)",
|
|
121
|
+
action="store_true",
|
|
122
|
+
required=False,
|
|
123
|
+
)
|
|
124
|
+
config.parser.add_argument(
|
|
125
|
+
"--calculate_primary_secondary_angles",
|
|
126
|
+
dest="calculate_primary_secondary_angles",
|
|
127
|
+
help="Also compute angles of incidence on primary and secondary mirrors",
|
|
128
|
+
required=False,
|
|
129
|
+
action="store_true",
|
|
130
|
+
)
|
|
131
|
+
return config.initialize(
|
|
132
|
+
db_config=True,
|
|
133
|
+
simulation_model=["telescope", "site", "model_version"],
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def main():
|
|
138
|
+
"""Application to calculate incident angles using ray tracing."""
|
|
139
|
+
label = Path(__file__).stem
|
|
140
|
+
args_dict, db_config = _parse(label)
|
|
141
|
+
|
|
142
|
+
logger = logging.getLogger()
|
|
143
|
+
logger.setLevel(logging.INFO)
|
|
144
|
+
|
|
145
|
+
logger.info("Starting calculation of incident angles")
|
|
146
|
+
|
|
147
|
+
output_base = Path(args_dict.get("output_path", "./"))
|
|
148
|
+
output_dir = (
|
|
149
|
+
output_base / label if not args_dict.get("use_plain_output_path", False) else output_base
|
|
150
|
+
)
|
|
151
|
+
base_label = args_dict.get("label", label)
|
|
152
|
+
telescope_name = args_dict["telescope"]
|
|
153
|
+
label_with_telescope = f"{base_label}_{telescope_name}"
|
|
154
|
+
|
|
155
|
+
calculator = IncidentAnglesCalculator(
|
|
156
|
+
simtel_path=args_dict["simtel_path"],
|
|
157
|
+
db_config=db_config,
|
|
158
|
+
config_data=args_dict,
|
|
159
|
+
output_dir=output_dir,
|
|
160
|
+
label=base_label,
|
|
161
|
+
)
|
|
162
|
+
offsets = [float(v) for v in args_dict.get("off_axis_angles", [0.0])]
|
|
163
|
+
|
|
164
|
+
results_by_offset = calculator.run_for_offsets(offsets)
|
|
165
|
+
plot_incident_angles(
|
|
166
|
+
results_by_offset,
|
|
167
|
+
output_dir,
|
|
168
|
+
label_with_telescope,
|
|
169
|
+
debug_plots=args_dict.get("debug_plots", False),
|
|
170
|
+
)
|
|
171
|
+
total = sum(len(t) for t in results_by_offset.values())
|
|
172
|
+
summary_msg = (
|
|
173
|
+
f"Calculated incident angles for {len(results_by_offset)} offsets,\n"
|
|
174
|
+
f"total photon statistics {total}"
|
|
175
|
+
)
|
|
176
|
+
if total < 1_000_000:
|
|
177
|
+
summary_msg += " (below 1e6; results may be statistically unstable)"
|
|
178
|
+
logger.info(summary_msg)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
main()
|
|
@@ -69,7 +69,8 @@ import simtools.data_model.model_data_writer as writer
|
|
|
69
69
|
import simtools.utils.general as gen
|
|
70
70
|
from simtools.configuration import configurator
|
|
71
71
|
from simtools.data_model import schema
|
|
72
|
-
from simtools.
|
|
72
|
+
from simtools.io import ascii_handler
|
|
73
|
+
from simtools.io.io_handler import IOHandler
|
|
73
74
|
from simtools.simtel import simtel_config_reader
|
|
74
75
|
|
|
75
76
|
|
|
@@ -170,7 +171,7 @@ def get_number_of_camera_pixel(args_dict, logger):
|
|
|
170
171
|
)
|
|
171
172
|
_camera_pixel = config_reader.parameter_dict.get(args_dict["simtel_telescope_name"])
|
|
172
173
|
except (FileNotFoundError, AttributeError):
|
|
173
|
-
logger.warning("
|
|
174
|
+
logger.warning("Unable to retrieve camera pixel parameter.")
|
|
174
175
|
_camera_pixel = None
|
|
175
176
|
logger.info(f"Number of camera pixels: {_camera_pixel}")
|
|
176
177
|
return _camera_pixel
|
|
@@ -319,7 +320,7 @@ def print_list_of_files(args_dict, logger):
|
|
|
319
320
|
"""
|
|
320
321
|
model_files = sorted(Path(args_dict["output_path"]).rglob("*.json"))
|
|
321
322
|
for file in model_files:
|
|
322
|
-
model_dict =
|
|
323
|
+
model_dict = ascii_handler.collect_data_from_file(file_name=file)
|
|
323
324
|
if model_dict.get("file"):
|
|
324
325
|
logger.info(f"{file.name}: {model_dict['value']}")
|
|
325
326
|
|
|
@@ -140,10 +140,10 @@ def _parse(label=None, description=None):
|
|
|
140
140
|
def main():
|
|
141
141
|
"""Print a list of array elements."""
|
|
142
142
|
label = Path(__file__).stem
|
|
143
|
-
|
|
143
|
+
model_parameter_name = "array_coordinates"
|
|
144
144
|
args_dict, db_config = _parse(
|
|
145
145
|
label,
|
|
146
|
-
description=f"Print a list of array element positions ({
|
|
146
|
+
description=f"Print a list of array element positions ({model_parameter_name})",
|
|
147
147
|
)
|
|
148
148
|
|
|
149
149
|
logger = logging.getLogger()
|
|
@@ -153,7 +153,7 @@ def main():
|
|
|
153
153
|
site = args_dict.get("site", None)
|
|
154
154
|
metadata, validate_schema_file = None, None
|
|
155
155
|
else:
|
|
156
|
-
metadata = MetadataCollector(args_dict=args_dict,
|
|
156
|
+
metadata = MetadataCollector(args_dict=args_dict, model_parameter_name=model_parameter_name)
|
|
157
157
|
site = metadata.get_site(from_input_meta=True)
|
|
158
158
|
validate_schema_file = metadata.get_data_model_schema_file_name()
|
|
159
159
|
|
|
@@ -5,14 +5,16 @@ r"""
|
|
|
5
5
|
Generates a new database with all required collections.
|
|
6
6
|
Follows the structure of the CTAO gitlab simulation model repository.
|
|
7
7
|
|
|
8
|
-
This is an application for
|
|
8
|
+
This is an application for DB maintainers and should not be used by the general user.
|
|
9
9
|
|
|
10
10
|
Command line arguments
|
|
11
11
|
|
|
12
12
|
input_path (str, required)
|
|
13
13
|
Path of local copy of model parameter repository.
|
|
14
|
-
|
|
14
|
+
db_simulation_model (str, required)
|
|
15
15
|
Name of new DB to be created.
|
|
16
|
+
db_simulation_model_version (str, required)
|
|
17
|
+
Version of the new DB to be created.
|
|
16
18
|
type (str, optional)
|
|
17
19
|
Type of data to be uploaded to the DB. Options are: model_parameters, production_tables.
|
|
18
20
|
|
|
@@ -20,7 +22,7 @@ r"""
|
|
|
20
22
|
--------
|
|
21
23
|
Upload model data repository to the DB
|
|
22
24
|
Loops over all subdirectories in 'input_path' and uploads all json files to the
|
|
23
|
-
database
|
|
25
|
+
database (or updates an existing database with the same name):
|
|
24
26
|
|
|
25
27
|
* subdirectories starting with 'OBS' are uploaded to the 'sites' collection
|
|
26
28
|
* json files from the subdirectory 'configuration_sim_telarray/configuration_corsika'
|
|
@@ -33,7 +35,8 @@ r"""
|
|
|
33
35
|
|
|
34
36
|
simtools-db-simulation-model-from-repository-to-db \
|
|
35
37
|
--input_path /path/to/repository \
|
|
36
|
-
--
|
|
38
|
+
--db_simulation_model database name \
|
|
39
|
+
--db_simulation_model_version new database version \
|
|
37
40
|
--type model_parameters
|
|
38
41
|
|
|
39
42
|
Upload production tables to the DB:
|
|
@@ -42,7 +45,8 @@ r"""
|
|
|
42
45
|
|
|
43
46
|
simtools-db-simulation-model-from-repository-to-db \
|
|
44
47
|
--input_path /path/to/repository \
|
|
45
|
-
--
|
|
48
|
+
--db_simulation_model database name \
|
|
49
|
+
--db_simulation_model_version new database version \
|
|
46
50
|
--type production_tables
|
|
47
51
|
|
|
48
52
|
"""
|
|
@@ -78,12 +82,6 @@ def _parse(label=None, description=None):
|
|
|
78
82
|
type=Path,
|
|
79
83
|
required=True,
|
|
80
84
|
)
|
|
81
|
-
config.parser.add_argument(
|
|
82
|
-
"--db_name",
|
|
83
|
-
help="Name of the new simulation model database to be created.",
|
|
84
|
-
type=str.strip,
|
|
85
|
-
required=True,
|
|
86
|
-
)
|
|
87
85
|
config.parser.add_argument(
|
|
88
86
|
"--type",
|
|
89
87
|
help="Type of data to be uploaded to the database.",
|
|
@@ -94,7 +92,12 @@ def _parse(label=None, description=None):
|
|
|
94
92
|
)
|
|
95
93
|
|
|
96
94
|
args_dict, db_config = config.initialize(output=True, require_command_line=True, db_config=True)
|
|
97
|
-
|
|
95
|
+
if args_dict.get("db_simulation_model") and args_dict.get("db_simulation_model_version"):
|
|
96
|
+
# overwrite explicitly DB configuration
|
|
97
|
+
db_config["db_simulation_model"] = args_dict["db_simulation_model"]
|
|
98
|
+
db_config["db_simulation_model_version"] = args_dict["db_simulation_model_version"]
|
|
99
|
+
else:
|
|
100
|
+
raise ValueError("Both db_simulation_model and db_simulation_model_version are required.")
|
|
98
101
|
return args_dict, db_config
|
|
99
102
|
|
|
100
103
|
|
|
@@ -110,9 +113,9 @@ def main():
|
|
|
110
113
|
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
111
114
|
|
|
112
115
|
if args_dict.get("type") == "model_parameters":
|
|
113
|
-
db_model_upload.add_model_parameters_to_db(args_dict, db)
|
|
116
|
+
db_model_upload.add_model_parameters_to_db(input_path=Path(args_dict["input_path"]), db=db)
|
|
114
117
|
elif args_dict.get("type") == "production_tables":
|
|
115
|
-
db_model_upload.add_production_tables_to_db(args_dict, db)
|
|
118
|
+
db_model_upload.add_production_tables_to_db(input_path=Path(args_dict["input_path"]), db=db)
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
if __name__ == "__main__":
|
|
@@ -32,6 +32,7 @@ from pathlib import Path
|
|
|
32
32
|
import simtools.utils.general as gen
|
|
33
33
|
from simtools.configuration import configurator
|
|
34
34
|
from simtools.db import db_handler
|
|
35
|
+
from simtools.io import ascii_handler
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
def _parse():
|
|
@@ -61,8 +62,8 @@ def main(): # noqa: D103
|
|
|
61
62
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
62
63
|
|
|
63
64
|
if args_dict.get("test_db", False):
|
|
64
|
-
db_config["
|
|
65
|
-
logger.info(f"Using test database
|
|
65
|
+
db_config["db_simulation_model_version"] = str(uuid.uuid4())
|
|
66
|
+
logger.info(f"Using test database version {db_config['db_simulation_model_version']}")
|
|
66
67
|
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
67
68
|
|
|
68
69
|
files_to_insert = []
|
|
@@ -82,14 +83,13 @@ def main(): # noqa: D103
|
|
|
82
83
|
print(*files_to_insert, sep="\n")
|
|
83
84
|
print()
|
|
84
85
|
|
|
85
|
-
logger.info(f"DB {
|
|
86
|
+
logger.info(f"DB {db.get_db_name()} selected.")
|
|
86
87
|
|
|
87
88
|
if gen.user_confirm():
|
|
88
89
|
for file_to_insert_now in files_to_insert:
|
|
89
|
-
par_dict =
|
|
90
|
+
par_dict = ascii_handler.collect_data_from_file(file_name=file_to_insert_now)
|
|
90
91
|
logger.info(f"Adding the following parameter to the DB: {par_dict['parameter']}")
|
|
91
92
|
db.add_new_parameter(
|
|
92
|
-
db_name=db_config["db_simulation_model"],
|
|
93
93
|
par_dict=par_dict,
|
|
94
94
|
collection_name=args_dict["db_collection"],
|
|
95
95
|
file_prefix="./",
|
|
@@ -102,11 +102,9 @@ def main(): # noqa: D103
|
|
|
102
102
|
logger.info("Aborted, no change applied to the database")
|
|
103
103
|
|
|
104
104
|
# drop test database; be safe and required DB name is sandbox
|
|
105
|
-
if args_dict.get("test_db", False) and "sandbox" in
|
|
106
|
-
logger.info(
|
|
107
|
-
|
|
108
|
-
)
|
|
109
|
-
db.db_client.drop_database(db_config["db_simulation_model"])
|
|
105
|
+
if args_dict.get("test_db", False) and "sandbox" in db.get_db_name():
|
|
106
|
+
logger.info(f"Test database used. Dropping all data from {db.get_db_name()}")
|
|
107
|
+
db.db_client.drop_database(db.get_db_name())
|
|
110
108
|
|
|
111
109
|
|
|
112
110
|
if __name__ == "__main__":
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
import json
|
|
37
36
|
import logging
|
|
38
37
|
from pathlib import Path
|
|
39
38
|
|
|
@@ -41,7 +40,8 @@ import astropy.table
|
|
|
41
40
|
|
|
42
41
|
import simtools.utils.general as gen
|
|
43
42
|
from simtools.configuration import configurator
|
|
44
|
-
from simtools.data_model.model_data_writer import
|
|
43
|
+
from simtools.data_model.model_data_writer import ModelDataWriter
|
|
44
|
+
from simtools.io import ascii_handler
|
|
45
45
|
from simtools.model.array_model import ArrayModel
|
|
46
46
|
|
|
47
47
|
|
|
@@ -145,17 +145,12 @@ def write_ground_array_elements_to_repository(args_dict, db_config, logger):
|
|
|
145
145
|
output_path = Path(args_dict["repository_path"]) / f"{element_name}"
|
|
146
146
|
output_path.mkdir(parents=True, exist_ok=True)
|
|
147
147
|
logger.info(f"Writing array element positions (ground) to {output_path}")
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
indent=4,
|
|
155
|
-
sort_keys=False,
|
|
156
|
-
cls=JsonNumpyEncoder,
|
|
157
|
-
)
|
|
158
|
-
file.write("\n")
|
|
148
|
+
ascii_handler.write_data_to_file(
|
|
149
|
+
data=data,
|
|
150
|
+
output_file=output_path / "array_element_position_ground.json",
|
|
151
|
+
sort_keys=False,
|
|
152
|
+
numpy_types=True,
|
|
153
|
+
)
|
|
159
154
|
|
|
160
155
|
|
|
161
156
|
def main():
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Generate compound indexes for the specified database.
|
|
5
|
+
|
|
6
|
+
This needs to be done once after a database has been set up.
|
|
7
|
+
Significantly accelerates database querying (at least a factor
|
|
8
|
+
of 5 in query time with a factor of 10 less documents examined).
|
|
9
|
+
|
|
10
|
+
Command line arguments
|
|
11
|
+
----------------------
|
|
12
|
+
db_name (str, optional)
|
|
13
|
+
Database name (use "all" for all databases)
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import logging
|
|
17
|
+
|
|
18
|
+
import simtools.utils.general as gen
|
|
19
|
+
from simtools.configuration import configurator
|
|
20
|
+
from simtools.db import db_handler
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse():
|
|
24
|
+
config = configurator.Configurator(
|
|
25
|
+
description="Generate compound indexes for a specific database"
|
|
26
|
+
)
|
|
27
|
+
config.parser.add_argument(
|
|
28
|
+
"--db_name",
|
|
29
|
+
help="Database name",
|
|
30
|
+
default=None,
|
|
31
|
+
required=False,
|
|
32
|
+
)
|
|
33
|
+
return config.initialize(db_config=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def main(): # noqa: D103
|
|
37
|
+
args_dict, db_config = _parse()
|
|
38
|
+
|
|
39
|
+
logger = logging.getLogger()
|
|
40
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
41
|
+
|
|
42
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
43
|
+
# databases without internal databases we don't have rights to modify
|
|
44
|
+
databases = [
|
|
45
|
+
d for d in db.db_client.list_database_names() if d not in ("config", "admin", "local")
|
|
46
|
+
]
|
|
47
|
+
requested = db.get_db_name(
|
|
48
|
+
db_name=args_dict["db_name"],
|
|
49
|
+
model_version=args_dict.get("db_simulation_model_version"),
|
|
50
|
+
model_name=args_dict.get("db_simulation_model"),
|
|
51
|
+
)
|
|
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
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
main()
|
|
@@ -38,7 +38,7 @@ import logging
|
|
|
38
38
|
import simtools.utils.general as gen
|
|
39
39
|
from simtools.configuration import configurator
|
|
40
40
|
from simtools.db import db_handler
|
|
41
|
-
from simtools.
|
|
41
|
+
from simtools.io import io_handler
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
def _parse():
|
|
@@ -65,29 +65,17 @@ def main(): # noqa: D103
|
|
|
65
65
|
_io_handler = io_handler.IOHandler()
|
|
66
66
|
|
|
67
67
|
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
logger.info(
|
|
80
|
-
f"Got file {args_dict['file_name']} from DB {db_name} "
|
|
81
|
-
f"and saved into {_io_handler.get_output_directory()}"
|
|
82
|
-
)
|
|
83
|
-
break
|
|
84
|
-
except FileNotFoundError:
|
|
85
|
-
continue
|
|
86
|
-
|
|
87
|
-
for key, value in file_id.items():
|
|
88
|
-
if value is None:
|
|
89
|
-
logger.error(f"The file {key} was not found in any of the available DBs.")
|
|
90
|
-
raise FileNotFoundError
|
|
68
|
+
file_id = db.export_model_files(
|
|
69
|
+
dest=_io_handler.get_output_directory(),
|
|
70
|
+
file_names=args_dict["file_name"],
|
|
71
|
+
)
|
|
72
|
+
if file_id is None:
|
|
73
|
+
logger.error(f"The file {args_dict['file_name']} was not found in {db.db_name}.")
|
|
74
|
+
raise FileNotFoundError
|
|
75
|
+
logger.info(
|
|
76
|
+
f"Got file {args_dict['file_name']} from DB {db.db_name} "
|
|
77
|
+
f"and saved into {_io_handler.get_output_directory()}"
|
|
78
|
+
)
|
|
91
79
|
|
|
92
80
|
|
|
93
81
|
if __name__ == "__main__":
|
|
@@ -60,7 +60,6 @@ r"""
|
|
|
60
60
|
|
|
61
61
|
"""
|
|
62
62
|
|
|
63
|
-
import json
|
|
64
63
|
import logging
|
|
65
64
|
from pathlib import Path
|
|
66
65
|
from pprint import pprint
|
|
@@ -68,7 +67,7 @@ from pprint import pprint
|
|
|
68
67
|
import simtools.utils.general as gen
|
|
69
68
|
from simtools.configuration import configurator
|
|
70
69
|
from simtools.db import db_handler
|
|
71
|
-
from simtools.
|
|
70
|
+
from simtools.io import ascii_handler, io_handler
|
|
72
71
|
|
|
73
72
|
|
|
74
73
|
def _parse():
|
|
@@ -142,8 +141,9 @@ def main(): # noqa: D103
|
|
|
142
141
|
)
|
|
143
142
|
pars[args_dict["parameter"]].pop("_id")
|
|
144
143
|
pars[args_dict["parameter"]].pop("entry_date")
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
ascii_handler.write_data_to_file(
|
|
145
|
+
data=pars[args_dict["parameter"]], output_file=_output_file
|
|
146
|
+
)
|
|
147
147
|
else:
|
|
148
148
|
pprint(pars[args_dict["parameter"]])
|
|
149
149
|
|
|
@@ -6,7 +6,7 @@ Inspect databases and print (available database names and collections).
|
|
|
6
6
|
Command line arguments
|
|
7
7
|
----------------------
|
|
8
8
|
db_name (str, optional)
|
|
9
|
-
|
|
9
|
+
Database name (use "all" for all databases)
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
import logging
|
|
@@ -20,11 +20,11 @@ def _parse():
|
|
|
20
20
|
config = configurator.Configurator(description="Inspect databases")
|
|
21
21
|
config.parser.add_argument(
|
|
22
22
|
"--db_name",
|
|
23
|
-
help="
|
|
23
|
+
help="Database name",
|
|
24
24
|
default="all",
|
|
25
25
|
required=True,
|
|
26
26
|
)
|
|
27
|
-
return config.initialize(db_config=True
|
|
27
|
+
return config.initialize(db_config=True)
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def main(): # noqa: D103
|
|
@@ -34,18 +34,28 @@ def main(): # noqa: D103
|
|
|
34
34
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
35
35
|
|
|
36
36
|
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
37
|
-
|
|
38
|
-
databases =
|
|
37
|
+
# databases without internal databases we don't have rights to modify
|
|
38
|
+
databases = [
|
|
39
|
+
d for d in db.db_client.list_database_names() if d not in ("config", "admin", "local")
|
|
40
|
+
]
|
|
41
|
+
requested = args_dict["db_name"]
|
|
42
|
+
if requested != "all" and requested not in databases:
|
|
43
|
+
raise ValueError(
|
|
44
|
+
f"Requested database '{requested}' not found. "
|
|
45
|
+
f"Following databases are available: {', '.join(databases)}"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
databases = databases if requested == "all" else [requested]
|
|
39
49
|
|
|
40
50
|
for db_name in databases:
|
|
41
|
-
if args_dict["db_name"] != "all" and db_name != args_dict["db_name"]:
|
|
42
|
-
continue
|
|
43
|
-
# missing admin rights; skip config and admin
|
|
44
|
-
if db_name in ("config", "admin", "local"):
|
|
45
|
-
continue
|
|
46
51
|
print("Database:", db_name)
|
|
47
52
|
collections = db.get_collections(db_name=db_name)
|
|
48
53
|
print(" Collections:", collections)
|
|
54
|
+
print(" Indexes:")
|
|
55
|
+
for collection_name in collections:
|
|
56
|
+
db_collection = db.get_collection(collection_name=collection_name, db_name=db_name)
|
|
57
|
+
for idx in db_collection.list_indexes():
|
|
58
|
+
print(f" {collection_name}: {idx}")
|
|
49
59
|
|
|
50
60
|
|
|
51
61
|
if __name__ == "__main__":
|