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
simtools/camera_efficiency.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Camera efficiency simulations and analysis."""
|
|
2
|
+
|
|
1
3
|
import logging
|
|
2
4
|
import re
|
|
3
5
|
from collections import defaultdict
|
|
@@ -6,10 +8,10 @@ import astropy.io.ascii
|
|
|
6
8
|
import numpy as np
|
|
7
9
|
from astropy.table import Table
|
|
8
10
|
|
|
9
|
-
import simtools.utils.general as gen
|
|
10
11
|
from simtools.io_operations import io_handler
|
|
12
|
+
from simtools.model.site_model import SiteModel
|
|
11
13
|
from simtools.model.telescope_model import TelescopeModel
|
|
12
|
-
from simtools.simtel.
|
|
14
|
+
from simtools.simtel.simulator_camera_efficiency import SimulatorCameraEfficiency
|
|
13
15
|
from simtools.utils import names
|
|
14
16
|
from simtools.visualization import visualize
|
|
15
17
|
|
|
@@ -18,167 +20,169 @@ __all__ = ["CameraEfficiency"]
|
|
|
18
20
|
|
|
19
21
|
class CameraEfficiency:
|
|
20
22
|
"""
|
|
21
|
-
|
|
23
|
+
Camera efficiency simulations and analysis.
|
|
22
24
|
|
|
23
25
|
Parameters
|
|
24
26
|
----------
|
|
25
|
-
|
|
26
|
-
Instance of the TelescopeModel class.
|
|
27
|
-
simtel_source_path: str (or Path)
|
|
27
|
+
simtel_path: str (or Path)
|
|
28
28
|
Location of sim_telarray installation.
|
|
29
|
+
db_config: dict
|
|
30
|
+
Configuration for the database.
|
|
29
31
|
label: str
|
|
30
32
|
Instance label, optional.
|
|
31
33
|
config_data: dict.
|
|
32
34
|
Dict containing the configurable parameters.
|
|
33
|
-
config_file: str or Path
|
|
34
|
-
Path of the yaml file containing the configurable parameters.
|
|
35
35
|
test: bool
|
|
36
36
|
Is it a test instance (at the moment only affects the location of files).
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
39
|
def __init__(
|
|
40
40
|
self,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
label
|
|
44
|
-
|
|
45
|
-
config_file=None,
|
|
41
|
+
simtel_path,
|
|
42
|
+
config_data,
|
|
43
|
+
label,
|
|
44
|
+
db_config,
|
|
46
45
|
test=False,
|
|
47
46
|
):
|
|
48
|
-
"""
|
|
49
|
-
Initiliaze the CameraEfficiency class.
|
|
50
|
-
"""
|
|
51
|
-
|
|
47
|
+
"""Initialize the CameraEfficiency class."""
|
|
52
48
|
self._logger = logging.getLogger(__name__)
|
|
53
49
|
|
|
54
|
-
self.
|
|
55
|
-
self.
|
|
56
|
-
self.label = label if label is not None else self._telescope_model.label
|
|
50
|
+
self._simtel_path = simtel_path
|
|
51
|
+
self.label = label
|
|
57
52
|
self.test = test
|
|
58
53
|
|
|
59
54
|
self.io_handler = io_handler.IOHandler()
|
|
60
|
-
self.
|
|
61
|
-
|
|
62
|
-
sub_dir="camera-efficiency",
|
|
63
|
-
dir_type="test" if self.test else "simtools",
|
|
55
|
+
self.telescope_model, self._site_model = self._initialize_simulation_models(
|
|
56
|
+
config_data, db_config
|
|
64
57
|
)
|
|
58
|
+
self.output_dir = self.io_handler.get_output_directory(self.label, sub_dir="plots")
|
|
65
59
|
|
|
66
60
|
self._results = None
|
|
67
61
|
self._has_results = False
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
_parameter_file = self.io_handler.get_input_data_file(
|
|
73
|
-
"parameters", "camera-efficiency_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)
|
|
63
|
+
self.config = self._configuration_from_args_dict(config_data)
|
|
64
|
+
self._file = self._load_files()
|
|
77
65
|
|
|
78
|
-
|
|
66
|
+
def __repr__(self):
|
|
67
|
+
"""Return string representation of the CameraEfficiency instance."""
|
|
68
|
+
return f"CameraEfficiency(label={self.label})\n"
|
|
79
69
|
|
|
80
|
-
|
|
81
|
-
def from_kwargs(cls, **kwargs):
|
|
70
|
+
def _initialize_simulation_models(self, config_data, db_config):
|
|
82
71
|
"""
|
|
83
|
-
|
|
84
|
-
The configurable parameters can be given as kwargs, instead of using the
|
|
85
|
-
config_data or config_file arguments.
|
|
72
|
+
Initialize site and telescope models.
|
|
86
73
|
|
|
87
74
|
Parameters
|
|
88
75
|
----------
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
config_data: dict
|
|
77
|
+
Dict containing the configurable parameters.
|
|
91
78
|
|
|
92
79
|
Returns
|
|
93
80
|
-------
|
|
94
|
-
|
|
81
|
+
tuple
|
|
82
|
+
Tuple containing the site and telescope models.
|
|
95
83
|
"""
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
tel_model = TelescopeModel(
|
|
85
|
+
site=config_data["site"],
|
|
86
|
+
telescope_name=config_data["telescope"],
|
|
87
|
+
mongo_db_config=db_config,
|
|
88
|
+
model_version=config_data["model_version"],
|
|
89
|
+
label=self.label,
|
|
90
|
+
)
|
|
91
|
+
site_model = SiteModel(
|
|
92
|
+
site=config_data["site"],
|
|
93
|
+
model_version=config_data["model_version"],
|
|
94
|
+
mongo_db_config=db_config,
|
|
104
95
|
)
|
|
105
|
-
return
|
|
96
|
+
return tel_model, site_model
|
|
106
97
|
|
|
107
|
-
def
|
|
108
|
-
|
|
98
|
+
def _configuration_from_args_dict(self, config_data):
|
|
99
|
+
"""
|
|
100
|
+
Extract the configuration data from the args_dict.
|
|
109
101
|
|
|
110
|
-
|
|
111
|
-
"""Validate TelescopeModel
|
|
102
|
+
Zenith and azimuth angles are set to default values if not provided.
|
|
112
103
|
|
|
113
104
|
Parameters
|
|
114
105
|
----------
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Raises
|
|
118
|
-
------
|
|
119
|
-
ValueError
|
|
120
|
-
if tel not of type TelescopeModel
|
|
106
|
+
config_data: dict
|
|
107
|
+
Dict containing the configurable parameters.
|
|
121
108
|
|
|
109
|
+
Returns
|
|
110
|
+
-------
|
|
111
|
+
dict
|
|
112
|
+
Configuration data.
|
|
122
113
|
"""
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
zenith_angle = config_data.get("zenith_angle")
|
|
115
|
+
if zenith_angle is not None:
|
|
116
|
+
zenith_angle = zenith_angle.to("deg").value
|
|
117
|
+
else:
|
|
118
|
+
zenith_angle = 20.0
|
|
119
|
+
self._logger.info(f"Setting zenith angle to default value {zenith_angle} deg")
|
|
120
|
+
azimuth_angle = config_data.get("azimuth_angle")
|
|
121
|
+
if azimuth_angle is not None:
|
|
122
|
+
azimuth_angle = azimuth_angle.to("deg").value
|
|
123
|
+
else:
|
|
124
|
+
azimuth_angle = 0.0
|
|
125
|
+
self._logger.info(f"Setting azimuth angle to default value {azimuth_angle} deg")
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
return {
|
|
128
|
+
"zenith_angle": zenith_angle,
|
|
129
|
+
"azimuth_angle": azimuth_angle,
|
|
130
|
+
"nsb_spectrum": config_data.get("nsb_spectrum", None),
|
|
131
|
+
}
|
|
130
132
|
|
|
131
133
|
def _load_files(self):
|
|
132
134
|
"""Define the variables for the file names, including the results, simtel and log file."""
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
)
|
|
150
|
-
self._file_simtel = self._base_directory.joinpath(file_name_simtel)
|
|
151
|
-
# Log file
|
|
152
|
-
file_name_log = names.camera_efficiency_log_file_name(
|
|
153
|
-
site=self._telescope_model.site,
|
|
154
|
-
telescope_model_name=self._telescope_model.name,
|
|
155
|
-
zenith_angle=self.config.zenith_angle,
|
|
156
|
-
azimuth_angle=self.config.azimuth_angle,
|
|
157
|
-
label=self.label,
|
|
158
|
-
)
|
|
159
|
-
self._file_log = self._base_directory.joinpath(file_name_log)
|
|
135
|
+
_file = {}
|
|
136
|
+
for label, suffix in zip(
|
|
137
|
+
["results", "simtel", "log"],
|
|
138
|
+
[".ecsv", ".dat", ".log"],
|
|
139
|
+
):
|
|
140
|
+
file_name = names.generate_file_name(
|
|
141
|
+
file_type=(
|
|
142
|
+
"camera-efficiency-table" if label == "results" else "camera-efficiency"
|
|
143
|
+
),
|
|
144
|
+
suffix=suffix,
|
|
145
|
+
site=self.telescope_model.site,
|
|
146
|
+
telescope_model_name=self.telescope_model.name,
|
|
147
|
+
zenith_angle=self.config["zenith_angle"],
|
|
148
|
+
azimuth_angle=self.config["azimuth_angle"],
|
|
149
|
+
label=self.label,
|
|
150
|
+
)
|
|
160
151
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
_file[label] = self.io_handler.get_output_directory(
|
|
153
|
+
label=self.label,
|
|
154
|
+
sub_dir="camera-efficiency",
|
|
155
|
+
).joinpath(file_name)
|
|
156
|
+
return _file
|
|
164
157
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
force: bool
|
|
168
|
-
Force flag will remove existing files and simulate again.
|
|
169
|
-
"""
|
|
158
|
+
def simulate(self):
|
|
159
|
+
"""Simulate camera efficiency using testeff."""
|
|
170
160
|
self._logger.info("Simulating CameraEfficiency")
|
|
171
161
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
162
|
+
self.export_model_files()
|
|
163
|
+
|
|
164
|
+
simtel = SimulatorCameraEfficiency(
|
|
165
|
+
simtel_path=self._simtel_path,
|
|
166
|
+
telescope_model=self.telescope_model,
|
|
167
|
+
zenith_angle=self.config["zenith_angle"],
|
|
168
|
+
file_simtel=self._file["simtel"],
|
|
169
|
+
file_log=self._file["log"],
|
|
178
170
|
label=self.label,
|
|
179
|
-
nsb_spectrum=self.config
|
|
171
|
+
nsb_spectrum=self.config["nsb_spectrum"],
|
|
172
|
+
skip_correction_to_nsb_spectrum=self.config.get(
|
|
173
|
+
"skip_correction_to_nsb_spectrum", False
|
|
174
|
+
),
|
|
180
175
|
)
|
|
181
|
-
simtel.run(test=self.test
|
|
176
|
+
simtel.run(test=self.test)
|
|
177
|
+
|
|
178
|
+
def export_model_files(self):
|
|
179
|
+
"""Export model and config files to the output directory."""
|
|
180
|
+
self.telescope_model.export_config_file()
|
|
181
|
+
self.telescope_model.export_model_files()
|
|
182
|
+
if not self.config.get("skip_correction_to_nsb_spectrum", False):
|
|
183
|
+
self.telescope_model.export_nsb_spectrum_to_telescope_altitude_correction_file(
|
|
184
|
+
model_directory=self.telescope_model.config_file_directory
|
|
185
|
+
)
|
|
182
186
|
|
|
183
187
|
def analyze(self, export=True, force=False):
|
|
184
188
|
"""
|
|
@@ -194,7 +198,7 @@ class CameraEfficiency:
|
|
|
194
198
|
"""
|
|
195
199
|
self._logger.info("Analyzing CameraEfficiency")
|
|
196
200
|
|
|
197
|
-
if self.
|
|
201
|
+
if "results" in self._file and not force:
|
|
198
202
|
self._logger.info("Results file exists and force=False - skipping analyze")
|
|
199
203
|
self._read_results()
|
|
200
204
|
return
|
|
@@ -233,33 +237,33 @@ class CameraEfficiency:
|
|
|
233
237
|
|
|
234
238
|
# Search for at least 5 consecutive numbers to see that we are in the table
|
|
235
239
|
re_table = re.compile("{0}{0}{0}{0}{0}".format(r"[-+]?[0-9]*\.?[0-9]+\s+"))
|
|
236
|
-
with open(self.
|
|
240
|
+
with open(self._file["simtel"], encoding="utf-8") as file:
|
|
237
241
|
for line in file:
|
|
238
242
|
if re_table.match(line):
|
|
239
243
|
words = line.split()
|
|
240
244
|
numbers = [float(w) for w in words]
|
|
241
245
|
for i in range(len(eff_pars) - 10):
|
|
242
246
|
_results[eff_pars[i]].append(numbers[i])
|
|
243
|
-
C1 = numbers[8] * (400 / numbers[0]) ** 2
|
|
244
|
-
C2 = C1 * numbers[4] * numbers[5]
|
|
245
|
-
C3 = C2 * numbers[6] * numbers[7]
|
|
246
|
-
C4 = C3 * numbers[3]
|
|
247
|
-
|
|
247
|
+
C1 = numbers[8] * (400 / numbers[0]) ** 2 # noqa: N806
|
|
248
|
+
C2 = C1 * numbers[4] * numbers[5] # noqa: N806
|
|
249
|
+
C3 = C2 * numbers[6] * numbers[7] # noqa: N806
|
|
250
|
+
C4 = C3 * numbers[3] # noqa: N806
|
|
251
|
+
c4x_value = C1 * numbers[3] * numbers[6] * numbers[7]
|
|
248
252
|
_results["C1"].append(C1)
|
|
249
253
|
_results["C2"].append(C2)
|
|
250
254
|
_results["C3"].append(C3)
|
|
251
255
|
_results["C4"].append(C4)
|
|
252
|
-
_results["C4x"].append(
|
|
253
|
-
N1 = numbers[14]
|
|
254
|
-
N2 = N1 * numbers[4] * numbers[5]
|
|
255
|
-
N3 = N2 * numbers[6] * numbers[7]
|
|
256
|
-
N4 = N3 * numbers[3]
|
|
257
|
-
|
|
256
|
+
_results["C4x"].append(c4x_value)
|
|
257
|
+
N1 = numbers[14] # noqa: N806
|
|
258
|
+
N2 = N1 * numbers[4] * numbers[5] # noqa: N806
|
|
259
|
+
N3 = N2 * numbers[6] * numbers[7] # noqa: N806
|
|
260
|
+
N4 = N3 * numbers[3] # noqa: N806
|
|
261
|
+
n4x_value = N1 * numbers[3] * numbers[6] * numbers[7]
|
|
258
262
|
_results["N1"].append(N1)
|
|
259
263
|
_results["N2"].append(N2)
|
|
260
264
|
_results["N3"].append(N3)
|
|
261
265
|
_results["N4"].append(N4)
|
|
262
|
-
_results["N4x"].append(
|
|
266
|
+
_results["N4x"].append(n4x_value)
|
|
263
267
|
|
|
264
268
|
self._results = Table(_results)
|
|
265
269
|
self._has_results = True
|
|
@@ -271,31 +275,30 @@ class CameraEfficiency:
|
|
|
271
275
|
if export:
|
|
272
276
|
self.export_results()
|
|
273
277
|
|
|
274
|
-
# END of analyze
|
|
275
|
-
|
|
276
278
|
def results_summary(self):
|
|
277
279
|
"""
|
|
278
280
|
Print a summary of the results.
|
|
281
|
+
|
|
279
282
|
Include a header for the zenith/azimuth settings and the NSB spectrum file which was used.
|
|
280
283
|
The summary includes the various CTAO requirements and the final expected NSB pixel rate.
|
|
281
284
|
"""
|
|
282
285
|
nsb_pixel_pe_per_ns, nsb_rate_ref_conditions = self.calc_nsb_rate()
|
|
283
286
|
nsb_spectrum_text = (
|
|
284
|
-
f"NSB spectrum file: {self.config
|
|
285
|
-
if self.config
|
|
287
|
+
f"NSB spectrum file: {self.config['nsb_spectrum']}"
|
|
288
|
+
if self.config["nsb_spectrum"]
|
|
286
289
|
else "default sim_telarray spectrum."
|
|
287
290
|
)
|
|
288
|
-
|
|
289
|
-
f"Results summary for {self.
|
|
290
|
-
f"zenith={self.config
|
|
291
|
-
f"azimuth={self.config
|
|
291
|
+
return (
|
|
292
|
+
f"Results summary for {self.telescope_model.name} at "
|
|
293
|
+
f"zenith={self.config['zenith_angle']:.1f} deg, "
|
|
294
|
+
f"azimuth={self.config['azimuth_angle']:.1f} deg\n"
|
|
292
295
|
f"Using the {nsb_spectrum_text}\n"
|
|
293
296
|
f"\nSpectrum weighted reflectivity: {self.calc_reflectivity():.4f}\n"
|
|
294
297
|
"Camera nominal efficiency with gaps (B-TEL-1170): "
|
|
295
298
|
f"{self.calc_camera_efficiency():.4f}\n"
|
|
296
299
|
"Telescope total efficiency"
|
|
297
300
|
f" with gaps (was A-PERF-2020): {self.calc_tel_efficiency():.4f}\n"
|
|
298
|
-
"Telescope total Cherenkov light efficiency / sqrt(total NSB
|
|
301
|
+
"Telescope total Cherenkov light efficiency / sqrt(total NSB efficiency) "
|
|
299
302
|
"(A-PERF-2025/B-TEL-0090): "
|
|
300
303
|
f"{self.calc_tot_efficiency(self.calc_tel_efficiency()):.4f}\n"
|
|
301
304
|
"Expected NSB pixel rate for the provided NSB spectrum: "
|
|
@@ -304,19 +307,17 @@ class CameraEfficiency:
|
|
|
304
307
|
f"{nsb_rate_ref_conditions:.4f} [p.e./ns]\n"
|
|
305
308
|
)
|
|
306
309
|
|
|
307
|
-
return summary
|
|
308
|
-
|
|
309
310
|
def export_results(self):
|
|
310
311
|
"""Export results to a ecsv file."""
|
|
311
312
|
if not self._has_results:
|
|
312
313
|
self._logger.error("Cannot export results because they do not exist")
|
|
313
314
|
else:
|
|
314
|
-
self._logger.info(f"Exporting testeff table to {self.
|
|
315
|
+
self._logger.info(f"Exporting testeff table to {self._file['results']}")
|
|
315
316
|
astropy.io.ascii.write(
|
|
316
|
-
self._results, self.
|
|
317
|
+
self._results, self._file["results"], format="basic", overwrite=True
|
|
317
318
|
)
|
|
318
319
|
_results_summary_file = (
|
|
319
|
-
str(self.
|
|
320
|
+
str(self._file["results"]).replace(".ecsv", ".txt").replace("-table-", "-summary-")
|
|
320
321
|
)
|
|
321
322
|
self._logger.info(f"Exporting summary results to {_results_summary_file}")
|
|
322
323
|
with open(_results_summary_file, "w", encoding="utf-8") as file:
|
|
@@ -324,7 +325,7 @@ class CameraEfficiency:
|
|
|
324
325
|
|
|
325
326
|
def _read_results(self):
|
|
326
327
|
"""Read existing results file and store it in _results."""
|
|
327
|
-
table = astropy.io.ascii.read(self.
|
|
328
|
+
table = astropy.io.ascii.read(self._file["results"], format="basic")
|
|
328
329
|
self._results = table
|
|
329
330
|
self._has_results = True
|
|
330
331
|
|
|
@@ -337,18 +338,15 @@ class CameraEfficiency:
|
|
|
337
338
|
tel_efficiency: float
|
|
338
339
|
Telescope efficiency
|
|
339
340
|
"""
|
|
340
|
-
|
|
341
341
|
# Sum(C1) from 300 - 550 nm:
|
|
342
342
|
c1_reduced_wl = self._results["C1"][[299 < wl_now < 551 for wl_now in self._results["wl"]]]
|
|
343
343
|
c1_sum = np.sum(c1_reduced_wl)
|
|
344
344
|
# Sum(C4) from 200 - 999 nm:
|
|
345
345
|
c4_sum = np.sum(self._results["C4"])
|
|
346
346
|
masts_factor = self._results["masts"][0]
|
|
347
|
-
fill_factor = self.
|
|
348
|
-
|
|
349
|
-
tel_efficiency = fill_factor * (c4_sum / (masts_factor * c1_sum))
|
|
347
|
+
fill_factor = self.telescope_model.camera.get_camera_fill_factor()
|
|
350
348
|
|
|
351
|
-
return
|
|
349
|
+
return fill_factor * (c4_sum / (masts_factor * c1_sum))
|
|
352
350
|
|
|
353
351
|
def calc_camera_efficiency(self):
|
|
354
352
|
"""
|
|
@@ -359,7 +357,6 @@ class CameraEfficiency:
|
|
|
359
357
|
cam_efficiency: float
|
|
360
358
|
Wavelength-averaged camera efficiency
|
|
361
359
|
"""
|
|
362
|
-
|
|
363
360
|
# Sum(C1) from 300 - 550 nm:
|
|
364
361
|
c1_reduced_wl = self._results["C1"][[299 < wl_now < 551 for wl_now in self._results["wl"]]]
|
|
365
362
|
c1_sum = np.sum(c1_reduced_wl)
|
|
@@ -368,12 +365,10 @@ class CameraEfficiency:
|
|
|
368
365
|
[299 < wl_now < 551 for wl_now in self._results["wl"]]
|
|
369
366
|
]
|
|
370
367
|
c4x_sum = np.sum(c4x_reduced_wl)
|
|
371
|
-
fill_factor = self.
|
|
368
|
+
fill_factor = self.telescope_model.camera.get_camera_fill_factor()
|
|
372
369
|
|
|
373
370
|
cam_efficiency_no_gaps = c4x_sum / c1_sum
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
return cam_efficiency
|
|
371
|
+
return cam_efficiency_no_gaps * fill_factor
|
|
377
372
|
|
|
378
373
|
def calc_tot_efficiency(self, tel_efficiency):
|
|
379
374
|
"""
|
|
@@ -389,14 +384,13 @@ class CameraEfficiency:
|
|
|
389
384
|
Float
|
|
390
385
|
Telescope total efficiency including gaps
|
|
391
386
|
"""
|
|
392
|
-
|
|
393
387
|
# Sum(N1) from 300 - 550 nm:
|
|
394
388
|
n1_reduced_wl = self._results["N1"][[299 < wl_now < 551 for wl_now in self._results["wl"]]]
|
|
395
389
|
n1_sum = np.sum(n1_reduced_wl)
|
|
396
390
|
# Sum(N4) from 200 - 999 nm:
|
|
397
391
|
n4_sum = np.sum(self._results["N4"])
|
|
398
392
|
masts_factor = self._results["masts"][0]
|
|
399
|
-
fill_factor = self.
|
|
393
|
+
fill_factor = self.telescope_model.camera.get_camera_fill_factor()
|
|
400
394
|
|
|
401
395
|
tel_efficiency_nsb = fill_factor * (n4_sum / (masts_factor * n1_sum))
|
|
402
396
|
|
|
@@ -411,16 +405,13 @@ class CameraEfficiency:
|
|
|
411
405
|
Float
|
|
412
406
|
Cherenkov spectrum weighted reflectivity (300-550 nm)
|
|
413
407
|
"""
|
|
414
|
-
|
|
415
408
|
# Sum(C1) from 300 - 550 nm:
|
|
416
409
|
c1_reduced_wl = self._results["C1"][[299 < wl_now < 551 for wl_now in self._results["wl"]]]
|
|
417
410
|
c1_sum = np.sum(c1_reduced_wl)
|
|
418
411
|
# Sum(C2) from 300 - 550 nm:
|
|
419
412
|
c2_reduced_wl = self._results["C2"][[299 < wl_now < 551 for wl_now in self._results["wl"]]]
|
|
420
413
|
c2_sum = np.sum(c2_reduced_wl)
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return cher_spec_weighted_reflectivity
|
|
414
|
+
return c2_sum / c1_sum / self._results["masts"][0]
|
|
424
415
|
|
|
425
416
|
def calc_nsb_rate(self):
|
|
426
417
|
"""
|
|
@@ -434,12 +425,11 @@ class CameraEfficiency:
|
|
|
434
425
|
NSB pixel rate in p.e./ns for reference conditions
|
|
435
426
|
(https://jama.cta-observatory.org/perspective.req#/items/26694?projectId=11)
|
|
436
427
|
"""
|
|
437
|
-
|
|
438
428
|
nsb_rate_provided_spectrum = (
|
|
439
429
|
np.sum(self._results["N4"])
|
|
440
|
-
* self.
|
|
441
|
-
* self.
|
|
442
|
-
/ self.
|
|
430
|
+
* self.telescope_model.camera.get_pixel_active_solid_angle()
|
|
431
|
+
* self.telescope_model.get_on_axis_eff_optical_area().to("m2").value
|
|
432
|
+
/ self.telescope_model.get_parameter_value("telescope_transmission")[0]
|
|
443
433
|
)
|
|
444
434
|
|
|
445
435
|
# (integral is in ph./(m^2 ns sr) ) from 300 - 650 nm:
|
|
@@ -452,29 +442,40 @@ class CameraEfficiency:
|
|
|
452
442
|
nsb_integral = 0.0001 * (n1_sum - 0.5 * n1_integral_edges_sum)
|
|
453
443
|
nsb_rate_ref_conditions = (
|
|
454
444
|
nsb_rate_provided_spectrum
|
|
455
|
-
* self.
|
|
445
|
+
* self._site_model.get_parameter_value("nsb_reference_value")
|
|
456
446
|
/ nsb_integral
|
|
457
447
|
)
|
|
458
448
|
return nsb_rate_provided_spectrum, nsb_rate_ref_conditions
|
|
459
449
|
|
|
460
|
-
def
|
|
450
|
+
def plot_efficiency(self, efficiency_type, save_fig=False):
|
|
461
451
|
"""
|
|
462
|
-
Plot
|
|
452
|
+
Plot efficiency vs wavelength.
|
|
453
|
+
|
|
454
|
+
Parameters
|
|
455
|
+
----------
|
|
456
|
+
efficiency_type: str
|
|
457
|
+
The type of efficiency to plot (Cherenkov 'C' or NSB 'N')
|
|
458
|
+
save_fig: bool
|
|
459
|
+
If True, the figure will be saved to a file.
|
|
463
460
|
|
|
464
461
|
Returns
|
|
465
462
|
-------
|
|
466
463
|
fig
|
|
467
464
|
The figure instance of pyplot
|
|
468
465
|
"""
|
|
469
|
-
self._logger.info("Plotting
|
|
466
|
+
self._logger.info(f"Plotting {efficiency_type} efficiency vs wavelength")
|
|
467
|
+
|
|
468
|
+
_col_type = "C" if efficiency_type == "Cherenkov" else "N"
|
|
470
469
|
|
|
471
470
|
column_titles = {
|
|
472
471
|
"wl": "Wavelength [nm]",
|
|
473
|
-
"
|
|
474
|
-
"
|
|
475
|
-
"
|
|
476
|
-
"
|
|
477
|
-
"
|
|
472
|
+
f"{_col_type}1": rf"{_col_type}1: Cherenkov light on ground",
|
|
473
|
+
f"{_col_type}2": rf"{_col_type}2: {_col_type}1 $\times$ ref. $\times$ masts",
|
|
474
|
+
f"{_col_type}3": rf"{_col_type}3: {_col_type}2 $\times$ filter $\times$ lightguide",
|
|
475
|
+
f"{_col_type}4": rf"{_col_type}4: {_col_type}3 $\times$ q.e.",
|
|
476
|
+
f"{_col_type}4x": (
|
|
477
|
+
rf"{_col_type}4x: {_col_type}1 $\times$ filter $\times$ lightguide $\times$ q.e."
|
|
478
|
+
),
|
|
478
479
|
}
|
|
479
480
|
|
|
480
481
|
table_to_plot = Table([self._results[col_now] for col_now in column_titles])
|
|
@@ -482,48 +483,38 @@ class CameraEfficiency:
|
|
|
482
483
|
for column_now, column_title in column_titles.items():
|
|
483
484
|
table_to_plot.rename_column(column_now, column_title)
|
|
484
485
|
|
|
485
|
-
|
|
486
|
+
y_title = f"{efficiency_type} light efficiency"
|
|
487
|
+
if efficiency_type == "NSB":
|
|
488
|
+
y_title = r"Diff. ph. rate [$10^{9} \times $ph/(nm s m$^2$ sr)]"
|
|
489
|
+
plot = visualize.plot_table(
|
|
486
490
|
table_to_plot,
|
|
487
|
-
y_title=
|
|
488
|
-
title=f"{self.
|
|
491
|
+
y_title=y_title,
|
|
492
|
+
title=f"{self.telescope_model.name} response to {efficiency_type} light",
|
|
489
493
|
no_markers=True,
|
|
490
494
|
)
|
|
495
|
+
if efficiency_type == "NSB":
|
|
496
|
+
plot.gca().set_yscale("log")
|
|
497
|
+
ylim = plot.gca().get_ylim()
|
|
498
|
+
plot.gca().set_ylim(1e-3, ylim[1])
|
|
499
|
+
if save_fig:
|
|
500
|
+
self._save_plot(plot, efficiency_type.lower())
|
|
501
|
+
return plot
|
|
491
502
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
def plot_nsb_efficiency(self):
|
|
503
|
+
def _save_plot(self, fig, plot_title):
|
|
495
504
|
"""
|
|
496
|
-
|
|
505
|
+
Save plot to pdf and png file.
|
|
497
506
|
|
|
498
|
-
|
|
499
|
-
|
|
507
|
+
Parameters
|
|
508
|
+
----------
|
|
500
509
|
fig
|
|
501
510
|
The figure instance of pyplot
|
|
511
|
+
plot_title: str
|
|
512
|
+
The title of the plot
|
|
502
513
|
"""
|
|
503
|
-
self.
|
|
504
|
-
|
|
505
|
-
"wl": "Wavelength [nm]",
|
|
506
|
-
"N1": r"N1: NSB light on ground (B\&E)",
|
|
507
|
-
"N2": r"N2: N1 $\times$ ref. $\times$ masts",
|
|
508
|
-
"N3": r"N3: N2 $\times$ filter $\times$ lightguide",
|
|
509
|
-
"N4": r"N4: N3 $\times$ q.e.",
|
|
510
|
-
"N4x": r"N4x: N1 $\times$ filter $\times$ lightguide $\times$ q.e.",
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
table_to_plot = Table([self._results[col_now] for col_now in column_titles])
|
|
514
|
-
|
|
515
|
-
for column_now, column_title in column_titles.items():
|
|
516
|
-
table_to_plot.rename_column(column_now, column_title)
|
|
517
|
-
|
|
518
|
-
plot = visualize.plot_table(
|
|
519
|
-
table_to_plot,
|
|
520
|
-
y_title="Nightsky background light efficiency",
|
|
521
|
-
title=f"{self._telescope_model.name} response to nightsky background light",
|
|
522
|
-
no_markers=True,
|
|
514
|
+
plot_file = self.output_dir.joinpath(
|
|
515
|
+
self.label + "_" + self.telescope_model.name + "_" + plot_title
|
|
523
516
|
)
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return plot
|
|
517
|
+
for f in ["pdf", "png"]:
|
|
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()
|