gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gammasimtools-0.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -1,35 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
-------
|
|
6
|
-
This application is used to run simulations for productions (typically on the grid).
|
|
7
|
-
It allows to run a Paranal (CTAO-South) or La Palma (CTAO-North) array layout simulation
|
|
8
|
-
with the provided "prod_tag" simulation configuration (e.g., Prod6)
|
|
9
|
-
for a given primary particle, azimuth, and zenith angle.
|
|
3
|
+
r"""
|
|
4
|
+
Generate simulation configuration and run simulations (if required).
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
This script produces all the necessary configuration files for CORSIKA and
|
|
14
|
-
sim_telarray before running simulation.
|
|
15
|
-
The multipipe scripts will be produced as part of this script.
|
|
6
|
+
Multipipe scripts will be produced as part of this application.
|
|
7
|
+
Allows to run array layout simulation including shower and detector simulations
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
The entire simulation chain, parts of it, or nothing is executed:
|
|
10
|
+
|
|
11
|
+
- shower simulations with CORSIKA only
|
|
12
|
+
- shower simulations with CORSIKA which are piped directly to sim_telarray using
|
|
13
|
+
the sim_telarray multipipe mechanism.
|
|
20
14
|
|
|
21
15
|
Command line arguments
|
|
22
16
|
----------------------
|
|
23
|
-
production_config (str, Path, required)
|
|
24
|
-
Simulation configuration file
|
|
25
|
-
(contains the default setup which can be overwritten by the command line options).
|
|
26
17
|
model_version (str, required)
|
|
27
|
-
The telescope model version to use (e.g.,
|
|
18
|
+
The telescope model version to use (e.g., 5.0.0).
|
|
28
19
|
site (str, required)
|
|
29
20
|
North or South (case insensitive).
|
|
30
21
|
primary (str, required)
|
|
31
|
-
Name of the primary particle to simulate.
|
|
32
|
-
|
|
22
|
+
Name or ID of the primary particle to simulate. Allowed are common names like gamma, proton,
|
|
23
|
+
or IDs for CORSIKA7 (e.g. 14 for proton) and PDG (e.g. 2212 for proton). Use the
|
|
24
|
+
'primary_id_type' option to specify the type of ID.
|
|
33
25
|
azimuth_angle (str or float, required)
|
|
34
26
|
Telescope pointing direction in azimuth.
|
|
35
27
|
It can be in degrees between 0 and 360 or one of north, south, east or west
|
|
@@ -50,10 +42,10 @@
|
|
|
50
42
|
data_directory (str, optional)
|
|
51
43
|
The location of the output directories corsika-data and simtel-data.
|
|
52
44
|
the label is added to the data_directory, such that the output
|
|
53
|
-
will be written to
|
|
45
|
+
will be written to data_directory/label/simtel-data.
|
|
54
46
|
pack_for_grid_register (bool, optional)
|
|
55
47
|
Set whether to prepare a tarball for registering the output files on the grid.
|
|
56
|
-
The files are written to the
|
|
48
|
+
The files are written to the output_path/directory_for_grid_upload directory.
|
|
57
49
|
log_level (str, optional)
|
|
58
50
|
Log level to print.
|
|
59
51
|
|
|
@@ -63,35 +55,16 @@
|
|
|
63
55
|
|
|
64
56
|
.. code-block:: console
|
|
65
57
|
|
|
66
|
-
simtools-simulate-prod
|
|
67
|
-
--
|
|
68
|
-
--
|
|
69
|
-
--start_run 0 --run 1
|
|
58
|
+
simtools-simulate-prod \\
|
|
59
|
+
--model_version 5.0.0 --site north --primary gamma --azimuth_angle north \\
|
|
60
|
+
--zenith_angle 20 --start_run 0 --run 1
|
|
70
61
|
|
|
71
62
|
By default the configuration is saved in simtools-output/test-production
|
|
72
63
|
together with the actual simulation output in corsika-data and simtel-data within.
|
|
73
64
|
The location of the latter directories can be set
|
|
74
65
|
to a different location via the option --data_directory,
|
|
75
66
|
but the label is always added to the data_directory, such that the output
|
|
76
|
-
will be written to
|
|
77
|
-
|
|
78
|
-
Expected final print-out message:
|
|
79
|
-
|
|
80
|
-
.. code-block:: console
|
|
81
|
-
|
|
82
|
-
INFO::array_layout(l569)::read_telescope_list_file::Reading array elements from ...
|
|
83
|
-
WARNING::corsika_runner(l127)::_load_corsika_config_data::data_directory not given
|
|
84
|
-
in corsika_config - default output directory will be set.
|
|
85
|
-
INFO::array_layout(l569)::read_telescope_list_file::Reading array elements from ...
|
|
86
|
-
INFO::corsika_config(l493)::_set_output_file_and_directory::Creating directory
|
|
87
|
-
INFO::simulator(l405)::simulate::Submission command: local
|
|
88
|
-
INFO::simulator(l410)::simulate::Starting submission for 1 run
|
|
89
|
-
INFO::array_model(l315)::export_simtel_array_config_file::Writing array config file into
|
|
90
|
-
INFO::job_manager(l95)::submit::Submitting script
|
|
91
|
-
INFO::job_manager(l96)::submit::Job output stream
|
|
92
|
-
INFO::job_manager(l97)::submit::Job error stream
|
|
93
|
-
INFO::job_manager(l98)::submit::Job log stream
|
|
94
|
-
INFO::job_manager(l119)::_submit_local::Running script locally
|
|
67
|
+
will be written to data_directory/label/simtel-data.
|
|
95
68
|
"""
|
|
96
69
|
|
|
97
70
|
import logging
|
|
@@ -99,22 +72,19 @@ import shutil
|
|
|
99
72
|
import tarfile
|
|
100
73
|
from pathlib import Path
|
|
101
74
|
|
|
102
|
-
from astropy.io.misc import yaml
|
|
103
|
-
|
|
104
75
|
import simtools.utils.general as gen
|
|
105
76
|
from simtools.configuration import configurator
|
|
106
|
-
from simtools.configuration.commandline_parser import CommandLineParser
|
|
107
77
|
from simtools.simulator import Simulator
|
|
108
78
|
|
|
109
79
|
|
|
110
80
|
def _parse(description=None):
|
|
111
81
|
"""
|
|
112
|
-
Parse
|
|
82
|
+
Parse command line configuration.
|
|
113
83
|
|
|
114
84
|
Parameters
|
|
115
85
|
----------
|
|
116
86
|
description: str
|
|
117
|
-
|
|
87
|
+
Application description.
|
|
118
88
|
|
|
119
89
|
Returns
|
|
120
90
|
-------
|
|
@@ -122,165 +92,117 @@ def _parse(description=None):
|
|
|
122
92
|
Command line parser object.
|
|
123
93
|
|
|
124
94
|
"""
|
|
125
|
-
|
|
126
95
|
config = configurator.Configurator(description=description)
|
|
127
96
|
config.parser.add_argument(
|
|
128
|
-
"--
|
|
97
|
+
"--data_directory",
|
|
129
98
|
help=(
|
|
130
|
-
"
|
|
131
|
-
"
|
|
99
|
+
"The directory where to save the corsika-data and simtel-data output directories."
|
|
100
|
+
"the label is added to the data_directory, such that the output"
|
|
101
|
+
"will be written to data_directory/label/simtel-data."
|
|
132
102
|
),
|
|
133
|
-
type=str,
|
|
134
|
-
required=True,
|
|
135
|
-
)
|
|
136
|
-
config.parser.add_argument(
|
|
137
|
-
"--primary",
|
|
138
|
-
help="Primary particle to simulate.",
|
|
139
103
|
type=str.lower,
|
|
140
|
-
required=
|
|
141
|
-
|
|
142
|
-
"gamma",
|
|
143
|
-
"gamma_diffuse",
|
|
144
|
-
"electron",
|
|
145
|
-
"proton",
|
|
146
|
-
"muon",
|
|
147
|
-
"helium",
|
|
148
|
-
"nitrogen",
|
|
149
|
-
"silicon",
|
|
150
|
-
"iron",
|
|
151
|
-
],
|
|
152
|
-
)
|
|
153
|
-
config.parser.add_argument(
|
|
154
|
-
"--azimuth_angle",
|
|
155
|
-
help=(
|
|
156
|
-
"Telescope pointing direction in azimuth. "
|
|
157
|
-
"It can be in degrees between 0 and 360 or one of north, south, east or west "
|
|
158
|
-
"(case insensitive). Note that North is 0 degrees and "
|
|
159
|
-
"the azimuth grows clockwise, so East is 90 degrees."
|
|
160
|
-
),
|
|
161
|
-
type=CommandLineParser.azimuth_angle,
|
|
162
|
-
required=True,
|
|
163
|
-
)
|
|
164
|
-
config.parser.add_argument(
|
|
165
|
-
"--zenith_angle",
|
|
166
|
-
help="Zenith angle in degrees (between 0 and 180).",
|
|
167
|
-
type=CommandLineParser.zenith_angle,
|
|
168
|
-
required=True,
|
|
104
|
+
required=False,
|
|
105
|
+
default="./simtools-output/",
|
|
169
106
|
)
|
|
170
107
|
config.parser.add_argument(
|
|
171
|
-
"--
|
|
172
|
-
help="
|
|
173
|
-
|
|
108
|
+
"--pack_for_grid_register",
|
|
109
|
+
help="Set whether to prepare a tarball for registering the output files on the grid.",
|
|
110
|
+
action="store_true",
|
|
174
111
|
required=False,
|
|
112
|
+
default=False,
|
|
175
113
|
)
|
|
176
114
|
config.parser.add_argument(
|
|
177
|
-
"--
|
|
178
|
-
help=
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
"repetition."
|
|
183
|
-
),
|
|
184
|
-
type=int,
|
|
185
|
-
required=True,
|
|
115
|
+
"--save_file_lists",
|
|
116
|
+
help="Save lists of output and log files.",
|
|
117
|
+
action="store_true",
|
|
118
|
+
required=False,
|
|
119
|
+
default=False,
|
|
186
120
|
)
|
|
187
121
|
config.parser.add_argument(
|
|
188
|
-
"--
|
|
189
|
-
help="
|
|
190
|
-
|
|
191
|
-
required=
|
|
122
|
+
"--corsika_test_seeds",
|
|
123
|
+
help="Use predefined random seeds for CORSIKA for testing purposes.",
|
|
124
|
+
action="store_true",
|
|
125
|
+
required=False,
|
|
126
|
+
default=False,
|
|
192
127
|
)
|
|
193
128
|
config.parser.add_argument(
|
|
194
|
-
"--
|
|
129
|
+
"--sim_telarray_seeds",
|
|
195
130
|
help=(
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"will be written to `data_directory/label/simtel-data`."
|
|
131
|
+
"Use the provided random seed for sim_telarray instrument setup."
|
|
132
|
+
"Used only for testing purposes for now."
|
|
199
133
|
),
|
|
200
|
-
type=str
|
|
134
|
+
type=str,
|
|
201
135
|
required=False,
|
|
202
|
-
default="./simtools-output/",
|
|
203
136
|
)
|
|
204
|
-
config.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
default=False,
|
|
137
|
+
return config.initialize(
|
|
138
|
+
db_config=True,
|
|
139
|
+
job_submission=True,
|
|
140
|
+
simulation_model=["site", "layout", "telescope"],
|
|
141
|
+
simulation_configuration={"software": None, "corsika_configuration": ["all"]},
|
|
210
142
|
)
|
|
211
|
-
return config.initialize(db_config=True, telescope_model=True)
|
|
212
143
|
|
|
213
144
|
|
|
214
|
-
def
|
|
215
|
-
|
|
145
|
+
def pack_for_register(logger, simulator, args_dict):
|
|
146
|
+
"""
|
|
147
|
+
Pack the output files for registering on the grid.
|
|
216
148
|
|
|
217
|
-
|
|
218
|
-
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
logger: logging.Logger
|
|
152
|
+
Logger object.
|
|
153
|
+
simulator: Simulator
|
|
154
|
+
Simulator object.
|
|
219
155
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
156
|
+
"""
|
|
157
|
+
logger.info("Packing the output files for registering on the grid")
|
|
158
|
+
output_files = simulator.get_file_list(file_type="output")
|
|
159
|
+
log_files = simulator.get_file_list(file_type="log")
|
|
160
|
+
histogram_files = simulator.get_file_list(file_type="hist")
|
|
161
|
+
tar_file_name = Path(log_files[0]).name.replace("log.gz", "log_hist.tar.gz")
|
|
162
|
+
directory_for_grid_upload = Path(args_dict.get("output_path")).joinpath(
|
|
163
|
+
"directory_for_grid_upload"
|
|
164
|
+
)
|
|
165
|
+
directory_for_grid_upload.mkdir(parents=True, exist_ok=True)
|
|
166
|
+
tar_file_name = directory_for_grid_upload.joinpath(tar_file_name)
|
|
167
|
+
|
|
168
|
+
with tarfile.open(tar_file_name, "w:gz") as tar:
|
|
169
|
+
files_to_tar = log_files[:1] + histogram_files[:1]
|
|
170
|
+
for file_to_tar in files_to_tar:
|
|
171
|
+
tar.add(file_to_tar, arcname=Path(file_to_tar).name)
|
|
228
172
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
173
|
+
for file_to_move in [*output_files]:
|
|
174
|
+
source_file = Path(file_to_move)
|
|
175
|
+
destination_file = directory_for_grid_upload / source_file.name
|
|
176
|
+
# Note that this will overwrite previous files which exist in the directory
|
|
177
|
+
# It should be fine for normal production since each run is on a separate node
|
|
178
|
+
# so no files are expected there.
|
|
179
|
+
shutil.move(source_file, destination_file)
|
|
180
|
+
logger.info(f"Output files for the grid placed in {directory_for_grid_upload!s}")
|
|
237
181
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
182
|
+
|
|
183
|
+
def main(): # noqa: D103
|
|
184
|
+
args_dict, db_config = _parse(description="Run simulations for productions")
|
|
185
|
+
|
|
186
|
+
logger = logging.getLogger()
|
|
187
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
242
188
|
|
|
243
189
|
simulator = Simulator(
|
|
244
|
-
label=label,
|
|
245
|
-
simulator="corsika_simtel",
|
|
246
|
-
simulator_source_path=args_dict["simtel_path"],
|
|
247
|
-
config_data=config_data,
|
|
248
|
-
submit_command="local",
|
|
249
|
-
test=args_dict["test"],
|
|
250
|
-
mongo_db_config=db_config,
|
|
190
|
+
label=args_dict.get("label"), args_dict=args_dict, mongo_db_config=db_config
|
|
251
191
|
)
|
|
252
192
|
|
|
253
193
|
simulator.simulate()
|
|
254
194
|
|
|
255
195
|
logger.info(
|
|
256
|
-
f"Production run is complete for primary {
|
|
257
|
-
f"coming from {
|
|
258
|
-
f"{
|
|
259
|
-
f"using the {
|
|
196
|
+
f"Production run is complete for primary {args_dict['primary']} showers "
|
|
197
|
+
f"coming from {args_dict['azimuth_angle']} azimuth and zenith angle of "
|
|
198
|
+
f"{args_dict['zenith_angle']} at the {args_dict['site']} site, "
|
|
199
|
+
f"using the {args_dict['model_version']} simulation model."
|
|
260
200
|
)
|
|
261
201
|
|
|
262
202
|
if args_dict["pack_for_grid_register"]:
|
|
263
|
-
logger
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
histogram_files = simulator.get_list_of_histogram_files()
|
|
267
|
-
tar_file_name = Path(log_files[0]).name.replace("log.gz", "log_hist.tar.gz")
|
|
268
|
-
with tarfile.open(tar_file_name, "w:gz") as tar:
|
|
269
|
-
files_to_tar = log_files[:1] + histogram_files[:1]
|
|
270
|
-
for file_to_tar in files_to_tar:
|
|
271
|
-
tar.add(file_to_tar, arcname=Path(file_to_tar).name)
|
|
272
|
-
directory_for_grid_upload = Path(args_dict.get("output_path")).joinpath(
|
|
273
|
-
"directory_for_grid_upload"
|
|
274
|
-
)
|
|
275
|
-
directory_for_grid_upload.mkdir(parents=True, exist_ok=True)
|
|
276
|
-
for file_to_move in [*output_files, tar_file_name]:
|
|
277
|
-
source_file = Path(file_to_move)
|
|
278
|
-
destination_file = directory_for_grid_upload / source_file.name
|
|
279
|
-
# Note that this will overwrite previous files which exist in the directory
|
|
280
|
-
# It should be fine for normal production since each run is on a separate node
|
|
281
|
-
# so no files are expected there.
|
|
282
|
-
shutil.move(source_file, destination_file)
|
|
283
|
-
logger.info(f"Output files for the grid placed in {str(directory_for_grid_upload)}")
|
|
203
|
+
pack_for_register(logger, simulator, args_dict)
|
|
204
|
+
if args_dict["save_file_lists"]:
|
|
205
|
+
simulator.save_file_lists()
|
|
284
206
|
|
|
285
207
|
|
|
286
208
|
if __name__ == "__main__":
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
|
-
"""
|
|
3
|
-
|
|
4
|
-
-------
|
|
5
|
-
Submit model parameter (value, table) through the command line.
|
|
2
|
+
r"""
|
|
3
|
+
Submit data file through the command line.
|
|
6
4
|
|
|
7
5
|
Input data and metadata is validated, and if necessary enriched
|
|
8
6
|
and converted following a pre-described schema.
|
|
@@ -23,17 +21,17 @@
|
|
|
23
21
|
|
|
24
22
|
.. code-block:: console
|
|
25
23
|
|
|
26
|
-
simtools-submit-data-from-external
|
|
27
|
-
--input_meta ./tests/resources/MLTdata-preproduction.meta.yml
|
|
28
|
-
--input ./tests/resources/MLTdata-preproduction.ecsv
|
|
29
|
-
--schema ./tests/resources/schema_MST_mirror_2f_measurements.yml
|
|
24
|
+
simtools-submit-data-from-external \\
|
|
25
|
+
--input_meta ./tests/resources/MLTdata-preproduction.meta.yml \\
|
|
26
|
+
--input ./tests/resources/MLTdata-preproduction.ecsv \\
|
|
27
|
+
--schema ./tests/resources/schema_MST_mirror_2f_measurements.yml \\
|
|
30
28
|
--output_file TEST-submit_data_from_external.ecsv
|
|
31
29
|
|
|
32
30
|
Expected final print-out message:
|
|
33
31
|
|
|
34
32
|
.. code-block:: console
|
|
35
33
|
|
|
36
|
-
INFO::model_data_writer(l70)::write_data::Writing data to
|
|
34
|
+
INFO::model_data_writer(l70)::write_data::Writing data to \\
|
|
37
35
|
/simtools/simtools-output/d-2023-07-31/TEST-submit_data_from_external.ecsv
|
|
38
36
|
|
|
39
37
|
"""
|
|
@@ -50,7 +48,7 @@ from simtools.data_model.metadata_collector import MetadataCollector
|
|
|
50
48
|
|
|
51
49
|
def _parse(label, description):
|
|
52
50
|
"""
|
|
53
|
-
Parse command line configuration
|
|
51
|
+
Parse command line configuration.
|
|
54
52
|
|
|
55
53
|
Parameters
|
|
56
54
|
----------
|
|
@@ -65,7 +63,6 @@ def _parse(label, description):
|
|
|
65
63
|
Command line parser object
|
|
66
64
|
|
|
67
65
|
"""
|
|
68
|
-
|
|
69
66
|
config = configurator.Configurator(label=label, description=description)
|
|
70
67
|
|
|
71
68
|
config.parser.add_argument(
|
|
@@ -89,7 +86,7 @@ def _parse(label, description):
|
|
|
89
86
|
return config.initialize(output=True)
|
|
90
87
|
|
|
91
88
|
|
|
92
|
-
def main():
|
|
89
|
+
def main(): # noqa: D103
|
|
93
90
|
args_dict, _ = _parse(
|
|
94
91
|
label=Path(__file__).stem,
|
|
95
92
|
description="Submit and validate data (e.g., input data to tools, model parameters).",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
r"""
|
|
3
|
+
Submit a model parameter value and corresponding metadata through the command line.
|
|
4
|
+
|
|
5
|
+
Input and metadata is validated, and if necessary enriched and converted following
|
|
6
|
+
the model parameter schemas. Model parameter data is written in the simtools-style
|
|
7
|
+
json format, metadata as a yaml file.
|
|
8
|
+
|
|
9
|
+
Command line arguments
|
|
10
|
+
----------------------
|
|
11
|
+
parameter (str)
|
|
12
|
+
model parameter name
|
|
13
|
+
value (str, value)
|
|
14
|
+
input value (number, string, string-type lists)
|
|
15
|
+
instrument (str)
|
|
16
|
+
instrument name.
|
|
17
|
+
site (str)
|
|
18
|
+
site location.
|
|
19
|
+
model_version (str)
|
|
20
|
+
Model version.
|
|
21
|
+
input_meta (str, optional)
|
|
22
|
+
input meta data file (yml format)
|
|
23
|
+
|
|
24
|
+
Example
|
|
25
|
+
-------
|
|
26
|
+
|
|
27
|
+
Submit the number of gains for the LSTN-design readout chain:
|
|
28
|
+
|
|
29
|
+
.. code-block:: console
|
|
30
|
+
|
|
31
|
+
simtools-submit-model-parameter-from-external \
|
|
32
|
+
--parameter num_gains \\
|
|
33
|
+
--value 2 \\
|
|
34
|
+
--instrument LSTN-design \\
|
|
35
|
+
--site North \\
|
|
36
|
+
--model_version 6.0.0 \\
|
|
37
|
+
--input_meta num_gains.metadata.yml
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
import logging
|
|
42
|
+
from pathlib import Path
|
|
43
|
+
|
|
44
|
+
import simtools.data_model.model_data_writer as writer
|
|
45
|
+
import simtools.utils.general as gen
|
|
46
|
+
from simtools.configuration import configurator
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _parse(label, description):
|
|
50
|
+
"""
|
|
51
|
+
Parse command line configuration.
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
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)
|
|
67
|
+
|
|
68
|
+
config.parser.add_argument(
|
|
69
|
+
"--parameter", type=str, required=True, help="Parameter for simulation model"
|
|
70
|
+
)
|
|
71
|
+
config.parser.add_argument("--instrument", type=str, required=True, help="Instrument name")
|
|
72
|
+
config.parser.add_argument("--site", type=str, required=True, help="Site location")
|
|
73
|
+
config.parser.add_argument("--model_version", type=str, required=True, help="Model version")
|
|
74
|
+
|
|
75
|
+
config.parser.add_argument(
|
|
76
|
+
"--value",
|
|
77
|
+
type=str,
|
|
78
|
+
required=True,
|
|
79
|
+
help=(
|
|
80
|
+
"Model parameter value. "
|
|
81
|
+
"Can be a single number, a number with a unit, or a list of values with units. "
|
|
82
|
+
'Examples: "--value=5", "--value=\'5 km\'", "--value=\'5 cm, 0.5 deg\'"'
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
config.parser.add_argument(
|
|
87
|
+
"--input_meta",
|
|
88
|
+
help="meta data file associated to input data",
|
|
89
|
+
type=str,
|
|
90
|
+
required=False,
|
|
91
|
+
)
|
|
92
|
+
return config.initialize(output=True)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def main(): # noqa: D103
|
|
96
|
+
args_dict, _ = _parse(
|
|
97
|
+
label=Path(__file__).stem,
|
|
98
|
+
description="Submit and validate a model parameters).",
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
logger = logging.getLogger()
|
|
102
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
103
|
+
|
|
104
|
+
output_path = (
|
|
105
|
+
Path(args_dict["output_path"]) / args_dict["model_version"] / args_dict["instrument"]
|
|
106
|
+
if args_dict.get("output_path")
|
|
107
|
+
else None
|
|
108
|
+
)
|
|
109
|
+
writer.ModelDataWriter.dump_model_parameter(
|
|
110
|
+
parameter_name=args_dict["parameter"],
|
|
111
|
+
value=args_dict["value"],
|
|
112
|
+
instrument=args_dict["instrument"],
|
|
113
|
+
model_version=args_dict["model_version"],
|
|
114
|
+
output_file=Path(args_dict["parameter"]).with_suffix(".json"),
|
|
115
|
+
output_path=output_path,
|
|
116
|
+
use_plain_output_path=args_dict.get("use_plain_output_path"),
|
|
117
|
+
metadata_input_dict=args_dict,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
if __name__ == "__main__":
|
|
122
|
+
main()
|