gammasimtools 0.21.0__py3-none-any.whl → 0.23.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/METADATA +3 -3
- gammasimtools-0.23.0.dist-info/RECORD +414 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/entry_points.txt +2 -1
- simtools/_version.py +2 -2
- simtools/application_control.py +118 -0
- simtools/applications/calculate_incident_angles.py +17 -25
- simtools/applications/convert_all_model_parameters_from_simtel.py +29 -45
- simtools/applications/convert_geo_coordinates_of_array_elements.py +26 -45
- simtools/applications/convert_model_parameter_from_simtel.py +21 -42
- simtools/applications/db_add_file_to_db.py +12 -13
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +20 -33
- simtools/applications/db_add_value_from_json_to_db.py +28 -23
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +19 -34
- simtools/applications/db_generate_compound_indexes.py +12 -27
- simtools/applications/db_get_array_layouts_from_db.py +19 -39
- simtools/applications/db_get_file_from_db.py +15 -17
- simtools/applications/db_get_parameter_from_db.py +33 -35
- simtools/applications/db_inspect_databases.py +10 -11
- simtools/applications/db_upload_model_repository.py +104 -0
- simtools/applications/derive_ctao_array_layouts.py +16 -21
- simtools/applications/derive_mirror_rnda.py +9 -14
- simtools/applications/derive_photon_electron_spectrum.py +7 -10
- simtools/applications/derive_psf_parameters.py +24 -21
- simtools/applications/derive_trigger_rates.py +6 -9
- simtools/applications/docs_produce_array_element_report.py +22 -23
- simtools/applications/docs_produce_calibration_reports.py +26 -24
- simtools/applications/docs_produce_model_parameter_reports.py +15 -22
- simtools/applications/docs_produce_simulation_configuration_report.py +21 -22
- simtools/applications/generate_array_config.py +14 -33
- simtools/applications/generate_corsika_histograms.py +22 -43
- simtools/applications/generate_default_metadata.py +15 -36
- simtools/applications/generate_regular_arrays.py +11 -15
- simtools/applications/generate_simtel_event_data.py +23 -33
- simtools/applications/maintain_simulation_model_add_production.py +17 -48
- simtools/applications/maintain_simulation_model_compare_productions.py +10 -12
- simtools/applications/maintain_simulation_model_verify_production_tables.py +8 -11
- simtools/applications/merge_tables.py +15 -24
- simtools/applications/plot_array_layout.py +77 -55
- simtools/applications/plot_simtel_events.py +11 -13
- simtools/applications/plot_tabular_data.py +17 -38
- simtools/applications/plot_tabular_data_for_model_parameter.py +16 -23
- simtools/applications/print_version.py +14 -42
- simtools/applications/production_derive_corsika_limits.py +5 -9
- simtools/applications/production_derive_statistics.py +12 -26
- simtools/applications/production_generate_grid.py +20 -48
- simtools/applications/production_merge_corsika_limits.py +17 -21
- simtools/applications/run_application.py +12 -32
- simtools/applications/simulate_flasher.py +79 -81
- simtools/applications/simulate_illuminator.py +56 -197
- simtools/applications/{simulate_calibration_events.py → simulate_pedestals.py} +22 -68
- simtools/applications/simulate_prod.py +21 -33
- simtools/applications/simulate_prod_htcondor_generator.py +11 -25
- simtools/applications/submit_array_layouts.py +15 -18
- simtools/applications/submit_data_from_external.py +18 -34
- simtools/applications/submit_model_parameter_from_external.py +27 -41
- simtools/applications/validate_camera_efficiency.py +23 -22
- simtools/applications/validate_camera_fov.py +21 -27
- simtools/applications/validate_cumulative_psf.py +28 -37
- simtools/applications/validate_file_using_schema.py +35 -45
- simtools/applications/validate_optics.py +27 -33
- simtools/camera/camera_efficiency.py +8 -13
- simtools/configuration/commandline_parser.py +33 -11
- simtools/configuration/configurator.py +0 -7
- simtools/corsika/corsika_config.py +9 -16
- simtools/corsika/corsika_histograms.py +1 -1
- simtools/data_model/data_reader.py +0 -2
- simtools/data_model/metadata_collector.py +0 -2
- simtools/data_model/model_data_writer.py +87 -27
- simtools/data_model/schema.py +61 -2
- simtools/data_model/validate_data.py +1 -3
- simtools/db/db_handler.py +58 -39
- simtools/db/db_model_upload.py +210 -5
- simtools/io/hdf5_handler.py +0 -5
- simtools/io/io_handler.py +31 -83
- simtools/io/legacy_data_handler.py +0 -5
- simtools/job_execution/job_manager.py +43 -1
- simtools/layout/array_layout.py +0 -2
- simtools/layout/array_layout_utils.py +1 -5
- simtools/layout/telescope_position.py +0 -2
- simtools/model/array_model.py +95 -46
- simtools/model/calibration_model.py +0 -2
- simtools/model/camera.py +0 -2
- simtools/model/mirrors.py +0 -2
- simtools/model/model_parameter.py +50 -16
- simtools/model/model_repository.py +139 -106
- simtools/model/model_utils.py +21 -11
- simtools/model/site_model.py +0 -2
- simtools/model/telescope_model.py +20 -2
- simtools/production_configuration/calculate_statistical_uncertainties_grid_point.py +0 -2
- simtools/production_configuration/derive_corsika_limits.py +1 -1
- simtools/production_configuration/derive_production_statistics.py +0 -2
- simtools/production_configuration/interpolation_handler.py +0 -2
- simtools/ray_tracing/incident_angles.py +7 -7
- simtools/ray_tracing/mirror_panel_psf.py +1 -1
- simtools/ray_tracing/psf_analysis.py +0 -2
- simtools/ray_tracing/psf_parameter_optimisation.py +180 -73
- simtools/ray_tracing/ray_tracing.py +1 -5
- simtools/reporting/docs_auto_report_generator.py +108 -0
- simtools/reporting/docs_read_parameters.py +168 -104
- simtools/resources/array_elements.yml +26 -0
- simtools/runners/corsika_runner.py +0 -2
- simtools/runners/corsika_simtel_runner.py +11 -19
- simtools/runners/runner_services.py +5 -6
- simtools/runners/simtel_runner.py +0 -2
- simtools/runners/simtools_runner.py +0 -2
- simtools/schemas/application_workflow.metaschema.yml +1 -1
- simtools/schemas/common_definitions.schema.yml +39 -0
- simtools/schemas/model_parameter.metaschema.yml +19 -13
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -12
- simtools/schemas/model_parameters/adjust_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates.schema.yml +0 -5
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +0 -5
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +0 -7
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +0 -7
- simtools/schemas/model_parameters/array_layouts.schema.yml +0 -5
- simtools/schemas/model_parameters/array_triggers.schema.yml +0 -5
- simtools/schemas/model_parameters/array_window.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/asum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_shaping.schema.yml +0 -7
- simtools/schemas/model_parameters/asum_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +0 -5
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +0 -5
- simtools/schemas/model_parameters/axes_offsets.schema.yml +0 -7
- simtools/schemas/model_parameters/calibration_devices.schema.yml +30 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_file.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_depth.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/camera_pixels.schema.yml +0 -7
- simtools/schemas/model_parameters/camera_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +0 -7
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +0 -7
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +0 -5
- simtools/schemas/model_parameters/dark_events.schema.yml +4 -3
- simtools/schemas/model_parameters/default_trigger.schema.yml +0 -7
- simtools/schemas/model_parameters/design_model.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/disc_start.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -9
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +0 -5
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -5
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -3
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -12
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -3
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/epsg_code.schema.yml +0 -5
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -9
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_noise.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +0 -7
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +0 -7
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +0 -3
- simtools/schemas/model_parameters/flasher_angular_distribution.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_angular_distribution_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_bunch_size.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_external_trigger.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/flasher_position.schema.yml +43 -0
- simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +29 -0
- simtools/schemas/model_parameters/flasher_pulse_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +30 -0
- simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +32 -0
- simtools/schemas/model_parameters/flasher_type.schema.yml +28 -0
- simtools/schemas/model_parameters/flasher_var_photons.schema.yml +31 -0
- simtools/schemas/model_parameters/flasher_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_length.schema.yml +0 -7
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/focus_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/gain_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +2 -7
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +2 -7
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +0 -7
- simtools/schemas/model_parameters/laser_events.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +4 -3
- simtools/schemas/model_parameters/led_events.schema.yml +4 -3
- simtools/schemas/model_parameters/led_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +4 -3
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +4 -3
- simtools/schemas/model_parameters/led_var_photons.schema.yml +4 -3
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/min_photons.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_class.schema.yml +2 -9
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +0 -5
- simtools/schemas/model_parameters/mirror_list.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +0 -7
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +0 -7
- simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +0 -3
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +0 -7
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_sky_map.schema.yml +0 -5
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +0 -5
- simtools/schemas/model_parameters/num_gains.schema.yml +0 -7
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +0 -7
- simtools/schemas/model_parameters/optics_properties.schema.yml +0 -7
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +0 -3
- simtools/schemas/model_parameters/pedestal_events.schema.yml +4 -7
- simtools/schemas/model_parameters/photon_delay.schema.yml +0 -7
- simtools/schemas/model_parameters/photons_per_run.schema.yml +4 -4
- simtools/schemas/model_parameters/pixel_cells.schema.yml +0 -3
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +0 -3
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +0 -5
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +0 -7
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -9
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +0 -5
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +0 -7
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/qe_variation.schema.yml +0 -7
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +0 -7
- simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -7
- simtools/schemas/model_parameters/random_generator.schema.yml +0 -7
- simtools/schemas/model_parameters/random_mono_probability.schema.yml +0 -7
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +0 -5
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +0 -5
- simtools/schemas/model_parameters/sampled_output.schema.yml +0 -7
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +0 -7
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +0 -3
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +0 -3
- simtools/schemas/model_parameters/stars.schema.yml +0 -5
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +0 -7
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +0 -7
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +0 -7
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_error.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +0 -7
- simtools/schemas/model_parameters/transit_time_random.schema.yml +29 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +0 -7
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +0 -7
- simtools/schemas/production_tables.schema.yml +8 -8
- simtools/schemas/simulation_models_info.schema.yml +78 -0
- simtools/simtel/simtel_config_reader.py +0 -2
- simtools/simtel/simtel_config_writer.py +118 -26
- simtools/simtel/simtel_io_metadata.py +3 -3
- simtools/simtel/simulator_array.py +43 -85
- simtools/simtel/simulator_camera_efficiency.py +0 -2
- simtools/simtel/simulator_light_emission.py +336 -631
- simtools/simtel/simulator_ray_tracing.py +2 -4
- simtools/simulator.py +45 -19
- simtools/testing/assertions.py +2 -2
- simtools/testing/configuration.py +21 -6
- simtools/testing/sim_telarray_metadata.py +4 -4
- simtools/utils/general.py +5 -13
- simtools/utils/geometry.py +34 -5
- simtools/utils/names.py +1 -13
- simtools/version.py +83 -0
- simtools/visualization/plot_array_layout.py +129 -23
- simtools/visualization/plot_incident_angles.py +0 -2
- simtools/visualization/plot_psf.py +163 -61
- simtools/visualization/plot_simtel_events.py +1 -12
- simtools/visualization/visualize.py +0 -12
- gammasimtools-0.21.0.dist-info/RECORD +0 -396
- simtools/model/flasher_model.py +0 -106
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/top_level.txt +0 -0
|
@@ -36,34 +36,19 @@ r"""
|
|
|
36
36
|
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
-
import logging
|
|
40
|
-
from pathlib import Path
|
|
41
|
-
|
|
42
39
|
import simtools.data_model.model_data_writer as writer
|
|
43
|
-
|
|
40
|
+
from simtools.application_control import get_application_label, startup_application
|
|
44
41
|
from simtools.configuration import configurator
|
|
45
42
|
from simtools.data_model import validate_data
|
|
46
43
|
from simtools.data_model.metadata_collector import MetadataCollector
|
|
47
44
|
|
|
48
45
|
|
|
49
|
-
def _parse(
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
label: str
|
|
56
|
-
Label describing application.
|
|
57
|
-
description: str
|
|
58
|
-
Description of application.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
CommandLineParser
|
|
63
|
-
Command line parser object
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
config = configurator.Configurator(label=label, description=description)
|
|
46
|
+
def _parse():
|
|
47
|
+
"""Parse command line configuration."""
|
|
48
|
+
config = configurator.Configurator(
|
|
49
|
+
label=get_application_label(__file__),
|
|
50
|
+
description="Submit and validate data (e.g., input data to tools, model parameters).",
|
|
51
|
+
)
|
|
67
52
|
|
|
68
53
|
config.parser.add_argument(
|
|
69
54
|
"--input_meta",
|
|
@@ -92,26 +77,25 @@ def _parse(label, description):
|
|
|
92
77
|
return config.initialize(output=True)
|
|
93
78
|
|
|
94
79
|
|
|
95
|
-
def main():
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
description="Submit and validate data (e.g., input data to tools, model parameters).",
|
|
99
|
-
)
|
|
80
|
+
def main():
|
|
81
|
+
"""Submit and validate data (e.g., input data to tools, model parameters)."""
|
|
82
|
+
app_context = startup_application(_parse)
|
|
100
83
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_metadata = None if args_dict.get("ignore_metadata") else MetadataCollector(args_dict)
|
|
84
|
+
_metadata = (
|
|
85
|
+
None if app_context.args.get("ignore_metadata") else MetadataCollector(app_context.args)
|
|
86
|
+
)
|
|
105
87
|
|
|
106
88
|
data_validator = validate_data.DataValidator(
|
|
107
89
|
schema_file=(
|
|
108
|
-
_metadata.get_data_model_schema_file_name()
|
|
90
|
+
_metadata.get_data_model_schema_file_name()
|
|
91
|
+
if _metadata
|
|
92
|
+
else app_context.args.get("schema")
|
|
109
93
|
),
|
|
110
|
-
data_file=
|
|
94
|
+
data_file=app_context.args["input"],
|
|
111
95
|
)
|
|
112
96
|
|
|
113
97
|
writer.ModelDataWriter.dump(
|
|
114
|
-
args_dict=
|
|
98
|
+
args_dict=app_context.args,
|
|
115
99
|
metadata=_metadata,
|
|
116
100
|
product_data=data_validator.validate_and_transform(),
|
|
117
101
|
)
|
|
@@ -38,32 +38,19 @@ r"""
|
|
|
38
38
|
|
|
39
39
|
"""
|
|
40
40
|
|
|
41
|
-
import logging
|
|
42
41
|
from pathlib import Path
|
|
43
42
|
|
|
44
43
|
import simtools.data_model.model_data_writer as writer
|
|
45
|
-
|
|
44
|
+
from simtools.application_control import get_application_label, startup_application
|
|
46
45
|
from simtools.configuration import configurator
|
|
47
46
|
|
|
48
47
|
|
|
49
|
-
def _parse(
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
label: str
|
|
56
|
-
Label describing application.
|
|
57
|
-
description: str
|
|
58
|
-
Description of application.
|
|
59
|
-
|
|
60
|
-
Returns
|
|
61
|
-
-------
|
|
62
|
-
CommandLineParser
|
|
63
|
-
Command line parser object
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
config = configurator.Configurator(label=label, description=description)
|
|
48
|
+
def _parse():
|
|
49
|
+
"""Parse command line configuration."""
|
|
50
|
+
config = configurator.Configurator(
|
|
51
|
+
label=get_application_label(__file__),
|
|
52
|
+
description="Submit and validate a model parameter.",
|
|
53
|
+
)
|
|
67
54
|
|
|
68
55
|
config.parser.add_argument(
|
|
69
56
|
"--parameter", type=str, required=True, help="Parameter for simulation model"
|
|
@@ -98,31 +85,30 @@ def _parse(label, description):
|
|
|
98
85
|
return config.initialize(output=True, db_config=True)
|
|
99
86
|
|
|
100
87
|
|
|
101
|
-
def main():
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
description="Submit and validate a model parameters).",
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
logger = logging.getLogger()
|
|
108
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
88
|
+
def main():
|
|
89
|
+
"""Submit and validate a model parameter value and metadata."""
|
|
90
|
+
app_context = startup_application(_parse)
|
|
109
91
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
92
|
+
if app_context.args.get("output_path"):
|
|
93
|
+
output_path = app_context.io_handler.get_output_directory(
|
|
94
|
+
sub_dir=app_context.args.get("parameter")
|
|
95
|
+
)
|
|
96
|
+
else:
|
|
97
|
+
output_path = None
|
|
115
98
|
|
|
116
99
|
writer.ModelDataWriter.dump_model_parameter(
|
|
117
|
-
parameter_name=
|
|
118
|
-
value=
|
|
119
|
-
instrument=
|
|
120
|
-
parameter_version=
|
|
121
|
-
output_file=Path(
|
|
100
|
+
parameter_name=app_context.args["parameter"],
|
|
101
|
+
value=app_context.args["value"],
|
|
102
|
+
instrument=app_context.args["instrument"],
|
|
103
|
+
parameter_version=app_context.args["parameter_version"],
|
|
104
|
+
output_file=Path(
|
|
105
|
+
app_context.args["parameter"] + "-" + app_context.args["parameter_version"] + ".json"
|
|
106
|
+
),
|
|
122
107
|
output_path=output_path,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
metadata_input_dict=app_context.args,
|
|
109
|
+
db_config=app_context.db_config
|
|
110
|
+
if app_context.args.get("check_parameter_version")
|
|
111
|
+
else None,
|
|
126
112
|
)
|
|
127
113
|
|
|
128
114
|
|
|
@@ -44,19 +44,18 @@ r"""
|
|
|
44
44
|
The output is saved in simtools-output/validate_camera_efficiency.
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
|
-
import logging
|
|
48
47
|
from pathlib import Path
|
|
49
48
|
|
|
50
49
|
import simtools.data_model.model_data_writer as writer
|
|
51
|
-
|
|
50
|
+
from simtools.application_control import get_application_label, startup_application
|
|
52
51
|
from simtools.camera.camera_efficiency import CameraEfficiency
|
|
53
52
|
from simtools.configuration import configurator
|
|
54
53
|
|
|
55
54
|
|
|
56
|
-
def _parse(
|
|
55
|
+
def _parse():
|
|
57
56
|
"""Parse command line configuration."""
|
|
58
57
|
config = configurator.Configurator(
|
|
59
|
-
label=
|
|
58
|
+
label=get_application_label(__file__),
|
|
60
59
|
description=(
|
|
61
60
|
"Calculate the camera efficiency and NSB pixel rates. "
|
|
62
61
|
"Plot the camera efficiency vs wavelength for Cherenkov and NSB light."
|
|
@@ -91,29 +90,26 @@ def _parse(label):
|
|
|
91
90
|
action="store_true",
|
|
92
91
|
required=False,
|
|
93
92
|
)
|
|
94
|
-
|
|
93
|
+
args_dict, db_config = config.initialize(
|
|
95
94
|
db_config=True,
|
|
96
95
|
simulation_model=["telescope", "model_version", "parameter_version"],
|
|
97
96
|
simulation_configuration={"corsika_configuration": ["zenith_angle", "azimuth_angle"]},
|
|
98
97
|
)
|
|
99
|
-
if
|
|
98
|
+
if args_dict["site"] is None or args_dict["telescope"] is None:
|
|
100
99
|
config.parser.print_help()
|
|
101
100
|
print("\n\nSite and telescope must be provided\n\n")
|
|
102
101
|
raise RuntimeError("Site and telescope must be provided")
|
|
103
|
-
return
|
|
102
|
+
return args_dict, db_config
|
|
104
103
|
|
|
105
104
|
|
|
106
|
-
def main():
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
logger = logging.getLogger()
|
|
111
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
105
|
+
def main():
|
|
106
|
+
"""Calculate the camera efficiency and NSB pixel rates."""
|
|
107
|
+
app_context = startup_application(_parse)
|
|
112
108
|
|
|
113
109
|
ce = CameraEfficiency(
|
|
114
|
-
db_config=db_config,
|
|
115
|
-
label=
|
|
116
|
-
config_data=
|
|
110
|
+
db_config=app_context.db_config,
|
|
111
|
+
label=app_context.args.get("label"),
|
|
112
|
+
config_data=app_context.args,
|
|
117
113
|
)
|
|
118
114
|
ce.simulate()
|
|
119
115
|
ce.analyze(force=True)
|
|
@@ -123,13 +119,18 @@ def main(): # noqa: D103
|
|
|
123
119
|
writer.ModelDataWriter.dump_model_parameter(
|
|
124
120
|
parameter_name="nsb_pixel_rate",
|
|
125
121
|
value=ce.get_nsb_pixel_rate(
|
|
126
|
-
reference_conditions=
|
|
122
|
+
reference_conditions=app_context.args.get(
|
|
123
|
+
"write_reference_nsb_rate_as_parameter", False
|
|
124
|
+
)
|
|
125
|
+
),
|
|
126
|
+
instrument=app_context.args["telescope"],
|
|
127
|
+
parameter_version=app_context.args.get("parameter_version", "0.0.0"),
|
|
128
|
+
output_file=Path(
|
|
129
|
+
f"nsb_pixel_rate-{app_context.args.get('parameter_version', '0.0.0')}.json"
|
|
127
130
|
),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
output_path=Path(args_dict["output_path"]) / args_dict["telescope"] / "nsb_pixel_rate",
|
|
132
|
-
use_plain_output_path=args_dict.get("use_plain_output_path"),
|
|
131
|
+
output_path=app_context.io_handler.get_output_directory()
|
|
132
|
+
/ app_context.args["telescope"]
|
|
133
|
+
/ "nsb_pixel_rate",
|
|
133
134
|
)
|
|
134
135
|
|
|
135
136
|
|
|
@@ -47,19 +47,16 @@ r"""
|
|
|
47
47
|
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
|
-
import
|
|
51
|
-
from pathlib import Path
|
|
52
|
-
|
|
53
|
-
import simtools.utils.general as gen
|
|
50
|
+
from simtools.application_control import get_application_label, startup_application
|
|
54
51
|
from simtools.configuration import configurator
|
|
55
|
-
from simtools.io import io_handler
|
|
56
52
|
from simtools.model.telescope_model import TelescopeModel
|
|
57
53
|
from simtools.visualization import plot_camera, visualize
|
|
58
54
|
|
|
59
55
|
|
|
60
56
|
def _parse():
|
|
57
|
+
"""Parse command line configuration."""
|
|
61
58
|
config = configurator.Configurator(
|
|
62
|
-
label=
|
|
59
|
+
label=get_application_label(__file__),
|
|
63
60
|
description=(
|
|
64
61
|
"Calculate the camera FoV of the telescope requested. "
|
|
65
62
|
"Plot the camera, as seen for an observer facing the camera."
|
|
@@ -86,52 +83,49 @@ def _parse():
|
|
|
86
83
|
return config.initialize(db_config=True, simulation_model=["telescope", "model_version"])
|
|
87
84
|
|
|
88
85
|
|
|
89
|
-
def main():
|
|
90
|
-
|
|
86
|
+
def main():
|
|
87
|
+
"""Validate camera field of view."""
|
|
88
|
+
app_context = startup_application(_parse)
|
|
91
89
|
|
|
92
90
|
label = "validate_camera_fov"
|
|
93
91
|
|
|
94
|
-
logger = logging.getLogger()
|
|
95
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
96
|
-
|
|
97
|
-
# Output directory to save files related directly to this app
|
|
98
|
-
_io_handler = io_handler.IOHandler()
|
|
99
|
-
output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
|
|
100
|
-
|
|
101
92
|
tel_model = TelescopeModel(
|
|
102
|
-
site=
|
|
103
|
-
telescope_name=
|
|
104
|
-
mongo_db_config=db_config,
|
|
105
|
-
model_version=
|
|
93
|
+
site=app_context.args["site"],
|
|
94
|
+
telescope_name=app_context.args["telescope"],
|
|
95
|
+
mongo_db_config=app_context.db_config,
|
|
96
|
+
model_version=app_context.args["model_version"],
|
|
106
97
|
label=label,
|
|
107
98
|
)
|
|
108
99
|
tel_model.export_model_files()
|
|
109
100
|
|
|
110
|
-
|
|
101
|
+
app_context.logger.info(f"\nValidating the camera FoV of {tel_model.name}\n")
|
|
111
102
|
|
|
112
103
|
focal_length = tel_model.get_telescope_effective_focal_length("cm")
|
|
113
104
|
camera = tel_model.camera
|
|
114
105
|
|
|
115
106
|
fov, r_edge_avg = camera.calc_fov()
|
|
116
107
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
app_context.logger.info(f"\nEffective focal length = {focal_length:.3f} cm")
|
|
109
|
+
app_context.logger.info(f"{tel_model.name} FoV = {fov:.3f} deg")
|
|
110
|
+
app_context.logger.info(f"Avg. edge radius = {r_edge_avg:.3f} cm\n")
|
|
120
111
|
|
|
121
112
|
# Now plot the camera as well
|
|
122
113
|
try:
|
|
123
|
-
pixel_ids_to_print = int(
|
|
114
|
+
pixel_ids_to_print = int(app_context.args["print_pixels_id"])
|
|
124
115
|
if pixel_ids_to_print == 0:
|
|
125
116
|
pixel_ids_to_print = -1 # so not print the zero pixel
|
|
126
117
|
except ValueError as exc:
|
|
127
|
-
if
|
|
118
|
+
if app_context.args["print_pixels_id"].lower() == "all":
|
|
128
119
|
pixel_ids_to_print = camera.get_number_of_pixels()
|
|
129
120
|
else:
|
|
130
121
|
raise ValueError(
|
|
131
|
-
f"The value provided to --print_pixels_id ({
|
|
122
|
+
f"The value provided to --print_pixels_id ({app_context.args['print_pixels_id']}) "
|
|
132
123
|
"should be an integer or All"
|
|
133
124
|
) from exc
|
|
134
|
-
fig = plot_camera.plot_pixel_layout(
|
|
125
|
+
fig = plot_camera.plot_pixel_layout(
|
|
126
|
+
camera, app_context.args["camera_in_sky_coor"], pixel_ids_to_print
|
|
127
|
+
)
|
|
128
|
+
output_dir = app_context.io_handler.get_output_directory()
|
|
135
129
|
plot_file_prefix = output_dir.joinpath(f"{label}_{tel_model.name}_pixel_layout")
|
|
136
130
|
visualize.save_figure(fig, f"{plot_file_prefix!s}", log_title="camera")
|
|
137
131
|
|
|
@@ -69,25 +69,24 @@
|
|
|
69
69
|
|
|
70
70
|
"""
|
|
71
71
|
|
|
72
|
-
import logging
|
|
73
72
|
from collections import OrderedDict
|
|
74
|
-
from pathlib import Path
|
|
75
73
|
|
|
76
74
|
import astropy.units as u
|
|
77
75
|
import matplotlib.pyplot as plt
|
|
78
76
|
import numpy as np
|
|
79
77
|
|
|
80
78
|
import simtools.utils.general as gen
|
|
79
|
+
from simtools.application_control import get_application_label, startup_application
|
|
81
80
|
from simtools.configuration import configurator
|
|
82
|
-
from simtools.io import io_handler
|
|
83
81
|
from simtools.model.model_utils import initialize_simulation_models
|
|
84
82
|
from simtools.ray_tracing.ray_tracing import RayTracing
|
|
85
83
|
from simtools.visualization import visualize
|
|
86
84
|
|
|
87
85
|
|
|
88
|
-
def _parse(
|
|
86
|
+
def _parse():
|
|
87
|
+
"""Parse command line configuration."""
|
|
89
88
|
config = configurator.Configurator(
|
|
90
|
-
label=
|
|
89
|
+
label=get_application_label(__file__),
|
|
91
90
|
description=(
|
|
92
91
|
"Calculate and plot the PSF and eff. mirror area as a function of off-axis angle "
|
|
93
92
|
"of the telescope requested."
|
|
@@ -125,55 +124,47 @@ def load_data(datafile):
|
|
|
125
124
|
return data
|
|
126
125
|
|
|
127
126
|
|
|
128
|
-
def main():
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
def main():
|
|
128
|
+
"""Validate the cumulative PSF of a telescope model against data."""
|
|
129
|
+
app_context = startup_application(_parse)
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
tel_model, site_model = initialize_simulation_models(
|
|
140
|
-
label=label,
|
|
141
|
-
db_config=db_config,
|
|
142
|
-
site=args_dict["site"],
|
|
143
|
-
telescope_name=args_dict["telescope"],
|
|
144
|
-
model_version=args_dict["model_version"],
|
|
131
|
+
tel_model, site_model, _ = initialize_simulation_models(
|
|
132
|
+
label=app_context.args.get("label"),
|
|
133
|
+
db_config=app_context.db_config,
|
|
134
|
+
site=app_context.args["site"],
|
|
135
|
+
telescope_name=app_context.args["telescope"],
|
|
136
|
+
model_version=app_context.args["model_version"],
|
|
145
137
|
)
|
|
146
138
|
|
|
147
|
-
if
|
|
148
|
-
tel_model.change_multiple_parameters_from_file(
|
|
139
|
+
if app_context.args.get("telescope_model_file"):
|
|
140
|
+
tel_model.change_multiple_parameters_from_file(app_context.args["telescope_model_file"])
|
|
149
141
|
|
|
150
142
|
ray = RayTracing(
|
|
151
143
|
telescope_model=tel_model,
|
|
152
144
|
site_model=site_model,
|
|
153
|
-
simtel_path=
|
|
154
|
-
zenith_angle=
|
|
155
|
-
source_distance=
|
|
145
|
+
simtel_path=app_context.args["simtel_path"],
|
|
146
|
+
zenith_angle=app_context.args["zenith"] * u.deg,
|
|
147
|
+
source_distance=app_context.args["src_distance"] * u.km,
|
|
156
148
|
off_axis_angle=[0.0] * u.deg,
|
|
157
149
|
)
|
|
158
150
|
|
|
159
|
-
ray.simulate(test=
|
|
151
|
+
ray.simulate(test=app_context.args["test"], force=False)
|
|
160
152
|
ray.analyze(force=False)
|
|
161
153
|
|
|
162
154
|
# Plotting cumulative PSF
|
|
163
155
|
im = ray.images()[0]
|
|
164
156
|
|
|
165
|
-
|
|
157
|
+
app_context.logger.info(f"d80 in cm = {im.get_psf()}")
|
|
166
158
|
|
|
167
|
-
# Plotting cumulative PSF
|
|
168
|
-
# Measured cumulative PSF
|
|
159
|
+
# Plotting measured cumulative PSF
|
|
169
160
|
data_to_plot = OrderedDict()
|
|
170
161
|
radius = None
|
|
171
|
-
if
|
|
172
|
-
data_file = gen.find_file(
|
|
162
|
+
if app_context.args.get("data", None):
|
|
163
|
+
data_file = gen.find_file(app_context.args["data"], app_context.args["model_path"])
|
|
173
164
|
data_to_plot["measured"] = load_data(data_file)
|
|
174
165
|
radius = data_to_plot["measured"]["Radius [cm]"]
|
|
175
166
|
|
|
176
|
-
#
|
|
167
|
+
# Plotting simulated cumulative PSF
|
|
177
168
|
if radius is not None:
|
|
178
169
|
data_to_plot[r"sim$\_$telarray"] = im.get_cumulative_data(radius * u.cm)
|
|
179
170
|
else:
|
|
@@ -182,8 +173,8 @@ def main(): # noqa: D103
|
|
|
182
173
|
fig = visualize.plot_1d(data_to_plot)
|
|
183
174
|
fig.gca().set_ylim(0, 1.05)
|
|
184
175
|
|
|
185
|
-
plot_file_name = label + "_" + tel_model.name + "_cumulative_PSF"
|
|
186
|
-
plot_file =
|
|
176
|
+
plot_file_name = app_context.args.get("label") + "_" + tel_model.name + "_cumulative_PSF"
|
|
177
|
+
plot_file = app_context.io_handler.get_output_file(plot_file_name)
|
|
187
178
|
visualize.save_figure(fig, plot_file)
|
|
188
179
|
|
|
189
180
|
# Plotting image
|
|
@@ -193,8 +184,8 @@ def main(): # noqa: D103
|
|
|
193
184
|
fig.gca().add_artist(circle)
|
|
194
185
|
fig.gca().set_aspect("equal")
|
|
195
186
|
|
|
196
|
-
plot_file_name = label + "_" + tel_model.name + "_image"
|
|
197
|
-
plot_file =
|
|
187
|
+
plot_file_name = app_context.args.get("label") + "_" + tel_model.name + "_image"
|
|
188
|
+
plot_file = app_context.io_handler.get_output_file(plot_file_name)
|
|
198
189
|
visualize.save_figure(fig, plot_file)
|
|
199
190
|
|
|
200
191
|
|
|
@@ -32,41 +32,31 @@ r"""
|
|
|
32
32
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
|
-
import logging
|
|
36
35
|
import re
|
|
37
36
|
from pathlib import Path
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
from simtools.application_control import get_application_label, startup_application
|
|
40
39
|
from simtools.configuration import configurator
|
|
41
40
|
from simtools.constants import MODEL_PARAMETER_SCHEMA_PATH
|
|
42
41
|
from simtools.data_model import metadata_collector, schema, validate_data
|
|
43
42
|
from simtools.io import ascii_handler
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
def _parse(
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-------
|
|
59
|
-
config (Configurator)
|
|
60
|
-
application configuration
|
|
61
|
-
|
|
62
|
-
"""
|
|
63
|
-
config = configurator.Configurator(label=label, description=description)
|
|
64
|
-
group = config.parser.add_mutually_exclusive_group(required=True)
|
|
65
|
-
group.add_argument("--file_name", help="File to be validated")
|
|
66
|
-
group.add_argument(
|
|
45
|
+
def _parse():
|
|
46
|
+
"""Parse command line configuration."""
|
|
47
|
+
config = configurator.Configurator(
|
|
48
|
+
label=get_application_label(__file__),
|
|
49
|
+
description="Validate a file (metadata, schema, or data file) using a schema.",
|
|
50
|
+
)
|
|
51
|
+
config.parser.add_argument(
|
|
52
|
+
"--file_name",
|
|
53
|
+
help="File to be validated (full path or name pattern, e.g., '*.json')",
|
|
54
|
+
default="*.json",
|
|
55
|
+
)
|
|
56
|
+
config.parser.add_argument(
|
|
67
57
|
"--file_directory",
|
|
68
58
|
help=(
|
|
69
|
-
"Directory with
|
|
59
|
+
"Directory with files to be validated. "
|
|
70
60
|
"If no schema file is provided, the assumption is that model "
|
|
71
61
|
"parameters are validated and the schema files are taken from "
|
|
72
62
|
f"{MODEL_PARAMETER_SCHEMA_PATH}."
|
|
@@ -84,6 +74,11 @@ def _parse(label, description):
|
|
|
84
74
|
help="Require exact data type for validation",
|
|
85
75
|
action="store_true",
|
|
86
76
|
)
|
|
77
|
+
config.parser.add_argument(
|
|
78
|
+
"--ignore_software_version",
|
|
79
|
+
help="Ignore software version check.",
|
|
80
|
+
action="store_true",
|
|
81
|
+
)
|
|
87
82
|
return config.initialize(paths=False)
|
|
88
83
|
|
|
89
84
|
|
|
@@ -115,11 +110,11 @@ def _get_schema_file_name(args_dict, data_dict=None):
|
|
|
115
110
|
return schema_file
|
|
116
111
|
|
|
117
112
|
|
|
118
|
-
def
|
|
119
|
-
"""Return list of
|
|
113
|
+
def _get_file_list(file_directory=None, file_name="*.json"):
|
|
114
|
+
"""Return list of files in a directory."""
|
|
120
115
|
file_list = []
|
|
121
116
|
if file_directory is not None:
|
|
122
|
-
file_list = list(Path(file_directory).rglob(
|
|
117
|
+
file_list = list(Path(file_directory).rglob(file_name))
|
|
123
118
|
if not file_list:
|
|
124
119
|
raise FileNotFoundError(f"No files found in {file_directory}")
|
|
125
120
|
elif file_name is not None:
|
|
@@ -137,9 +132,7 @@ def validate_dict_using_schema(args_dict, logger):
|
|
|
137
132
|
the metadata section of the data dictionary.
|
|
138
133
|
|
|
139
134
|
"""
|
|
140
|
-
for file_name in
|
|
141
|
-
args_dict.get("file_directory"), args_dict.get("file_name")
|
|
142
|
-
):
|
|
135
|
+
for file_name in _get_file_list(args_dict.get("file_directory"), args_dict.get("file_name")):
|
|
143
136
|
try:
|
|
144
137
|
data = ascii_handler.collect_data_from_file(file_name=file_name)
|
|
145
138
|
except FileNotFoundError as exc:
|
|
@@ -148,7 +141,9 @@ def validate_dict_using_schema(args_dict, logger):
|
|
|
148
141
|
try:
|
|
149
142
|
for data_dict in data:
|
|
150
143
|
schema.validate_dict_using_schema(
|
|
151
|
-
data_dict,
|
|
144
|
+
data_dict,
|
|
145
|
+
_get_schema_file_name(args_dict, data_dict),
|
|
146
|
+
ignore_software_version=args_dict.get("ignore_software_version", False),
|
|
152
147
|
)
|
|
153
148
|
except Exception as exc:
|
|
154
149
|
raise ValueError(f"Validation of file {file_name} failed") from exc
|
|
@@ -159,7 +154,7 @@ def validate_data_files(args_dict, logger):
|
|
|
159
154
|
"""Validate data files."""
|
|
160
155
|
if args_dict.get("file_directory") is not None:
|
|
161
156
|
tmp_args_dict = {}
|
|
162
|
-
for file_name in
|
|
157
|
+
for file_name in _get_file_list(args_dict.get("file_directory")):
|
|
163
158
|
tmp_args_dict["file_name"] = file_name
|
|
164
159
|
parameter_name = re.sub(r"-\d+\.\d+\.\d+", "", file_name.stem)
|
|
165
160
|
schema_file = schema.get_model_parameter_schema_file(f"{parameter_name}")
|
|
@@ -192,21 +187,16 @@ def validate_metadata(args_dict, logger):
|
|
|
192
187
|
logger.info(f"Successful validation of metadata {args_dict['file_name']}")
|
|
193
188
|
|
|
194
189
|
|
|
195
|
-
def main():
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
label, description="Validate a file (metadata, schema, or data file) using a schema."
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
logger = logging.getLogger()
|
|
202
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
190
|
+
def main():
|
|
191
|
+
"""Validate a file or files in a directory using a schema."""
|
|
192
|
+
app_context = startup_application(_parse)
|
|
203
193
|
|
|
204
|
-
if
|
|
205
|
-
validate_metadata(
|
|
206
|
-
elif
|
|
207
|
-
validate_dict_using_schema(
|
|
194
|
+
if app_context.args["data_type"].lower() == "metadata":
|
|
195
|
+
validate_metadata(app_context.args, app_context.logger)
|
|
196
|
+
elif app_context.args["data_type"].lower() == "schema":
|
|
197
|
+
validate_dict_using_schema(app_context.args, app_context.logger)
|
|
208
198
|
else:
|
|
209
|
-
validate_data_files(
|
|
199
|
+
validate_data_files(app_context.args, app_context.logger)
|
|
210
200
|
|
|
211
201
|
|
|
212
202
|
if __name__ == "__main__":
|