gammasimtools 0.8.1__py3-none-any.whl → 0.9.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.8.1.dist-info → gammasimtools-0.9.0.dist-info}/METADATA +4 -3
- gammasimtools-0.9.0.dist-info/RECORD +350 -0
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/entry_points.txt +2 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/convert_all_model_parameters_from_simtel.py +1 -1
- simtools/applications/convert_geo_coordinates_of_array_elements.py +8 -9
- simtools/applications/convert_model_parameter_from_simtel.py +1 -1
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +2 -10
- simtools/applications/db_add_value_from_json_to_db.py +1 -9
- simtools/applications/db_get_array_layouts_from_db.py +3 -1
- simtools/applications/db_get_parameter_from_db.py +1 -1
- simtools/applications/derive_mirror_rnda.py +10 -1
- simtools/applications/derive_psf_parameters.py +1 -1
- simtools/applications/generate_array_config.py +1 -5
- simtools/applications/generate_regular_arrays.py +9 -6
- simtools/applications/generate_simtel_array_histograms.py +1 -1
- simtools/applications/plot_array_layout.py +3 -1
- simtools/applications/plot_tabular_data.py +84 -0
- simtools/applications/production_scale_events.py +1 -2
- simtools/applications/simulate_light_emission.py +2 -2
- simtools/applications/simulate_prod.py +24 -59
- simtools/applications/simulate_prod_htcondor_generator.py +95 -0
- simtools/applications/submit_data_from_external.py +1 -1
- simtools/applications/validate_camera_efficiency.py +1 -1
- simtools/applications/validate_camera_fov.py +4 -8
- simtools/applications/validate_cumulative_psf.py +3 -7
- simtools/applications/validate_file_using_schema.py +31 -23
- simtools/applications/validate_optics.py +3 -4
- simtools/camera_efficiency.py +1 -4
- simtools/configuration/commandline_parser.py +9 -15
- simtools/configuration/configurator.py +6 -19
- simtools/constants.py +3 -3
- simtools/data_model/metadata_collector.py +19 -1
- simtools/data_model/metadata_model.py +18 -5
- simtools/data_model/model_data_writer.py +1 -1
- simtools/data_model/validate_data.py +67 -10
- simtools/db/db_handler.py +92 -315
- simtools/io_operations/legacy_data_handler.py +61 -0
- simtools/job_execution/htcondor_script_generator.py +133 -0
- simtools/job_execution/job_manager.py +77 -50
- simtools/model/array_model.py +30 -26
- simtools/model/calibration_model.py +10 -10
- simtools/model/camera.py +79 -63
- simtools/model/mirrors.py +8 -6
- simtools/model/model_parameter.py +42 -12
- simtools/model/model_utils.py +6 -6
- simtools/model/site_model.py +2 -2
- simtools/model/telescope_model.py +26 -22
- simtools/ray_tracing/mirror_panel_psf.py +47 -27
- simtools/runners/corsika_runner.py +14 -3
- simtools/runners/runner_services.py +3 -3
- simtools/runners/simtel_runner.py +27 -8
- simtools/schemas/integration_tests_config.metaschema.yml +15 -5
- simtools/schemas/model_parameter.metaschema.yml +90 -2
- simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
- simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
- simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +1 -1
- simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
- simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/design_model.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +1 -1
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +32 -2
- simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
- simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/led_events.schema.yml +1 -1
- simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
- simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +1 -1
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
- simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
- simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
- simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
- simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
- simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
- simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
- simtools/simtel/simtel_table_reader.py +410 -0
- simtools/simtel/simulator_camera_efficiency.py +6 -4
- simtools/simtel/simulator_light_emission.py +2 -2
- simtools/simtel/simulator_ray_tracing.py +1 -2
- simtools/simulator.py +80 -33
- simtools/testing/configuration.py +12 -8
- simtools/testing/helpers.py +5 -5
- simtools/testing/validate_output.py +28 -28
- simtools/utils/general.py +50 -3
- simtools/utils/names.py +3 -4
- simtools/utils/value_conversion.py +9 -1
- simtools/version.py +1 -1
- simtools/visualization/plot_tables.py +106 -0
- simtools/visualization/visualize.py +43 -5
- gammasimtools-0.8.1.dist-info/RECORD +0 -346
- simtools/_dev_version/scm_version.py +0 -10
- simtools/db/db_from_repo_handler.py +0 -106
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/LICENSE +0 -0
- {gammasimtools-0.8.1.dist-info → gammasimtools-0.9.0.dist-info}/top_level.txt +0 -0
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
The applications generates the sim_telarray configuration files for a given array, site,
|
|
6
6
|
and model_version using the model parameters stored in the database.
|
|
7
7
|
|
|
8
|
-
To change model parameters, clone the model parameters repository and apply the changes.
|
|
9
|
-
Forward the path to the repository to the application using the ``--db_simulation_model_url``
|
|
10
|
-
argument.
|
|
11
|
-
|
|
12
8
|
Command line arguments
|
|
13
9
|
----------------------
|
|
14
10
|
site : str
|
|
@@ -54,7 +50,7 @@ def _parse(label, description):
|
|
|
54
50
|
Command line parser object.
|
|
55
51
|
"""
|
|
56
52
|
config = configurator.Configurator(label=label, description=description)
|
|
57
|
-
return config.initialize(db_config=True, simulation_model=["site", "layout"])
|
|
53
|
+
return config.initialize(db_config=True, simulation_model=["site", "layout", "model_version"])
|
|
58
54
|
|
|
59
55
|
|
|
60
56
|
def main():
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
import logging
|
|
28
|
-
import os
|
|
29
28
|
from pathlib import Path
|
|
30
29
|
|
|
31
30
|
import astropy.units as u
|
|
@@ -52,7 +51,9 @@ def _parse():
|
|
|
52
51
|
f" SST: {telescope_distance['SST']}\n"
|
|
53
52
|
),
|
|
54
53
|
)
|
|
55
|
-
return config.initialize(
|
|
54
|
+
return config.initialize(
|
|
55
|
+
db_config=False, simulation_model=["site", "model_version"], output=True
|
|
56
|
+
)
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
def main():
|
|
@@ -101,10 +102,12 @@ def main():
|
|
|
101
102
|
table.sort("telescope_name")
|
|
102
103
|
table.pprint()
|
|
103
104
|
|
|
104
|
-
output_file = args_dict.get("output_file"
|
|
105
|
-
if output_file
|
|
106
|
-
|
|
107
|
-
output_file =
|
|
105
|
+
output_file = args_dict.get("output_file")
|
|
106
|
+
if output_file:
|
|
107
|
+
output_path = Path(output_file)
|
|
108
|
+
output_file = output_path.with_name(
|
|
109
|
+
f"{output_path.stem}-{args_dict['site']}-{array_name}{output_path.suffix}"
|
|
110
|
+
)
|
|
108
111
|
writer.ModelDataWriter.dump(
|
|
109
112
|
args_dict=args_dict,
|
|
110
113
|
output_file=output_file,
|
|
@@ -154,7 +154,7 @@ def check_and_log_overwrite(config_parser, logger):
|
|
|
154
154
|
Returns
|
|
155
155
|
-------
|
|
156
156
|
bool
|
|
157
|
-
True if the hdf5 file exists and should be overwritten
|
|
157
|
+
True if the hdf5 file exists and should be overwritten.
|
|
158
158
|
"""
|
|
159
159
|
if Path(f"{config_parser['output_file_name']}.hdf5").exists() and config_parser["hdf5"]:
|
|
160
160
|
msg = (
|
|
@@ -146,7 +146,9 @@ def _parse(label, description, usage):
|
|
|
146
146
|
required=False,
|
|
147
147
|
default=None,
|
|
148
148
|
)
|
|
149
|
-
return config.initialize(
|
|
149
|
+
return config.initialize(
|
|
150
|
+
db_config=True, simulation_model=["site", "model_version", "layout", "layout_file"]
|
|
151
|
+
)
|
|
150
152
|
|
|
151
153
|
|
|
152
154
|
def _get_site_from_telescope_list_name(telescope_list_file):
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
"""
|
|
3
|
+
Plot tabular data read from file or from model parameter database.
|
|
4
|
+
|
|
5
|
+
Uses a configuration file to define the data to be plotted and all
|
|
6
|
+
plotting details.
|
|
7
|
+
|
|
8
|
+
Command line arguments
|
|
9
|
+
----------------------
|
|
10
|
+
config_file (str, required)
|
|
11
|
+
Configuration file name for plotting.
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import logging
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
import simtools.utils.general as gen
|
|
19
|
+
from simtools.configuration import configurator
|
|
20
|
+
from simtools.io_operations import io_handler
|
|
21
|
+
from simtools.visualization import plot_tables
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _parse(label, description, usage):
|
|
25
|
+
"""
|
|
26
|
+
Parse command line configuration.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
label : str
|
|
31
|
+
Label describing the application.
|
|
32
|
+
description : str
|
|
33
|
+
Description of the application.
|
|
34
|
+
usage : str
|
|
35
|
+
Example on how to use the application.
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
-------
|
|
39
|
+
CommandLineParser
|
|
40
|
+
Command line parser object.
|
|
41
|
+
"""
|
|
42
|
+
config = configurator.Configurator(label=label, description=description, usage=usage)
|
|
43
|
+
|
|
44
|
+
config.parser.add_argument(
|
|
45
|
+
"--plot_config",
|
|
46
|
+
help="Plotting configuration file name.",
|
|
47
|
+
type=str,
|
|
48
|
+
required=True,
|
|
49
|
+
default=None,
|
|
50
|
+
)
|
|
51
|
+
config.parser.add_argument(
|
|
52
|
+
"--output_file",
|
|
53
|
+
help="Output file name (without suffix)",
|
|
54
|
+
type=str,
|
|
55
|
+
required=True,
|
|
56
|
+
)
|
|
57
|
+
return config.initialize(db_config=True)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def main():
|
|
61
|
+
"""Plot tabular data."""
|
|
62
|
+
args_dict, db_config_ = _parse(
|
|
63
|
+
label=Path(__file__).stem,
|
|
64
|
+
description="Plots tabular data.",
|
|
65
|
+
usage="""simtools-plot-tabular-data --plot_config config_file_name "
|
|
66
|
+
--output_file output_file_name""",
|
|
67
|
+
)
|
|
68
|
+
logger = logging.getLogger()
|
|
69
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict.get("log_level", "INFO")))
|
|
70
|
+
io_handler_instance = io_handler.IOHandler()
|
|
71
|
+
|
|
72
|
+
plot_config = gen.convert_keys_in_dict_to_lowercase(
|
|
73
|
+
gen.collect_data_from_file(args_dict["plot_config"])
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
plot_tables.plot(
|
|
77
|
+
config=plot_config["cta_simpipe"]["plot"],
|
|
78
|
+
output_file=io_handler_instance.get_output_file(args_dict["output_file"]),
|
|
79
|
+
db_config=db_config_,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
main()
|
|
@@ -36,7 +36,6 @@ The output will display the scaled events for the specified grid point.
|
|
|
36
36
|
|
|
37
37
|
import json
|
|
38
38
|
import logging
|
|
39
|
-
import os
|
|
40
39
|
from pathlib import Path
|
|
41
40
|
|
|
42
41
|
import astropy.units as u
|
|
@@ -129,7 +128,7 @@ def main():
|
|
|
129
128
|
# Build file path based on base_path, zenith, and offset
|
|
130
129
|
file_name = f"prod6_LaPalma-{int(zenith.value)}deg_"
|
|
131
130
|
file_name += "gamma_cone.N.Am-4LSTs09MSTs_ID0_reduced.fits"
|
|
132
|
-
file_path =
|
|
131
|
+
file_path = Path(args_dict["base_path"]).joinpath(file_name)
|
|
133
132
|
|
|
134
133
|
evaluator = StatisticalErrorEvaluator(
|
|
135
134
|
file_path,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
-
"""
|
|
3
|
+
r"""
|
|
4
4
|
Simulate calibration devices using the light emission package.
|
|
5
5
|
|
|
6
6
|
Run the application in the command line.
|
|
@@ -235,7 +235,7 @@ def _parse(label):
|
|
|
235
235
|
)
|
|
236
236
|
return config.initialize(
|
|
237
237
|
db_config=True,
|
|
238
|
-
simulation_model="telescope",
|
|
238
|
+
simulation_model=["telescope", "model_version"],
|
|
239
239
|
require_command_line=True,
|
|
240
240
|
)
|
|
241
241
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
r"""
|
|
4
|
-
Generate simulation configuration and run simulations
|
|
4
|
+
Generate simulation configuration and run simulations.
|
|
5
5
|
|
|
6
6
|
Multipipe scripts will be produced as part of this application.
|
|
7
7
|
Allows to run array layout simulation including shower and detector simulations
|
|
@@ -43,9 +43,9 @@ r"""
|
|
|
43
43
|
The location of the output directories corsika-data and simtel-data.
|
|
44
44
|
the label is added to the data_directory, such that the output
|
|
45
45
|
will be written to data_directory/label/simtel-data.
|
|
46
|
-
pack_for_grid_register (
|
|
46
|
+
pack_for_grid_register (str, optional)
|
|
47
47
|
Set whether to prepare a tarball for registering the output files on the grid.
|
|
48
|
-
The files are written to the
|
|
48
|
+
The files are written to the specified directory.
|
|
49
49
|
log_level (str, optional)
|
|
50
50
|
Log level to print.
|
|
51
51
|
|
|
@@ -68,9 +68,6 @@ r"""
|
|
|
68
68
|
"""
|
|
69
69
|
|
|
70
70
|
import logging
|
|
71
|
-
import shutil
|
|
72
|
-
import tarfile
|
|
73
|
-
from pathlib import Path
|
|
74
71
|
|
|
75
72
|
import simtools.utils.general as gen
|
|
76
73
|
from simtools.configuration import configurator
|
|
@@ -106,10 +103,10 @@ def _parse(description=None):
|
|
|
106
103
|
)
|
|
107
104
|
config.parser.add_argument(
|
|
108
105
|
"--pack_for_grid_register",
|
|
109
|
-
help="
|
|
110
|
-
|
|
106
|
+
help="Directory for a tarball for registering the output files on the grid.",
|
|
107
|
+
type=str,
|
|
111
108
|
required=False,
|
|
112
|
-
default=
|
|
109
|
+
default=None,
|
|
113
110
|
)
|
|
114
111
|
config.parser.add_argument(
|
|
115
112
|
"--save_file_lists",
|
|
@@ -137,49 +134,11 @@ def _parse(description=None):
|
|
|
137
134
|
return config.initialize(
|
|
138
135
|
db_config=True,
|
|
139
136
|
job_submission=True,
|
|
140
|
-
simulation_model=["site", "layout", "telescope"],
|
|
137
|
+
simulation_model=["site", "layout", "telescope", "model_version"],
|
|
141
138
|
simulation_configuration={"software": None, "corsika_configuration": ["all"]},
|
|
142
139
|
)
|
|
143
140
|
|
|
144
141
|
|
|
145
|
-
def pack_for_register(logger, simulator, args_dict):
|
|
146
|
-
"""
|
|
147
|
-
Pack the output files for registering on the grid.
|
|
148
|
-
|
|
149
|
-
Parameters
|
|
150
|
-
----------
|
|
151
|
-
logger: logging.Logger
|
|
152
|
-
Logger object.
|
|
153
|
-
simulator: Simulator
|
|
154
|
-
Simulator object.
|
|
155
|
-
|
|
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)
|
|
172
|
-
|
|
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}")
|
|
181
|
-
|
|
182
|
-
|
|
183
142
|
def main(): # noqa: D103
|
|
184
143
|
args_dict, db_config = _parse(description="Run simulations for productions")
|
|
185
144
|
|
|
@@ -192,17 +151,23 @@ def main(): # noqa: D103
|
|
|
192
151
|
|
|
193
152
|
simulator.simulate()
|
|
194
153
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
154
|
+
if simulator.submit_engine == "local":
|
|
155
|
+
logger.info(
|
|
156
|
+
f"Production run complete for primary {args_dict['primary']} showers "
|
|
157
|
+
f"from {args_dict['azimuth_angle']} azimuth and {args_dict['zenith_angle']} zenith "
|
|
158
|
+
f"at {args_dict['site']} site, using {args_dict['model_version']} model."
|
|
159
|
+
)
|
|
160
|
+
if args_dict.get("pack_for_grid_register"):
|
|
161
|
+
simulator.pack_for_register(args_dict["pack_for_grid_register"])
|
|
162
|
+
if args_dict["save_file_lists"]:
|
|
163
|
+
simulator.save_file_lists()
|
|
164
|
+
else:
|
|
165
|
+
logger.info("Production run submitted to the workload manager")
|
|
166
|
+
if args_dict["pack_for_grid_register"] or args_dict["save_file_lists"]:
|
|
167
|
+
logger.warning(
|
|
168
|
+
"Packing for grid register or saving file lists not supported for "
|
|
169
|
+
f"{simulator.submit_engine}."
|
|
170
|
+
)
|
|
206
171
|
|
|
207
172
|
|
|
208
173
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Generate a run script and submit file for HT Condor job submission of a simulation production.
|
|
5
|
+
|
|
6
|
+
This tool facilitates the submission of multiple simulations to the HT Condor batch system,
|
|
7
|
+
enabling:
|
|
8
|
+
|
|
9
|
+
- Execution of simulations using the "simtools-simulate-prod" application.
|
|
10
|
+
- 'number_of_runs' jobs are submitted to the HT Condor batch system.
|
|
11
|
+
- Utilization of an Apptainer image containing the SimPipe simulation software and tools.
|
|
12
|
+
- Packaging of data and histogram files, and writing them to a specified directory.
|
|
13
|
+
|
|
14
|
+
This tool is intended for use in an HT Condor environment. Jobs run in a container universe
|
|
15
|
+
using the Apptainer image specified in the command line ('--apptainer_image'). Output is written
|
|
16
|
+
to the 'output_path' directory, with 'simtools-output' and 'logs' subdirectories.
|
|
17
|
+
|
|
18
|
+
Requirements for the 'simtools-simulate-prod-htcondor-generator' application:
|
|
19
|
+
|
|
20
|
+
- Availability of an Apptainer image 'simtools-prod' (obtainable from the package registry on
|
|
21
|
+
GitHub, e.g., via 'apptainer pull --force docker://ghcr.io/gammasim/simtools-prod:latest').
|
|
22
|
+
- Environment parameters required to run CORSIKA and sim_telarray, as well as DB access
|
|
23
|
+
credentials. These should be listed similarly to a '.env' file and copied to
|
|
24
|
+
'output_path/env.txt'. Ensure that the path to the simulation software is correctly set to
|
|
25
|
+
'SIMTOOLS_SIMTEL_PATH=/workdir/sim_telarray'.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Command line arguments
|
|
29
|
+
----------------------
|
|
30
|
+
output_path (str, required)
|
|
31
|
+
Directory where the output and the simulation data files will be written.
|
|
32
|
+
apptainer_image (str, optional)
|
|
33
|
+
Apptainer image to use for the simulation (full path).
|
|
34
|
+
priority (int, optional)
|
|
35
|
+
Job priority (default: 1).
|
|
36
|
+
|
|
37
|
+
(all other command line arguments are identical to those of :ref:`simulate_prod`).
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
import logging
|
|
42
|
+
|
|
43
|
+
import simtools.utils.general as gen
|
|
44
|
+
from simtools.configuration import configurator
|
|
45
|
+
from simtools.job_execution import htcondor_script_generator
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _parse(description=None):
|
|
49
|
+
"""
|
|
50
|
+
Parse command line configuration.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
description: str
|
|
55
|
+
Application description.
|
|
56
|
+
|
|
57
|
+
Returns
|
|
58
|
+
-------
|
|
59
|
+
CommandLineParser
|
|
60
|
+
Command line parser object.
|
|
61
|
+
|
|
62
|
+
"""
|
|
63
|
+
config = configurator.Configurator(description=description)
|
|
64
|
+
config.parser.add_argument(
|
|
65
|
+
"--apptainer_image",
|
|
66
|
+
help="Apptainer image to use for the simulation (full path).",
|
|
67
|
+
type=str,
|
|
68
|
+
required=False,
|
|
69
|
+
)
|
|
70
|
+
config.parser.add_argument(
|
|
71
|
+
"--priority",
|
|
72
|
+
help="Job priority.",
|
|
73
|
+
type=int,
|
|
74
|
+
required=False,
|
|
75
|
+
default=1,
|
|
76
|
+
)
|
|
77
|
+
return config.initialize(
|
|
78
|
+
db_config=False,
|
|
79
|
+
job_submission=False,
|
|
80
|
+
simulation_model=["site", "layout", "telescope", "model_version"],
|
|
81
|
+
simulation_configuration={"software": None, "corsika_configuration": ["all"]},
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def main(): # noqa: D103
|
|
86
|
+
args_dict, _ = _parse(description="Prepare simulations production for HT Condor job submission")
|
|
87
|
+
|
|
88
|
+
logger = logging.getLogger()
|
|
89
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
90
|
+
|
|
91
|
+
htcondor_script_generator.generate_submission_script(args_dict)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
main()
|
|
@@ -86,7 +86,7 @@ def _parse(label):
|
|
|
86
86
|
)
|
|
87
87
|
_args_dict, _db_config = config.initialize(
|
|
88
88
|
db_config=True,
|
|
89
|
-
simulation_model="telescope",
|
|
89
|
+
simulation_model=["telescope", "model_version"],
|
|
90
90
|
simulation_configuration={"corsika_configuration": ["zenith_angle", "azimuth_angle"]},
|
|
91
91
|
)
|
|
92
92
|
if _args_dict["site"] is None or _args_dict["telescope"] is None:
|
|
@@ -34,7 +34,7 @@ r"""
|
|
|
34
34
|
.. code-block:: console
|
|
35
35
|
|
|
36
36
|
simtools-validate-camera-fov --site North \\
|
|
37
|
-
--telescope
|
|
37
|
+
--telescope LSTN-01 --model_version 5.0.0
|
|
38
38
|
|
|
39
39
|
The output is saved in simtools-output/validate_camera_fov.
|
|
40
40
|
|
|
@@ -54,7 +54,7 @@ import simtools.utils.general as gen
|
|
|
54
54
|
from simtools.configuration import configurator
|
|
55
55
|
from simtools.io_operations import io_handler
|
|
56
56
|
from simtools.model.telescope_model import TelescopeModel
|
|
57
|
-
from simtools.visualization import plot_camera
|
|
57
|
+
from simtools.visualization import plot_camera, visualize
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
def _parse():
|
|
@@ -83,7 +83,7 @@ def _parse():
|
|
|
83
83
|
),
|
|
84
84
|
default=50,
|
|
85
85
|
)
|
|
86
|
-
return config.initialize(db_config=True, simulation_model="telescope")
|
|
86
|
+
return config.initialize(db_config=True, simulation_model=["telescope", "model_version"])
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def main(): # noqa: D103
|
|
@@ -133,11 +133,7 @@ def main(): # noqa: D103
|
|
|
133
133
|
) from exc
|
|
134
134
|
fig = plot_camera.plot_pixel_layout(camera, args_dict["camera_in_sky_coor"], pixel_ids_to_print)
|
|
135
135
|
plot_file_prefix = output_dir.joinpath(f"{label}_{tel_model.name}_pixel_layout")
|
|
136
|
-
|
|
137
|
-
file_name = f"{plot_file_prefix!s}.{suffix}"
|
|
138
|
-
fig.savefig(file_name, format=suffix, bbox_inches="tight")
|
|
139
|
-
print(f"\nSaved camera plot in {file_name}\n")
|
|
140
|
-
fig.clf()
|
|
136
|
+
visualize.save_figure(fig, f"{plot_file_prefix!s}", log_title="camera")
|
|
141
137
|
|
|
142
138
|
|
|
143
139
|
if __name__ == "__main__":
|
|
@@ -110,7 +110,7 @@ def _parse(label):
|
|
|
110
110
|
help="Data file name with the measured PSF vs radius [cm]",
|
|
111
111
|
type=str,
|
|
112
112
|
)
|
|
113
|
-
return config.initialize(db_config=True, simulation_model="telescope")
|
|
113
|
+
return config.initialize(db_config=True, simulation_model=["telescope", "model_version"])
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
def load_data(datafile):
|
|
@@ -182,9 +182,7 @@ def main(): # noqa: D103
|
|
|
182
182
|
|
|
183
183
|
plot_file_name = label + "_" + tel_model.name + "_cumulative_PSF"
|
|
184
184
|
plot_file = output_dir.joinpath(plot_file_name)
|
|
185
|
-
|
|
186
|
-
plt.savefig(str(plot_file) + "." + f, format=f, bbox_inches="tight")
|
|
187
|
-
fig.clf()
|
|
185
|
+
visualize.save_figure(fig, plot_file)
|
|
188
186
|
|
|
189
187
|
# Plotting image
|
|
190
188
|
data_to_plot = im.get_image_data()
|
|
@@ -195,9 +193,7 @@ def main(): # noqa: D103
|
|
|
195
193
|
|
|
196
194
|
plot_file_name = label + "_" + tel_model.name + "_image"
|
|
197
195
|
plot_file = output_dir.joinpath(plot_file_name)
|
|
198
|
-
|
|
199
|
-
fig.savefig(str(plot_file) + "." + f, format=f, bbox_inches="tight")
|
|
200
|
-
fig.clf()
|
|
196
|
+
visualize.save_figure(fig, plot_file)
|
|
201
197
|
|
|
202
198
|
|
|
203
199
|
if __name__ == "__main__":
|
|
@@ -33,10 +33,14 @@ r"""
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
import logging
|
|
36
|
+
import re
|
|
36
37
|
from pathlib import Path
|
|
37
38
|
|
|
39
|
+
import jsonschema
|
|
40
|
+
|
|
38
41
|
import simtools.utils.general as gen
|
|
39
42
|
from simtools.configuration import configurator
|
|
43
|
+
from simtools.constants import MODEL_PARAMETER_SCHEMA_PATH
|
|
40
44
|
from simtools.data_model import metadata_collector, metadata_model, validate_data
|
|
41
45
|
|
|
42
46
|
|
|
@@ -61,13 +65,12 @@ def _parse(label, description):
|
|
|
61
65
|
group = config.parser.add_mutually_exclusive_group(required=True)
|
|
62
66
|
group.add_argument("--file_name", help="File to be validated")
|
|
63
67
|
group.add_argument(
|
|
64
|
-
"--
|
|
68
|
+
"--file_directory",
|
|
65
69
|
help=(
|
|
66
|
-
"Directory with json files
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"and data_type=model_parameter is always used."
|
|
70
|
+
"Directory with json files to be validated. "
|
|
71
|
+
"If no schema file is provided, the assumption is that model "
|
|
72
|
+
"parameters are validated and the schema files are taken from "
|
|
73
|
+
f"{MODEL_PARAMETER_SCHEMA_PATH}."
|
|
71
74
|
),
|
|
72
75
|
)
|
|
73
76
|
config.parser.add_argument("--schema", help="Json schema file", required=False)
|
|
@@ -115,34 +118,39 @@ def _get_schema_file_name(args_dict, data_dict=None):
|
|
|
115
118
|
|
|
116
119
|
def validate_schema(args_dict, logger):
|
|
117
120
|
"""
|
|
118
|
-
Validate a schema file given in yaml or json format.
|
|
121
|
+
Validate a schema file (or several files) given in yaml or json format.
|
|
119
122
|
|
|
120
123
|
Schema is either given as command line argument, read from the meta_schema_url or from
|
|
121
124
|
the metadata section of the data dictionary.
|
|
122
125
|
|
|
123
126
|
"""
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if args_dict.get("file_directory") is not None:
|
|
128
|
+
file_list = list(Path(args_dict["file_directory"]).rglob("*.json"))
|
|
129
|
+
else:
|
|
130
|
+
file_list = [args_dict["file_name"]]
|
|
131
|
+
for file_name in file_list:
|
|
132
|
+
try:
|
|
133
|
+
data = gen.collect_data_from_file(file_name=file_name)
|
|
134
|
+
except FileNotFoundError as exc:
|
|
135
|
+
logger.error(f"Error reading schema file from {file_name}")
|
|
136
|
+
raise exc
|
|
137
|
+
try:
|
|
138
|
+
metadata_model.validate_schema(data, _get_schema_file_name(args_dict, data))
|
|
139
|
+
except jsonschema.exceptions.ValidationError as exc:
|
|
140
|
+
logger.error(f"Failed validation of file {file_name}")
|
|
141
|
+
raise exc
|
|
142
|
+
logger.info(f"Successful validation of file {file_name}")
|
|
131
143
|
|
|
132
144
|
|
|
133
145
|
def validate_data_files(args_dict, logger):
|
|
134
146
|
"""Validate data files."""
|
|
135
|
-
|
|
136
|
-
if
|
|
147
|
+
file_directory = args_dict.get("file_directory")
|
|
148
|
+
if file_directory is not None:
|
|
137
149
|
tmp_args_dict = {}
|
|
138
|
-
for file_name in Path(
|
|
150
|
+
for file_name in Path(file_directory).rglob("*.json"):
|
|
139
151
|
tmp_args_dict["file_name"] = file_name
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
/ "../schemas"
|
|
143
|
-
/ "model_parameters"
|
|
144
|
-
/ f"{file_name.stem}.schema.yml"
|
|
145
|
-
)
|
|
152
|
+
parameter_name = re.sub(r"-\d+\.\d+\.\d+", "", file_name.stem)
|
|
153
|
+
schema_file = MODEL_PARAMETER_SCHEMA_PATH / f"{parameter_name}.schema.yml"
|
|
146
154
|
tmp_args_dict["schema"] = schema_file
|
|
147
155
|
tmp_args_dict["data_type"] = "model_parameter"
|
|
148
156
|
tmp_args_dict["require_exact_data_type"] = args_dict["require_exact_data_type"]
|
|
@@ -78,6 +78,7 @@ from simtools.configuration import configurator
|
|
|
78
78
|
from simtools.io_operations import io_handler
|
|
79
79
|
from simtools.model.telescope_model import TelescopeModel
|
|
80
80
|
from simtools.ray_tracing.ray_tracing import RayTracing
|
|
81
|
+
from simtools.visualization import visualize
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
def _parse(label):
|
|
@@ -114,7 +115,7 @@ def _parse(label):
|
|
|
114
115
|
help="Produce a multiple pages pdf file with the image plots.",
|
|
115
116
|
action="store_true",
|
|
116
117
|
)
|
|
117
|
-
return config.initialize(db_config=True, simulation_model=["telescope"])
|
|
118
|
+
return config.initialize(db_config=True, simulation_model=["telescope", "model_version"])
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
def main(): # noqa: D103
|
|
@@ -171,9 +172,7 @@ def main(): # noqa: D103
|
|
|
171
172
|
|
|
172
173
|
plot_file_name = "_".join((label, tel_model.name, key))
|
|
173
174
|
plot_file = output_dir.joinpath(plot_file_name)
|
|
174
|
-
|
|
175
|
-
plt.savefig(str(plot_file) + ".png", format="png", bbox_inches="tight")
|
|
176
|
-
plt.clf()
|
|
175
|
+
visualize.save_figure(plt, plot_file)
|
|
177
176
|
|
|
178
177
|
# Plotting images
|
|
179
178
|
if args_dict["plot_images"]:
|
simtools/camera_efficiency.py
CHANGED
|
@@ -514,7 +514,4 @@ class CameraEfficiency:
|
|
|
514
514
|
plot_file = self.output_dir.joinpath(
|
|
515
515
|
self.label + "_" + self.telescope_model.name + "_" + plot_title
|
|
516
516
|
)
|
|
517
|
-
|
|
518
|
-
fig.savefig(str(plot_file) + "." + f, format=f, bbox_inches="tight")
|
|
519
|
-
self._logger.info(f"Plotted {plot_title} efficiency in {plot_file}")
|
|
520
|
-
fig.clf()
|
|
517
|
+
visualize.save_figure(fig, plot_file, log_title=f"{plot_title} efficiency")
|