gammasimtools 0.6.1__py3-none-any.whl → 0.8.1__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/METADATA +172 -0
- gammasimtools-0.8.1.dist-info/RECORD +346 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.1.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.1.dist-info/entry_points.txt +31 -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 +113 -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 +210 -184
- 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 +305 -256
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +233 -493
- simtools/model/mirrors.py +61 -44
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +7 -35
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +127 -621
- 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 +258 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +2 -0
- 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/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.1.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.1.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import simtools.utils.general as gen
|
|
5
|
-
from simtools.io_operations import io_handler
|
|
6
|
-
from simtools.simtel.simtel_runner import InvalidOutputFile, SimtelRunner
|
|
7
|
-
|
|
8
|
-
__all__ = ["SimtelRunnerArray"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class SimtelRunnerArray(SimtelRunner):
|
|
12
|
-
"""
|
|
13
|
-
SimtelRunnerArray is the interface with sim_telarray to perform array simulations.
|
|
14
|
-
|
|
15
|
-
Configurable parameters:
|
|
16
|
-
simtel_data_directory:
|
|
17
|
-
len: 1
|
|
18
|
-
default: null
|
|
19
|
-
unit: null
|
|
20
|
-
primary:
|
|
21
|
-
len: 1
|
|
22
|
-
unit: null
|
|
23
|
-
zenith_angle:
|
|
24
|
-
len: 1
|
|
25
|
-
unit: deg
|
|
26
|
-
default: 20 deg
|
|
27
|
-
azimuth_angle:
|
|
28
|
-
len: 1
|
|
29
|
-
unit: deg
|
|
30
|
-
default: 0 deg
|
|
31
|
-
|
|
32
|
-
Parameters
|
|
33
|
-
----------
|
|
34
|
-
array_model: str
|
|
35
|
-
Instance of TelescopeModel class.
|
|
36
|
-
label: str
|
|
37
|
-
Instance label. Important for output file naming.
|
|
38
|
-
simtel_source_path: str or Path
|
|
39
|
-
Location of sim_telarray installation.
|
|
40
|
-
config_data: dict
|
|
41
|
-
Dict containing the configurable parameters.
|
|
42
|
-
config_file: str or Path
|
|
43
|
-
Path of the yaml file containing the configurable parameters.
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
def __init__(
|
|
47
|
-
self,
|
|
48
|
-
array_model,
|
|
49
|
-
label=None,
|
|
50
|
-
simtel_source_path=None,
|
|
51
|
-
config_data=None,
|
|
52
|
-
config_file=None,
|
|
53
|
-
):
|
|
54
|
-
"""
|
|
55
|
-
Initialize SimtelRunnerArray.
|
|
56
|
-
"""
|
|
57
|
-
self._logger = logging.getLogger(__name__)
|
|
58
|
-
self._logger.debug("Init SimtelRunnerArray")
|
|
59
|
-
|
|
60
|
-
super().__init__(label=label, simtel_source_path=simtel_source_path)
|
|
61
|
-
|
|
62
|
-
self.array_model = self._validate_array_model(array_model)
|
|
63
|
-
self.label = label if label is not None else self.array_model.label
|
|
64
|
-
self._log_file = None
|
|
65
|
-
|
|
66
|
-
self.io_handler = io_handler.IOHandler()
|
|
67
|
-
|
|
68
|
-
self._base_directory = self.io_handler.get_output_directory(self.label, "array-simulator")
|
|
69
|
-
|
|
70
|
-
# Loading config_data
|
|
71
|
-
_config_data_in = gen.collect_data_from_file_or_dict(config_file, config_data)
|
|
72
|
-
_parameter_file = self.io_handler.get_input_data_file(
|
|
73
|
-
"parameters", "simtel-runner-array_parameters.yml"
|
|
74
|
-
)
|
|
75
|
-
_parameters = gen.collect_data_from_file_or_dict(_parameter_file, None)
|
|
76
|
-
self.config = gen.validate_config_data(_config_data_in, _parameters)
|
|
77
|
-
|
|
78
|
-
self._load_simtel_data_directories()
|
|
79
|
-
|
|
80
|
-
def _load_simtel_data_directories(self):
|
|
81
|
-
"""
|
|
82
|
-
Create sim_telarray output directories for data, log and input.
|
|
83
|
-
|
|
84
|
-
If simtel_data_directory is not given as a configurable parameter,
|
|
85
|
-
the standard directory of simtools output (simtools-output) will
|
|
86
|
-
be used. A sub directory simtel-data will be created and sub directories for
|
|
87
|
-
log and data will be created inside it.
|
|
88
|
-
"""
|
|
89
|
-
|
|
90
|
-
if self.config.simtel_data_directory is None:
|
|
91
|
-
# Default config value
|
|
92
|
-
simtel_base_dir = self._base_directory
|
|
93
|
-
else:
|
|
94
|
-
simtel_base_dir = Path(self.config.simtel_data_directory)
|
|
95
|
-
|
|
96
|
-
simtel_base_dir = simtel_base_dir.joinpath("simtel-data")
|
|
97
|
-
simtel_base_dir = simtel_base_dir.joinpath(self.array_model.site)
|
|
98
|
-
simtel_base_dir = simtel_base_dir.joinpath(self.config.primary)
|
|
99
|
-
simtel_base_dir = simtel_base_dir.absolute()
|
|
100
|
-
|
|
101
|
-
self._simtel_data_dir = simtel_base_dir.joinpath("data")
|
|
102
|
-
self._simtel_data_dir.mkdir(parents=True, exist_ok=True)
|
|
103
|
-
self._simtel_log_dir = simtel_base_dir.joinpath("log")
|
|
104
|
-
self._simtel_log_dir.mkdir(parents=True, exist_ok=True)
|
|
105
|
-
|
|
106
|
-
def get_info_for_file_name(self, run_number):
|
|
107
|
-
"""
|
|
108
|
-
Get a dictionary with the info necessary for building the sim_telarray file names.
|
|
109
|
-
|
|
110
|
-
Returns
|
|
111
|
-
-------
|
|
112
|
-
dict
|
|
113
|
-
Dictionary with the keys necessary for building the sim_telarray file names.
|
|
114
|
-
"""
|
|
115
|
-
return {
|
|
116
|
-
"run": run_number,
|
|
117
|
-
"primary": self.config.primary,
|
|
118
|
-
"array_name": self.array_model.layout_name,
|
|
119
|
-
"site": self.array_model.site,
|
|
120
|
-
"zenith": self.config.zenith_angle,
|
|
121
|
-
"azimuth": self.config.azimuth_angle,
|
|
122
|
-
"label": self.label,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
def get_file_name(self, file_type, **kwargs):
|
|
126
|
-
"""
|
|
127
|
-
Get a sim_telarray style file name for various file types.
|
|
128
|
-
|
|
129
|
-
Parameters
|
|
130
|
-
----------
|
|
131
|
-
file_type: str
|
|
132
|
-
The type of file (determines the file suffix). Choices are log, histogram, output or\
|
|
133
|
-
sub_log.
|
|
134
|
-
kwargs: dict
|
|
135
|
-
The dictionary must include the following parameters (unless listed as optional):
|
|
136
|
-
run: int
|
|
137
|
-
Run number.
|
|
138
|
-
primary: str
|
|
139
|
-
Primary particle (e.g gamma, proton etc).
|
|
140
|
-
zenith: float
|
|
141
|
-
Zenith angle (deg).
|
|
142
|
-
azimuth: float
|
|
143
|
-
Azimuth angle (deg).
|
|
144
|
-
site: str
|
|
145
|
-
Site name (usually North/South or Paranal/LaPalma).
|
|
146
|
-
array_name: str
|
|
147
|
-
Array name.
|
|
148
|
-
label: str
|
|
149
|
-
Instance label (optional).
|
|
150
|
-
mode: str
|
|
151
|
-
out or err (optional, relevant only for sub_log).
|
|
152
|
-
|
|
153
|
-
Returns
|
|
154
|
-
-------
|
|
155
|
-
str
|
|
156
|
-
File name with full path.
|
|
157
|
-
|
|
158
|
-
Raises
|
|
159
|
-
------
|
|
160
|
-
ValueError
|
|
161
|
-
If file_type is unknown.
|
|
162
|
-
"""
|
|
163
|
-
|
|
164
|
-
file_label = (
|
|
165
|
-
f"_{kwargs['label']}" if "label" in kwargs and kwargs["label"] is not None else ""
|
|
166
|
-
)
|
|
167
|
-
file_name = (
|
|
168
|
-
f"run{kwargs['run']:06}_{kwargs['primary']}_"
|
|
169
|
-
f"za{round(kwargs['zenith']):03}deg_azm{round(kwargs['azimuth']):03}deg_"
|
|
170
|
-
f"{kwargs['site']}_{kwargs['array_name']}{file_label}"
|
|
171
|
-
)
|
|
172
|
-
if file_type == "log":
|
|
173
|
-
return self._simtel_log_dir.joinpath(f"{file_name}.log.gz")
|
|
174
|
-
if file_type == "histogram":
|
|
175
|
-
return self._simtel_log_dir.joinpath(f"{file_name}.hdata.zst")
|
|
176
|
-
if file_type == "output":
|
|
177
|
-
return self._simtel_data_dir.joinpath(f"{file_name}.simtel.zst")
|
|
178
|
-
if file_type == "sub_log":
|
|
179
|
-
suffix = ".log"
|
|
180
|
-
if "mode" in kwargs:
|
|
181
|
-
suffix = f".{kwargs['mode']}"
|
|
182
|
-
return self._simtel_log_dir.joinpath(f"log_sub_{file_name}{suffix}")
|
|
183
|
-
|
|
184
|
-
raise ValueError(f"The requested file type ({file_type}) is unknown")
|
|
185
|
-
|
|
186
|
-
def has_file(self, file_type, run_number, mode="out"):
|
|
187
|
-
"""
|
|
188
|
-
Checks that the file of file_type for the specified run number exists.
|
|
189
|
-
|
|
190
|
-
Parameters
|
|
191
|
-
----------
|
|
192
|
-
file_type: str
|
|
193
|
-
File type to check.
|
|
194
|
-
Choices are log, histogram, output or sub_log.
|
|
195
|
-
run_number: int
|
|
196
|
-
Run number.
|
|
197
|
-
mode: str
|
|
198
|
-
Mode.
|
|
199
|
-
"""
|
|
200
|
-
|
|
201
|
-
info_for_file_name = self.get_info_for_file_name(run_number)
|
|
202
|
-
run_sub_file = self.get_file_name(file_type, **info_for_file_name, mode=mode)
|
|
203
|
-
return Path(run_sub_file).is_file()
|
|
204
|
-
|
|
205
|
-
def get_resources(self, run_number):
|
|
206
|
-
"""
|
|
207
|
-
Reading run time from last line of submission log file.
|
|
208
|
-
|
|
209
|
-
Parameters
|
|
210
|
-
----------
|
|
211
|
-
run_number: int
|
|
212
|
-
Run number.
|
|
213
|
-
|
|
214
|
-
Returns
|
|
215
|
-
-------
|
|
216
|
-
dict
|
|
217
|
-
run time of job in seconds.
|
|
218
|
-
|
|
219
|
-
"""
|
|
220
|
-
|
|
221
|
-
info_for_file_name = self.get_info_for_file_name(run_number)
|
|
222
|
-
sub_log_file = self.get_file_name("sub_log", **info_for_file_name, mode="out")
|
|
223
|
-
|
|
224
|
-
self._logger.debug(f"Reading resources from {sub_log_file}")
|
|
225
|
-
|
|
226
|
-
_resources = {}
|
|
227
|
-
|
|
228
|
-
_resources["runtime"] = None
|
|
229
|
-
with open(sub_log_file, "r", encoding="utf-8") as file:
|
|
230
|
-
for line in reversed(list(file)):
|
|
231
|
-
if "RUNTIME" in line:
|
|
232
|
-
_resources["runtime"] = int(line.split()[1])
|
|
233
|
-
break
|
|
234
|
-
|
|
235
|
-
if _resources["runtime"] is None:
|
|
236
|
-
self._logger.debug("RUNTIME was not found in run log file")
|
|
237
|
-
|
|
238
|
-
return _resources
|
|
239
|
-
|
|
240
|
-
def _shall_run(self, **kwargs):
|
|
241
|
-
"""Tells if simulations should be run again based on the existence of output files."""
|
|
242
|
-
output_file = self.get_file_name(
|
|
243
|
-
file_type="output", **self.get_info_for_file_name(kwargs["run_number"])
|
|
244
|
-
)
|
|
245
|
-
return not output_file.exists()
|
|
246
|
-
|
|
247
|
-
def _make_run_command(self, **kwargs):
|
|
248
|
-
"""
|
|
249
|
-
Builds and returns the command to run simtel_array.
|
|
250
|
-
|
|
251
|
-
Parameters
|
|
252
|
-
----------
|
|
253
|
-
kwargs: dict
|
|
254
|
-
The dictionary must include the following parameters (unless listed as optional):
|
|
255
|
-
input_file: str
|
|
256
|
-
Full path of the input CORSIKA file
|
|
257
|
-
run_number: int (optional)
|
|
258
|
-
run number
|
|
259
|
-
|
|
260
|
-
"""
|
|
261
|
-
|
|
262
|
-
run_number = kwargs["run_number"] if "run_number" in kwargs else 1
|
|
263
|
-
info_for_file_name = self.get_info_for_file_name(run_number)
|
|
264
|
-
self._log_file = self.get_file_name(file_type="log", **info_for_file_name)
|
|
265
|
-
histogram_file = self.get_file_name(file_type="histogram", **info_for_file_name)
|
|
266
|
-
output_file = self.get_file_name(file_type="output", **info_for_file_name)
|
|
267
|
-
|
|
268
|
-
# Array
|
|
269
|
-
command = str(self._simtel_source_path.joinpath("sim_telarray/bin/sim_telarray"))
|
|
270
|
-
command += f" -c {self.array_model.get_config_file()}"
|
|
271
|
-
command += f" -I{self.array_model.get_config_directory()}"
|
|
272
|
-
command += super()._config_option("telescope_theta", self.config.zenith_angle)
|
|
273
|
-
command += super()._config_option("telescope_phi", self.config.azimuth_angle)
|
|
274
|
-
command += super()._config_option("power_law", "2.5")
|
|
275
|
-
command += super()._config_option("histogram_file", histogram_file)
|
|
276
|
-
command += super()._config_option("output_file", output_file)
|
|
277
|
-
command += super()._config_option("random_state", "none")
|
|
278
|
-
command += super()._config_option("show", "all")
|
|
279
|
-
command += f" {kwargs['input_file']}"
|
|
280
|
-
command += f" > {self._log_file} 2>&1 || exit"
|
|
281
|
-
|
|
282
|
-
return command
|
|
283
|
-
|
|
284
|
-
def _check_run_result(self, **kwargs):
|
|
285
|
-
# Checking run
|
|
286
|
-
output_file = self.get_file_name(
|
|
287
|
-
file_type="output", **self.get_info_for_file_name(kwargs["run_number"])
|
|
288
|
-
)
|
|
289
|
-
if not output_file.exists():
|
|
290
|
-
msg = "sim_telarray output file does not exist."
|
|
291
|
-
self._logger.error(msg)
|
|
292
|
-
raise InvalidOutputFile(msg)
|
|
293
|
-
self._logger.debug(f"simtel_array output file {output_file} exists.")
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
import astropy.units as u
|
|
4
|
-
|
|
5
|
-
import simtools.utils.general as gen
|
|
6
|
-
from simtools.io_operations import io_handler
|
|
7
|
-
from simtools.simtel.simtel_runner import SimtelRunner
|
|
8
|
-
from simtools.utils import names
|
|
9
|
-
|
|
10
|
-
__all__ = ["SimtelRunnerRayTracing"]
|
|
11
|
-
|
|
12
|
-
# pylint: disable=no-member
|
|
13
|
-
# The line above is needed because there are members which are created
|
|
14
|
-
# by adding them to the __dict__ of the class rather than directly.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class SimtelRunnerRayTracing(SimtelRunner):
|
|
18
|
-
"""
|
|
19
|
-
SimtelRunnerRayTracing is the interface with sim_telarray to perform ray tracing simulations.
|
|
20
|
-
|
|
21
|
-
Configurable parameters:
|
|
22
|
-
zenith_angle:
|
|
23
|
-
len: 1
|
|
24
|
-
unit: deg
|
|
25
|
-
default: 20 deg
|
|
26
|
-
off_axis_angle:
|
|
27
|
-
len: 1
|
|
28
|
-
unit: deg
|
|
29
|
-
default: 0 deg
|
|
30
|
-
source_distance:
|
|
31
|
-
len: 1
|
|
32
|
-
unit: km
|
|
33
|
-
default: 10 km
|
|
34
|
-
single_mirror_mode:
|
|
35
|
-
len: 1
|
|
36
|
-
default: False
|
|
37
|
-
use_random_focal_length:
|
|
38
|
-
len: 1
|
|
39
|
-
default: False
|
|
40
|
-
mirror_numbers:
|
|
41
|
-
len: 1
|
|
42
|
-
default: 1
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
telescope_model: str
|
|
47
|
-
Instance of TelescopeModel class.
|
|
48
|
-
label: str
|
|
49
|
-
Instance label. Important for output file naming.
|
|
50
|
-
simtel_source_path: str or Path
|
|
51
|
-
Location of sim_telarray installation.
|
|
52
|
-
config_data: dict
|
|
53
|
-
Dict containing the configurable parameters.
|
|
54
|
-
config_file: str or Path
|
|
55
|
-
Path of the yaml file containing the configurable parameters.
|
|
56
|
-
force_simulate: bool
|
|
57
|
-
Remove existing files and force re-running of the ray-tracing simulation.
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
def __init__(
|
|
61
|
-
self,
|
|
62
|
-
telescope_model,
|
|
63
|
-
label=None,
|
|
64
|
-
simtel_source_path=None,
|
|
65
|
-
config_data=None,
|
|
66
|
-
config_file=None,
|
|
67
|
-
force_simulate=False,
|
|
68
|
-
test=False,
|
|
69
|
-
):
|
|
70
|
-
"""
|
|
71
|
-
Initialize SimtelRunner.
|
|
72
|
-
"""
|
|
73
|
-
self._logger = logging.getLogger(__name__)
|
|
74
|
-
self._logger.debug("Init SimtelRunnerRayTracing")
|
|
75
|
-
|
|
76
|
-
super().__init__(label=label, simtel_source_path=simtel_source_path)
|
|
77
|
-
|
|
78
|
-
self.telescope_model = self._validate_telescope_model(telescope_model)
|
|
79
|
-
self.label = label if label is not None else self.telescope_model.label
|
|
80
|
-
|
|
81
|
-
self.io_handler = io_handler.IOHandler()
|
|
82
|
-
self._base_directory = self.io_handler.get_output_directory(self.label, "ray-tracing")
|
|
83
|
-
|
|
84
|
-
# Loading config_data
|
|
85
|
-
self.config = gen.validate_config_data(
|
|
86
|
-
gen.collect_data_from_file_or_dict(config_file, config_data),
|
|
87
|
-
self.ray_tracing_default_configuration(True),
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
# RayTracing - default parameters
|
|
91
|
-
self._rep_number = 0
|
|
92
|
-
self.runs_per_set = 1 if self.config.single_mirror_mode else 20
|
|
93
|
-
self.photons_per_run = 100000 if not test else 10000
|
|
94
|
-
|
|
95
|
-
self._load_required_files(force_simulate)
|
|
96
|
-
|
|
97
|
-
def _load_required_files(self, force_simulate):
|
|
98
|
-
"""
|
|
99
|
-
Which file are required for running depends on the mode.
|
|
100
|
-
Here we define and write some information into these files. Log files are always required.
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
# This file is not actually needed and does not exist in simtools.
|
|
104
|
-
# However, we need to provide the name of a CORSIKA input file to sim_telarray
|
|
105
|
-
# so it is set up here.
|
|
106
|
-
self._corsika_file = self._simtel_source_path.joinpath("run9991.corsika.gz")
|
|
107
|
-
|
|
108
|
-
# Loop to define and remove existing files.
|
|
109
|
-
# Files will be named _base_file = self.__dict__['_' + base + 'File']
|
|
110
|
-
for base_name in ["stars", "photons", "log"]:
|
|
111
|
-
file_name = names.ray_tracing_file_name(
|
|
112
|
-
self.telescope_model.site,
|
|
113
|
-
self.telescope_model.name,
|
|
114
|
-
self.config.source_distance,
|
|
115
|
-
self.config.zenith_angle,
|
|
116
|
-
self.config.off_axis_angle,
|
|
117
|
-
self.config.mirror_numbers if self.config.single_mirror_mode else None,
|
|
118
|
-
self.label,
|
|
119
|
-
base_name,
|
|
120
|
-
)
|
|
121
|
-
file = self._base_directory.joinpath(file_name)
|
|
122
|
-
if file.exists() and force_simulate:
|
|
123
|
-
file.unlink()
|
|
124
|
-
# Defining the file name variable as an class attribute.
|
|
125
|
-
self.__dict__["_" + base_name + "_file"] = file
|
|
126
|
-
|
|
127
|
-
if not file.exists() or force_simulate:
|
|
128
|
-
# Adding header to photon list file.
|
|
129
|
-
with self._photons_file.open("w", encoding="utf-8") as file:
|
|
130
|
-
file.write(f"#{50 * '='}\n")
|
|
131
|
-
file.write("# List of photons for RayTracing simulations\n")
|
|
132
|
-
file.write(f"#{50 * '='}\n")
|
|
133
|
-
file.write(f"# config_file = {self.telescope_model.get_config_file()}\n")
|
|
134
|
-
file.write(f"# zenith_angle [deg] = {self.config.zenith_angle}\n")
|
|
135
|
-
file.write(f"# off_axis_angle [deg] = {self.config.off_axis_angle}\n")
|
|
136
|
-
file.write(f"# source_distance [km] = {self.config.source_distance}\n")
|
|
137
|
-
if self.config.single_mirror_mode:
|
|
138
|
-
file.write(f"# mirror_number = {self.config.mirror_numbers}\n\n")
|
|
139
|
-
|
|
140
|
-
# Filling in star file with a single light source.
|
|
141
|
-
# Parameters defining light source:
|
|
142
|
-
# - azimuth
|
|
143
|
-
# - elevation
|
|
144
|
-
# - flux
|
|
145
|
-
# - distance of light source
|
|
146
|
-
with self._stars_file.open("w", encoding="utf-8") as file:
|
|
147
|
-
file.write(
|
|
148
|
-
f"0. {90.0 - self.config.zenith_angle} 1.0 {self.config.source_distance}\n"
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
def _shall_run(self, **kwargs): # pylint: disable=unused-argument; applies only to this line
|
|
152
|
-
"""Tells if simulations should be run again based on the existence of output files."""
|
|
153
|
-
return not self._is_photon_list_file_ok()
|
|
154
|
-
|
|
155
|
-
def _make_run_command(self, **kwargs): # pylint: disable=unused-argument
|
|
156
|
-
"""Return the command to run simtel_array."""
|
|
157
|
-
|
|
158
|
-
if self.config.single_mirror_mode:
|
|
159
|
-
_mirror_focal_length = float(
|
|
160
|
-
self.telescope_model.get_parameter_value("mirror_focal_length")
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
# RayTracing
|
|
164
|
-
command = str(self._simtel_source_path.joinpath("sim_telarray/bin/sim_telarray"))
|
|
165
|
-
command += f" -c {self.telescope_model.get_config_file()}"
|
|
166
|
-
command += " -I../cfg/CTA"
|
|
167
|
-
command += f" -I{self.telescope_model.get_config_directory()}"
|
|
168
|
-
command += super()._config_option("random_state", "none")
|
|
169
|
-
command += super()._config_option("IMAGING_LIST", str(self._photons_file))
|
|
170
|
-
command += super()._config_option("stars", str(self._stars_file))
|
|
171
|
-
command += super()._config_option(
|
|
172
|
-
"altitude", self.telescope_model.get_parameter_value("altitude")
|
|
173
|
-
)
|
|
174
|
-
command += super()._config_option(
|
|
175
|
-
"telescope_theta", self.config.zenith_angle + self.config.off_axis_angle
|
|
176
|
-
)
|
|
177
|
-
command += super()._config_option("star_photons", str(self.photons_per_run))
|
|
178
|
-
command += super()._config_option("telescope_phi", "0")
|
|
179
|
-
command += super()._config_option("camera_transmission", "1.0")
|
|
180
|
-
command += super()._config_option("nightsky_background", "all:0.")
|
|
181
|
-
command += super()._config_option("trigger_current_limit", "1e10")
|
|
182
|
-
command += super()._config_option("telescope_random_angle", "0")
|
|
183
|
-
command += super()._config_option("telescope_random_error", "0")
|
|
184
|
-
command += super()._config_option("convergent_depth", "0")
|
|
185
|
-
command += super()._config_option("maximum_telescopes", "1")
|
|
186
|
-
command += super()._config_option("show", "all")
|
|
187
|
-
command += super()._config_option("camera_filter", "none")
|
|
188
|
-
if self.config.single_mirror_mode:
|
|
189
|
-
command += super()._config_option("focus_offset", "all:0.")
|
|
190
|
-
command += super()._config_option("camera_config_file", "single_pixel_camera.dat")
|
|
191
|
-
command += super()._config_option("camera_pixels", "1")
|
|
192
|
-
command += super()._config_option("trigger_pixels", "1")
|
|
193
|
-
command += super()._config_option("camera_body_diameter", "0")
|
|
194
|
-
command += super()._config_option(
|
|
195
|
-
"mirror_list",
|
|
196
|
-
self.telescope_model.get_single_mirror_list_file(
|
|
197
|
-
self.config.mirror_numbers, self.config.use_random_focal_length
|
|
198
|
-
),
|
|
199
|
-
)
|
|
200
|
-
command += super()._config_option(
|
|
201
|
-
"focal_length", self.config.source_distance * u.km.to(u.cm)
|
|
202
|
-
)
|
|
203
|
-
command += super()._config_option("dish_shape_length", _mirror_focal_length)
|
|
204
|
-
command += super()._config_option("mirror_focal_length", _mirror_focal_length)
|
|
205
|
-
command += super()._config_option("parabolic_dish", "0")
|
|
206
|
-
command += super()._config_option("mirror_align_random_distance", "0.")
|
|
207
|
-
command += super()._config_option("mirror_align_random_vertical", "0.,28.,0.,0.")
|
|
208
|
-
command += " " + str(self._corsika_file)
|
|
209
|
-
command += " 2>&1 > " + str(self._log_file) + " 2>&1"
|
|
210
|
-
|
|
211
|
-
return command
|
|
212
|
-
|
|
213
|
-
def _check_run_result(self, **kwargs): # pylint: disable=unused-argument
|
|
214
|
-
"""Checking run results.
|
|
215
|
-
|
|
216
|
-
Raises
|
|
217
|
-
------
|
|
218
|
-
RuntimeError
|
|
219
|
-
if Photon list is empty.
|
|
220
|
-
"""
|
|
221
|
-
# Checking run
|
|
222
|
-
if not self._is_photon_list_file_ok():
|
|
223
|
-
msg = "Photon list is empty."
|
|
224
|
-
self._logger.error(msg)
|
|
225
|
-
raise RuntimeError(msg)
|
|
226
|
-
|
|
227
|
-
self._logger.debug("Everything looks fine with output file.")
|
|
228
|
-
|
|
229
|
-
def _is_photon_list_file_ok(self):
|
|
230
|
-
"""Check if the photon list is valid,"""
|
|
231
|
-
n_lines = 0
|
|
232
|
-
with open(self._photons_file, "rb") as ff:
|
|
233
|
-
for _ in ff:
|
|
234
|
-
n_lines += 1
|
|
235
|
-
if n_lines > 100:
|
|
236
|
-
break
|
|
237
|
-
|
|
238
|
-
return n_lines > 100
|
|
239
|
-
|
|
240
|
-
@staticmethod
|
|
241
|
-
def ray_tracing_default_configuration(config_runner=False):
|
|
242
|
-
"""
|
|
243
|
-
Get default ray tracing configuration.
|
|
244
|
-
|
|
245
|
-
Returns
|
|
246
|
-
-------
|
|
247
|
-
dict
|
|
248
|
-
Default configuration for ray tracing.
|
|
249
|
-
|
|
250
|
-
"""
|
|
251
|
-
|
|
252
|
-
return {
|
|
253
|
-
"zenith_angle": {
|
|
254
|
-
"len": 1,
|
|
255
|
-
"unit": u.Unit("deg"),
|
|
256
|
-
"default": 20.0 * u.deg,
|
|
257
|
-
"names": ["zenith", "theta"],
|
|
258
|
-
},
|
|
259
|
-
"off_axis_angle": {
|
|
260
|
-
"len": 1 if config_runner else None,
|
|
261
|
-
"unit": u.Unit("deg"),
|
|
262
|
-
"default": 0.0 * u.deg,
|
|
263
|
-
"names": ["offaxis", "offset"],
|
|
264
|
-
},
|
|
265
|
-
"source_distance": {
|
|
266
|
-
"len": 1,
|
|
267
|
-
"unit": u.Unit("km"),
|
|
268
|
-
"default": 10.0 * u.km,
|
|
269
|
-
"names": ["sourcedist", "srcdist"],
|
|
270
|
-
},
|
|
271
|
-
"single_mirror_mode": {"len": 1, "default": False},
|
|
272
|
-
"use_random_focal_length": {"len": 1, "default": False},
|
|
273
|
-
"mirror_numbers": {
|
|
274
|
-
"len": 1 if config_runner else None,
|
|
275
|
-
"default": 1 if config_runner else "all",
|
|
276
|
-
},
|
|
277
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|