gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gammasimtools-0.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
simtools/ray_tracing.py
DELETED
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
import gzip
|
|
2
|
-
import logging
|
|
3
|
-
import shlex
|
|
4
|
-
import shutil
|
|
5
|
-
import subprocess
|
|
6
|
-
from copy import copy
|
|
7
|
-
from math import pi, tan
|
|
8
|
-
from pathlib import Path
|
|
9
|
-
|
|
10
|
-
import astropy.io.ascii
|
|
11
|
-
import astropy.units as u
|
|
12
|
-
import matplotlib.pyplot as plt
|
|
13
|
-
import numpy as np
|
|
14
|
-
from astropy.table import QTable
|
|
15
|
-
|
|
16
|
-
import simtools.utils.general as gen
|
|
17
|
-
from simtools.io_operations import io_handler
|
|
18
|
-
from simtools.model.model_utils import compute_telescope_transmission
|
|
19
|
-
from simtools.model.telescope_model import TelescopeModel
|
|
20
|
-
from simtools.psf_analysis import PSFImage
|
|
21
|
-
from simtools.simtel.simtel_runner_ray_tracing import SimtelRunnerRayTracing
|
|
22
|
-
from simtools.utils import names
|
|
23
|
-
from simtools.visualization import visualize
|
|
24
|
-
|
|
25
|
-
__all__ = ["RayTracing"]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class RayTracing:
|
|
29
|
-
"""
|
|
30
|
-
Class for handling ray tracing simulations and analysis.
|
|
31
|
-
|
|
32
|
-
Parameters
|
|
33
|
-
----------
|
|
34
|
-
telescope_model: TelescopeModel
|
|
35
|
-
Instance of the TelescopeModel class.
|
|
36
|
-
label: str
|
|
37
|
-
Instance label.
|
|
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
|
-
YLABEL = {
|
|
47
|
-
"d80_cm": r"$D_{80}$",
|
|
48
|
-
"d80_deg": r"$D_{80}$",
|
|
49
|
-
"eff_area": "Eff. mirror area",
|
|
50
|
-
"eff_flen": "Eff. focal length",
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
def __init__(
|
|
54
|
-
self,
|
|
55
|
-
telescope_model,
|
|
56
|
-
simtel_source_path,
|
|
57
|
-
label=None,
|
|
58
|
-
config_data=None,
|
|
59
|
-
config_file=None,
|
|
60
|
-
):
|
|
61
|
-
"""
|
|
62
|
-
Initialize RayTracing class.
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
self._logger = logging.getLogger(__name__)
|
|
66
|
-
self._logger.debug("Initializing RayTracing class")
|
|
67
|
-
|
|
68
|
-
self._simtel_source_path = Path(simtel_source_path)
|
|
69
|
-
self._io_handler = io_handler.IOHandler()
|
|
70
|
-
|
|
71
|
-
self._telescope_model = self._validate_telescope_model(telescope_model)
|
|
72
|
-
|
|
73
|
-
self.config = gen.validate_config_data(
|
|
74
|
-
gen.collect_data_from_file_or_dict(config_file, config_data),
|
|
75
|
-
SimtelRunnerRayTracing.ray_tracing_default_configuration(False),
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
# Due to float representation, round the off-axis angles so the values in results table
|
|
79
|
-
# are the same as provided.
|
|
80
|
-
self.config = self.config._replace(off_axis_angle=np.around(self.config.off_axis_angle, 5))
|
|
81
|
-
|
|
82
|
-
self.label = label if label is not None else self._telescope_model.label
|
|
83
|
-
|
|
84
|
-
self._output_directory = self._io_handler.get_output_directory(
|
|
85
|
-
label=self.label, sub_dir="ray-tracing"
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
# Loading relevant attributes in case of single mirror mode.
|
|
89
|
-
if self.config.single_mirror_mode:
|
|
90
|
-
# Recalculating source distance.
|
|
91
|
-
self._logger.debug(
|
|
92
|
-
"Single mirror mode is activated - "
|
|
93
|
-
"source distance is being recalculated to 2 * flen"
|
|
94
|
-
)
|
|
95
|
-
mir_flen = self._telescope_model.get_parameter_value("mirror_focal_length")
|
|
96
|
-
self._source_distance = 2 * float(mir_flen) * u.cm.to(u.km) # km
|
|
97
|
-
|
|
98
|
-
# Setting mirror numbers.
|
|
99
|
-
if self.config.mirror_numbers[0] == "all":
|
|
100
|
-
self._mirror_numbers = list(
|
|
101
|
-
range(0, self._telescope_model.mirrors.number_of_mirrors)
|
|
102
|
-
)
|
|
103
|
-
else:
|
|
104
|
-
self._mirror_numbers = self.config.mirror_numbers
|
|
105
|
-
else:
|
|
106
|
-
self._source_distance = self.config.source_distance
|
|
107
|
-
|
|
108
|
-
self._psf_images = None
|
|
109
|
-
self._results = None
|
|
110
|
-
self._has_results = False
|
|
111
|
-
|
|
112
|
-
# Results file
|
|
113
|
-
file_name_results = names.ray_tracing_results_file_name(
|
|
114
|
-
self._telescope_model.site,
|
|
115
|
-
self._telescope_model.name,
|
|
116
|
-
self._source_distance,
|
|
117
|
-
self.config.zenith_angle,
|
|
118
|
-
self.label,
|
|
119
|
-
)
|
|
120
|
-
self._output_directory.joinpath("results").mkdir(parents=True, exist_ok=True)
|
|
121
|
-
self._file_results = self._output_directory.joinpath("results").joinpath(file_name_results)
|
|
122
|
-
|
|
123
|
-
@classmethod
|
|
124
|
-
def from_kwargs(cls, **kwargs):
|
|
125
|
-
"""
|
|
126
|
-
Builds a RayTracing object from kwargs only.
|
|
127
|
-
The configurable parameters can be given as kwargs, instead of using the
|
|
128
|
-
config_data or config_file arguments.
|
|
129
|
-
|
|
130
|
-
Parameters
|
|
131
|
-
----------
|
|
132
|
-
kwargs
|
|
133
|
-
Containing the arguments and the configurable parameters.
|
|
134
|
-
|
|
135
|
-
Returns
|
|
136
|
-
-------
|
|
137
|
-
Instance of this class.
|
|
138
|
-
"""
|
|
139
|
-
args, config_data = gen.separate_args_and_config_data(
|
|
140
|
-
expected_args=[
|
|
141
|
-
"telescope_model",
|
|
142
|
-
"label",
|
|
143
|
-
"simtel_source_path",
|
|
144
|
-
],
|
|
145
|
-
**kwargs,
|
|
146
|
-
)
|
|
147
|
-
return cls(**args, config_data=config_data)
|
|
148
|
-
|
|
149
|
-
def __repr__(self):
|
|
150
|
-
"""
|
|
151
|
-
String representation of RayTracing class.
|
|
152
|
-
"""
|
|
153
|
-
return f"RayTracing(label={self.label})\n"
|
|
154
|
-
|
|
155
|
-
def _validate_telescope_model(self, tel):
|
|
156
|
-
"""Validate TelescopeModel"""
|
|
157
|
-
if isinstance(tel, TelescopeModel):
|
|
158
|
-
self._logger.debug("RayTracing contains a valid TelescopeModel")
|
|
159
|
-
return tel
|
|
160
|
-
|
|
161
|
-
msg = "Invalid TelescopeModel"
|
|
162
|
-
self._logger.error(msg)
|
|
163
|
-
raise ValueError(msg)
|
|
164
|
-
|
|
165
|
-
def simulate(self, test=False, force=False):
|
|
166
|
-
"""
|
|
167
|
-
Simulate RayTracing using SimtelRunnerRayTracing.
|
|
168
|
-
|
|
169
|
-
Parameters
|
|
170
|
-
----------
|
|
171
|
-
test: bool
|
|
172
|
-
Test flag will make it faster by simulating much fewer photons.
|
|
173
|
-
force: bool
|
|
174
|
-
Force flag will remove existing files and simulate again.
|
|
175
|
-
"""
|
|
176
|
-
all_mirrors = self._mirror_numbers if self.config.single_mirror_mode else [0]
|
|
177
|
-
for this_off_axis in self.config.off_axis_angle:
|
|
178
|
-
for this_mirror in all_mirrors:
|
|
179
|
-
self._logger.info(
|
|
180
|
-
f"Simulating RayTracing for off_axis={this_off_axis}, mirror={this_mirror}"
|
|
181
|
-
)
|
|
182
|
-
simtel = SimtelRunnerRayTracing(
|
|
183
|
-
simtel_source_path=self._simtel_source_path,
|
|
184
|
-
telescope_model=self._telescope_model,
|
|
185
|
-
test=test,
|
|
186
|
-
config_data={
|
|
187
|
-
"zenith_angle": self.config.zenith_angle * u.deg,
|
|
188
|
-
"source_distance": self._source_distance * u.km,
|
|
189
|
-
"off_axis_angle": this_off_axis * u.deg,
|
|
190
|
-
"mirror_numbers": this_mirror,
|
|
191
|
-
"use_random_focal_length": self.config.use_random_focal_length,
|
|
192
|
-
"single_mirror_mode": self.config.single_mirror_mode,
|
|
193
|
-
},
|
|
194
|
-
force_simulate=force,
|
|
195
|
-
)
|
|
196
|
-
simtel.run(test=test, force=force)
|
|
197
|
-
|
|
198
|
-
photons_file_name = names.ray_tracing_file_name(
|
|
199
|
-
self._telescope_model.site,
|
|
200
|
-
self._telescope_model.name,
|
|
201
|
-
self._source_distance,
|
|
202
|
-
self.config.zenith_angle,
|
|
203
|
-
this_off_axis,
|
|
204
|
-
this_mirror if self.config.single_mirror_mode else None,
|
|
205
|
-
self.label,
|
|
206
|
-
"photons",
|
|
207
|
-
)
|
|
208
|
-
photons_file = self._output_directory.joinpath(photons_file_name)
|
|
209
|
-
|
|
210
|
-
self._logger.debug("Using gzip to compress the photons file.")
|
|
211
|
-
|
|
212
|
-
with open(photons_file, "rb") as f_in:
|
|
213
|
-
with gzip.open(
|
|
214
|
-
photons_file.with_suffix(photons_file.suffix + ".gz"), "wb"
|
|
215
|
-
) as f_out:
|
|
216
|
-
shutil.copyfileobj(f_in, f_out)
|
|
217
|
-
photons_file.unlink()
|
|
218
|
-
|
|
219
|
-
def analyze(
|
|
220
|
-
self,
|
|
221
|
-
export=True,
|
|
222
|
-
force=False,
|
|
223
|
-
use_rx=False,
|
|
224
|
-
no_tel_transmission=False,
|
|
225
|
-
containment_fraction=0.8,
|
|
226
|
-
):
|
|
227
|
-
"""
|
|
228
|
-
Analyze RayTracing, meaning read simtel files, compute psfs and eff areas and store the
|
|
229
|
-
results in _results.
|
|
230
|
-
|
|
231
|
-
Parameters
|
|
232
|
-
----------
|
|
233
|
-
export: bool
|
|
234
|
-
If True, results will be exported to a file automatically. Alternatively,
|
|
235
|
-
export_results function can be used.
|
|
236
|
-
force: bool
|
|
237
|
-
If True, existing results files will be removed and analysis will be done again.
|
|
238
|
-
use_rx: bool
|
|
239
|
-
If True, calculations are done using the rx binary provided by sim_telarray. If False,
|
|
240
|
-
calculations are done internally, by the module psf_analysis.
|
|
241
|
-
no_tel_transmission: bool
|
|
242
|
-
If True, the telescope transmission is not applied.
|
|
243
|
-
containment_fraction: float
|
|
244
|
-
Containment fraction for PSF containment calculation. Allowed values are in the
|
|
245
|
-
inverval [0,1]
|
|
246
|
-
"""
|
|
247
|
-
|
|
248
|
-
do_analyze = not self._file_results.exists() or force
|
|
249
|
-
|
|
250
|
-
focal_length = float(self._telescope_model.get_parameter_value("focal_length"))
|
|
251
|
-
tel_transmission_pars = (
|
|
252
|
-
self._telescope_model.get_telescope_transmission_parameters()
|
|
253
|
-
if not no_tel_transmission
|
|
254
|
-
else [1, 0, 0, 0]
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
cm_to_deg = 180.0 / pi / focal_length
|
|
258
|
-
|
|
259
|
-
self._psf_images = {}
|
|
260
|
-
if do_analyze:
|
|
261
|
-
_rows = []
|
|
262
|
-
else:
|
|
263
|
-
self._read_results()
|
|
264
|
-
|
|
265
|
-
all_mirrors = self._mirror_numbers if self.config.single_mirror_mode else [0]
|
|
266
|
-
for this_off_axis in self.config.off_axis_angle:
|
|
267
|
-
for this_mirror in all_mirrors:
|
|
268
|
-
self._logger.debug(f"Analyzing RayTracing for off_axis={this_off_axis}")
|
|
269
|
-
if self.config.single_mirror_mode:
|
|
270
|
-
self._logger.debug(f"mirror_number={this_mirror}")
|
|
271
|
-
|
|
272
|
-
photons_file_name = names.ray_tracing_file_name(
|
|
273
|
-
self._telescope_model.site,
|
|
274
|
-
self._telescope_model.name,
|
|
275
|
-
self._source_distance,
|
|
276
|
-
self.config.zenith_angle,
|
|
277
|
-
this_off_axis,
|
|
278
|
-
this_mirror if self.config.single_mirror_mode else None,
|
|
279
|
-
self.label,
|
|
280
|
-
"photons",
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
photons_file = self._output_directory.joinpath(photons_file_name + ".gz")
|
|
284
|
-
tel_transmission = compute_telescope_transmission(
|
|
285
|
-
tel_transmission_pars, this_off_axis
|
|
286
|
-
)
|
|
287
|
-
image = PSFImage(focal_length, None)
|
|
288
|
-
image.read_photon_list_from_simtel_file(photons_file)
|
|
289
|
-
self._psf_images[this_off_axis] = copy(image)
|
|
290
|
-
|
|
291
|
-
if not do_analyze:
|
|
292
|
-
continue
|
|
293
|
-
|
|
294
|
-
if use_rx:
|
|
295
|
-
containment_diameter_cm, centroid_x, centroid_y, eff_area = self._process_rx(
|
|
296
|
-
photons_file
|
|
297
|
-
)
|
|
298
|
-
containment_diameter_deg = containment_diameter_cm * cm_to_deg
|
|
299
|
-
image.set_psf(containment_diameter_cm, fraction=containment_fraction, unit="cm")
|
|
300
|
-
image.centroid_x = centroid_x
|
|
301
|
-
image.centroid_y = centroid_y
|
|
302
|
-
image.set_effective_area(eff_area * tel_transmission)
|
|
303
|
-
else:
|
|
304
|
-
containment_diameter_cm = image.get_psf(containment_fraction, "cm")
|
|
305
|
-
containment_diameter_deg = image.get_psf(containment_fraction, "deg")
|
|
306
|
-
centroid_x = image.centroid_x
|
|
307
|
-
centroid_y = image.centroid_y
|
|
308
|
-
eff_area = image.get_effective_area() * tel_transmission
|
|
309
|
-
|
|
310
|
-
eff_flen = (
|
|
311
|
-
np.nan if this_off_axis == 0 else centroid_x / tan(this_off_axis * pi / 180.0)
|
|
312
|
-
)
|
|
313
|
-
_current_results = (
|
|
314
|
-
this_off_axis * u.deg,
|
|
315
|
-
containment_diameter_cm * u.cm,
|
|
316
|
-
containment_diameter_deg * u.deg,
|
|
317
|
-
eff_area * u.m * u.m,
|
|
318
|
-
eff_flen * u.cm,
|
|
319
|
-
)
|
|
320
|
-
if self.config.single_mirror_mode:
|
|
321
|
-
_current_results += (this_mirror,)
|
|
322
|
-
_rows.append(_current_results)
|
|
323
|
-
|
|
324
|
-
if do_analyze:
|
|
325
|
-
_columns = ["Off-axis angle"]
|
|
326
|
-
_columns.extend(list(self.YLABEL.keys()))
|
|
327
|
-
if self.config.single_mirror_mode:
|
|
328
|
-
_columns.append("mirror_number")
|
|
329
|
-
self._results = QTable(rows=_rows, names=_columns)
|
|
330
|
-
|
|
331
|
-
self._has_results = True
|
|
332
|
-
if export:
|
|
333
|
-
self.export_results()
|
|
334
|
-
|
|
335
|
-
def _process_rx(self, file, containment_fraction=0.8):
|
|
336
|
-
"""
|
|
337
|
-
Process sim_telarray photon list with rx binary and return the results
|
|
338
|
-
(containment_diameter_cm, centroids and eff area).
|
|
339
|
-
|
|
340
|
-
Parameters
|
|
341
|
-
----------
|
|
342
|
-
file: str or Path
|
|
343
|
-
Photon list file.
|
|
344
|
-
containment_fraction: float
|
|
345
|
-
Containment fraction for PSF containment calculation. Allowed values are in the
|
|
346
|
-
inverval [0,1]
|
|
347
|
-
|
|
348
|
-
Returns
|
|
349
|
-
-------
|
|
350
|
-
(containment_diameter_cm, x_mean, y_mean, eff_area)
|
|
351
|
-
|
|
352
|
-
"""
|
|
353
|
-
|
|
354
|
-
try:
|
|
355
|
-
rx_output = subprocess.Popen( # pylint: disable=consider-using-with
|
|
356
|
-
shlex.split(
|
|
357
|
-
f"{self._simtel_source_path}/sim_telarray/bin/rx "
|
|
358
|
-
f"-f {containment_fraction:.2f} -v"
|
|
359
|
-
),
|
|
360
|
-
stdin=subprocess.PIPE,
|
|
361
|
-
stdout=subprocess.PIPE,
|
|
362
|
-
)
|
|
363
|
-
with gzip.open(file, "rb") as _stdin:
|
|
364
|
-
with rx_output.stdin:
|
|
365
|
-
shutil.copyfileobj(_stdin, rx_output.stdin)
|
|
366
|
-
try:
|
|
367
|
-
rx_output = rx_output.communicate()[0].splitlines()[-1:][0].split()
|
|
368
|
-
except IndexError:
|
|
369
|
-
self._logger.error(f"Invalid output from rx: {rx_output}")
|
|
370
|
-
raise
|
|
371
|
-
except FileNotFoundError:
|
|
372
|
-
self._logger.error(f"Photon list file not found: {file}")
|
|
373
|
-
raise
|
|
374
|
-
containment_diameter_cm = 2 * float(rx_output[0])
|
|
375
|
-
x_mean = float(rx_output[1])
|
|
376
|
-
y_mean = float(rx_output[2])
|
|
377
|
-
eff_area = float(rx_output[5])
|
|
378
|
-
return containment_diameter_cm, x_mean, y_mean, eff_area
|
|
379
|
-
|
|
380
|
-
def export_results(self):
|
|
381
|
-
"""Export results to a csv file."""
|
|
382
|
-
if not self._has_results:
|
|
383
|
-
self._logger.error("Cannot export results because it does not exist")
|
|
384
|
-
else:
|
|
385
|
-
self._logger.info(f"Exporting results to {self._file_results}")
|
|
386
|
-
astropy.io.ascii.write(self._results, self._file_results, format="ecsv", overwrite=True)
|
|
387
|
-
|
|
388
|
-
def _read_results(self):
|
|
389
|
-
"""Read existing results file and store it in _results."""
|
|
390
|
-
self._results = astropy.io.ascii.read(self._file_results, format="ecsv")
|
|
391
|
-
self._has_results = True
|
|
392
|
-
|
|
393
|
-
def plot(self, key, save=False, **kwargs):
|
|
394
|
-
"""
|
|
395
|
-
Plot key vs off-axis angle and save the figure in pdf.
|
|
396
|
-
|
|
397
|
-
Parameters
|
|
398
|
-
----------
|
|
399
|
-
key: str
|
|
400
|
-
d80_cm, d80_deg, eff_area or eff_flen
|
|
401
|
-
save: bool
|
|
402
|
-
If True, figure will be saved.
|
|
403
|
-
**kwargs:
|
|
404
|
-
kwargs for plt.plot
|
|
405
|
-
|
|
406
|
-
Raises
|
|
407
|
-
------
|
|
408
|
-
KeyError
|
|
409
|
-
If key is not among the valid options.
|
|
410
|
-
"""
|
|
411
|
-
if key not in self.YLABEL:
|
|
412
|
-
msg = "Invalid key to plot"
|
|
413
|
-
self._logger.error(msg)
|
|
414
|
-
raise KeyError(msg)
|
|
415
|
-
|
|
416
|
-
self._logger.info(f"Plotting {key} vs off-axis angle")
|
|
417
|
-
|
|
418
|
-
plot = visualize.plot_table(
|
|
419
|
-
self._results["Off-axis angle", key], self.YLABEL[key], no_legend=True, **kwargs
|
|
420
|
-
)
|
|
421
|
-
|
|
422
|
-
if save:
|
|
423
|
-
plot_file_name = names.ray_tracing_plot_file_name(
|
|
424
|
-
key,
|
|
425
|
-
self._telescope_model.site,
|
|
426
|
-
self._telescope_model.name,
|
|
427
|
-
self._source_distance,
|
|
428
|
-
self.config.zenith_angle,
|
|
429
|
-
self.label,
|
|
430
|
-
)
|
|
431
|
-
self._output_directory.joinpath("figures").mkdir(exist_ok=True)
|
|
432
|
-
plot_file = self._output_directory.joinpath("figures").joinpath(plot_file_name)
|
|
433
|
-
self._logger.info(f"Saving fig in {plot_file}")
|
|
434
|
-
plot.savefig(plot_file)
|
|
435
|
-
|
|
436
|
-
def plot_histogram(self, key, **kwargs):
|
|
437
|
-
"""
|
|
438
|
-
Plot histogram of key.
|
|
439
|
-
|
|
440
|
-
Parameters
|
|
441
|
-
----------
|
|
442
|
-
key: str
|
|
443
|
-
d80_cm, d80_deg, eff_area or eff_flen
|
|
444
|
-
**kwargs:
|
|
445
|
-
kwargs for plt.hist
|
|
446
|
-
|
|
447
|
-
Raises
|
|
448
|
-
------
|
|
449
|
-
KeyError
|
|
450
|
-
If key is not among the valid options.
|
|
451
|
-
"""
|
|
452
|
-
if key not in self.YLABEL:
|
|
453
|
-
msg = "Invalid key to plot"
|
|
454
|
-
self._logger.error(msg)
|
|
455
|
-
raise KeyError(msg)
|
|
456
|
-
|
|
457
|
-
ax = plt.gca()
|
|
458
|
-
ax.hist([r.value for r in self._results[key]], **kwargs)
|
|
459
|
-
|
|
460
|
-
def get_mean(self, key):
|
|
461
|
-
"""
|
|
462
|
-
Get mean value of key.
|
|
463
|
-
|
|
464
|
-
Parameters
|
|
465
|
-
----------
|
|
466
|
-
key: str
|
|
467
|
-
d80_cm, d80_deg, eff_area or eff_flen
|
|
468
|
-
|
|
469
|
-
Returns
|
|
470
|
-
-------
|
|
471
|
-
float
|
|
472
|
-
Mean value of key.
|
|
473
|
-
|
|
474
|
-
Raises
|
|
475
|
-
------
|
|
476
|
-
KeyError
|
|
477
|
-
If key is not among the valid options.
|
|
478
|
-
"""
|
|
479
|
-
if key not in self.YLABEL:
|
|
480
|
-
msg = "Invalid key to plot"
|
|
481
|
-
self._logger.error(msg)
|
|
482
|
-
raise KeyError(msg)
|
|
483
|
-
return np.mean(self._results[key])
|
|
484
|
-
|
|
485
|
-
def get_std_dev(self, key):
|
|
486
|
-
"""
|
|
487
|
-
Get std dev of key.
|
|
488
|
-
|
|
489
|
-
Parameters
|
|
490
|
-
----------
|
|
491
|
-
key: str
|
|
492
|
-
d80_cm, d80_deg, eff_area or eff_flen
|
|
493
|
-
|
|
494
|
-
Returns
|
|
495
|
-
-------
|
|
496
|
-
float
|
|
497
|
-
Std deviation of key.
|
|
498
|
-
|
|
499
|
-
Raises
|
|
500
|
-
------
|
|
501
|
-
KeyError
|
|
502
|
-
If key is not among the valid options.
|
|
503
|
-
"""
|
|
504
|
-
if key not in self.YLABEL:
|
|
505
|
-
msg = "Invalid key to plot"
|
|
506
|
-
self._logger.error(msg)
|
|
507
|
-
raise KeyError(msg)
|
|
508
|
-
return np.std(self._results[key])
|
|
509
|
-
|
|
510
|
-
def images(self):
|
|
511
|
-
"""
|
|
512
|
-
Get list of PSFImages.
|
|
513
|
-
|
|
514
|
-
Returns
|
|
515
|
-
-------
|
|
516
|
-
List of PSFImage's
|
|
517
|
-
"""
|
|
518
|
-
images = []
|
|
519
|
-
for this_off_axis in self.config.off_axis_angle:
|
|
520
|
-
if self._psf_images and this_off_axis in self._psf_images:
|
|
521
|
-
images.append(self._psf_images[this_off_axis])
|
|
522
|
-
if len(images) == 0:
|
|
523
|
-
self._logger.error("No image found")
|
|
524
|
-
return None
|
|
525
|
-
return images
|