gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gammasimtools-0.8.2.dist-info/METADATA +173 -0
- gammasimtools-0.8.2.dist-info/RECORD +345 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
- gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
- simtools/_dev_version/__init__.py +9 -0
- simtools/_version.py +2 -2
- simtools/applications/calculate_trigger_rate.py +210 -0
- simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
- simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
- simtools/applications/convert_model_parameter_from_simtel.py +119 -0
- simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
- simtools/applications/db_add_value_from_json_to_db.py +105 -0
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
- simtools/applications/db_get_array_layouts_from_db.py +162 -0
- simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
- simtools/applications/db_get_parameter_from_db.py +131 -0
- simtools/applications/db_inspect_databases.py +52 -0
- simtools/applications/derive_mirror_rnda.py +39 -255
- simtools/applications/derive_psf_parameters.py +441 -0
- simtools/applications/generate_array_config.py +82 -0
- simtools/applications/generate_corsika_histograms.py +52 -52
- simtools/applications/generate_default_metadata.py +5 -8
- simtools/applications/generate_regular_arrays.py +117 -0
- simtools/applications/generate_simtel_array_histograms.py +97 -56
- simtools/applications/plot_array_layout.py +345 -115
- simtools/applications/production_generate_simulation_config.py +158 -0
- simtools/applications/production_scale_events.py +168 -0
- simtools/applications/simulate_light_emission.py +478 -0
- simtools/applications/simulate_prod.py +97 -175
- simtools/applications/submit_data_from_external.py +9 -12
- simtools/applications/submit_model_parameter_from_external.py +122 -0
- simtools/applications/validate_camera_efficiency.py +35 -102
- simtools/applications/validate_camera_fov.py +20 -19
- simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
- simtools/applications/validate_file_using_schema.py +111 -47
- simtools/applications/validate_optics.py +17 -22
- simtools/camera_efficiency.py +193 -202
- simtools/configuration/commandline_parser.py +384 -96
- simtools/configuration/configurator.py +55 -71
- simtools/constants.py +5 -5
- simtools/corsika/corsika_config.py +482 -342
- simtools/corsika/corsika_histograms.py +226 -204
- simtools/corsika/corsika_histograms_visualize.py +23 -24
- simtools/corsika/primary_particle.py +159 -0
- simtools/data_model/data_reader.py +25 -20
- simtools/data_model/format_checkers.py +52 -0
- simtools/data_model/metadata_collector.py +211 -185
- simtools/data_model/metadata_model.py +115 -37
- simtools/data_model/model_data_writer.py +335 -26
- simtools/data_model/validate_data.py +366 -154
- simtools/db/db_array_elements.py +130 -0
- simtools/db/db_from_repo_handler.py +106 -0
- simtools/db/db_handler.py +1246 -0
- simtools/io_operations/hdf5_handler.py +3 -1
- simtools/io_operations/io_handler.py +32 -57
- simtools/job_execution/job_manager.py +82 -69
- simtools/layout/array_layout.py +325 -537
- simtools/layout/geo_coordinates.py +8 -11
- simtools/layout/telescope_position.py +163 -86
- simtools/model/array_model.py +312 -259
- simtools/model/calibration_model.py +50 -0
- simtools/model/camera.py +277 -523
- simtools/model/mirrors.py +68 -49
- simtools/model/model_parameter.py +602 -0
- simtools/model/model_utils.py +11 -39
- simtools/model/site_model.py +161 -0
- simtools/model/telescope_model.py +143 -633
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
- simtools/production_configuration/event_scaler.py +146 -0
- simtools/production_configuration/generate_simulation_config.py +193 -0
- simtools/production_configuration/interpolation_handler.py +197 -0
- simtools/ray_tracing/__init__.py +0 -0
- simtools/ray_tracing/mirror_panel_psf.py +280 -0
- simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
- simtools/ray_tracing/ray_tracing.py +646 -0
- simtools/runners/__init__.py +0 -0
- simtools/runners/corsika_runner.py +240 -0
- simtools/runners/corsika_simtel_runner.py +225 -0
- simtools/runners/runner_services.py +307 -0
- simtools/runners/simtel_runner.py +224 -0
- simtools/schemas/array_elements.yml +137 -0
- simtools/schemas/integration_tests_config.metaschema.yml +93 -0
- simtools/schemas/metadata.metaschema.yml +6 -0
- simtools/schemas/model_parameter.metaschema.yml +78 -0
- simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
- simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
- simtools/schemas/model_parameters/altitude.schema.yml +37 -0
- simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
- simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
- simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
- simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
- simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
- simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
- simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
- simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
- simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
- simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
- simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
- simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
- simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
- simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
- simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
- simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
- simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/design_model.schema.yml +31 -0
- simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
- simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
- simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
- simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
- simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
- simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
- simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
- simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
- simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
- simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
- simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
- simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
- simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
- simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
- simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
- simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
- simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
- simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
- simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
- simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
- simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
- simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
- simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
- simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
- simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
- simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
- simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
- simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
- simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
- simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
- simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
- simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
- simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
- simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
- simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
- simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
- simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
- simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
- simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
- simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
- simtools/schemas/model_parameters/led_events.schema.yml +34 -0
- simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
- simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
- simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
- simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
- simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
- simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
- simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
- simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
- simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
- simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
- simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
- simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
- simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
- simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
- simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
- simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
- simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
- simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
- simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
- simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
- simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
- simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
- simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
- simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
- simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
- simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
- simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
- simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
- simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
- simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
- simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
- simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
- simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
- simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
- simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
- simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
- simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
- simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
- simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
- simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
- simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
- simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
- simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
- simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
- simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
- simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
- simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
- simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
- simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
- simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
- simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
- simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
- simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
- simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
- simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
- simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
- simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
- simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
- simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
- simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
- simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
- simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
- simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
- simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
- simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
- simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
- simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
- simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
- simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
- simtools/simtel/simtel_config_reader.py +353 -0
- simtools/simtel/simtel_config_writer.py +244 -63
- simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
- simtools/simtel/simtel_io_histogram.py +661 -0
- simtools/simtel/simtel_io_histograms.py +569 -0
- simtools/simtel/simulator_array.py +145 -0
- simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
- simtools/simtel/simulator_light_emission.py +473 -0
- simtools/simtel/simulator_ray_tracing.py +262 -0
- simtools/simulator.py +220 -446
- simtools/testing/__init__.py +0 -0
- simtools/testing/assertions.py +151 -0
- simtools/testing/configuration.py +226 -0
- simtools/testing/helpers.py +42 -0
- simtools/testing/validate_output.py +240 -0
- simtools/utils/general.py +340 -437
- simtools/utils/geometry.py +12 -12
- simtools/utils/names.py +257 -644
- simtools/utils/value_conversion.py +176 -0
- simtools/version.py +3 -1
- simtools/visualization/legend_handlers.py +135 -152
- simtools/visualization/plot_camera.py +379 -0
- simtools/visualization/visualize.py +346 -167
- gammasimtools-0.6.1.dist-info/METADATA +0 -180
- gammasimtools-0.6.1.dist-info/RECORD +0 -91
- gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
- simtools/_dev_version/scm_version.py +0 -10
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
- simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
- simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
- simtools/applications/get_parameter.py +0 -92
- simtools/applications/make_regular_arrays.py +0 -160
- simtools/applications/produce_array_config.py +0 -136
- simtools/applications/production.py +0 -313
- simtools/applications/sim_showers_for_trigger_rates.py +0 -187
- simtools/applications/tune_psf.py +0 -334
- simtools/corsika/corsika_default_config.py +0 -282
- simtools/corsika/corsika_runner.py +0 -450
- simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
- simtools/db_handler.py +0 -1480
- simtools/ray_tracing.py +0 -525
- simtools/simtel/simtel_histograms.py +0 -414
- simtools/simtel/simtel_runner.py +0 -244
- simtools/simtel/simtel_runner_array.py +0 -293
- simtools/simtel/simtel_runner_ray_tracing.py +0 -277
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
- {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
- /simtools/{corsika_simtel → db}/__init__.py +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
|
-
Summary
|
|
5
|
-
-------
|
|
6
4
|
Get a file from the DB.
|
|
7
5
|
|
|
8
6
|
The name of the file is required.
|
|
@@ -17,8 +15,6 @@
|
|
|
17
15
|
output_path (str)
|
|
18
16
|
Name of the local output directory where to save the files.
|
|
19
17
|
Default it $CWD.
|
|
20
|
-
verbosity (str, optional)
|
|
21
|
-
Log level to print.
|
|
22
18
|
|
|
23
19
|
Example
|
|
24
20
|
-------
|
|
@@ -26,13 +22,13 @@
|
|
|
26
22
|
|
|
27
23
|
.. code-block:: console
|
|
28
24
|
|
|
29
|
-
simtools-get-file-from-db --file_name mirror_CTA-N-LST1_v2019-03-31.dat
|
|
25
|
+
simtools-db-get-file-from-db --file_name mirror_CTA-N-LST1_v2019-03-31.dat
|
|
30
26
|
|
|
31
27
|
Expected final print-out message:
|
|
32
28
|
|
|
33
29
|
.. code-block:: console
|
|
34
30
|
|
|
35
|
-
INFO::
|
|
31
|
+
INFO::db_get_file_from_db(l82)::main::Got file mirror_CTA-N-LST1_v2019-03-31.dat from DB \
|
|
36
32
|
CTA-Simulation-Model and saved into .
|
|
37
33
|
|
|
38
34
|
"""
|
|
@@ -40,11 +36,12 @@
|
|
|
40
36
|
import logging
|
|
41
37
|
|
|
42
38
|
import simtools.utils.general as gen
|
|
43
|
-
from simtools import db_handler
|
|
44
39
|
from simtools.configuration import configurator
|
|
40
|
+
from simtools.db import db_handler
|
|
41
|
+
from simtools.io_operations import io_handler
|
|
45
42
|
|
|
46
43
|
|
|
47
|
-
def
|
|
44
|
+
def _parse():
|
|
48
45
|
config = configurator.Configurator(
|
|
49
46
|
description="Get file(s) from the DB.",
|
|
50
47
|
usage="simtools-get-file-from-db --file_name mirror_CTA-S-LST_v2020-04-07.dat",
|
|
@@ -52,47 +49,46 @@ def main():
|
|
|
52
49
|
|
|
53
50
|
config.parser.add_argument(
|
|
54
51
|
"--file_name",
|
|
55
|
-
help=
|
|
52
|
+
help="The name of the file to be downloaded.",
|
|
56
53
|
type=str,
|
|
57
54
|
required=True,
|
|
58
55
|
)
|
|
59
|
-
|
|
56
|
+
return config.initialize(db_config=True, output=True)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def main(): # noqa: D103
|
|
60
|
+
args_dict, db_config = _parse()
|
|
60
61
|
|
|
61
62
|
logger = logging.getLogger()
|
|
62
63
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
64
|
+
_io_handler = io_handler.IOHandler()
|
|
63
65
|
|
|
64
66
|
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
65
67
|
available_dbs = [
|
|
66
|
-
|
|
67
|
-
db.DB_CTA_SIMULATION_MODEL,
|
|
68
|
+
db_config["db_simulation_model"],
|
|
68
69
|
db.DB_CTA_SIMULATION_MODEL_DESCRIPTIONS,
|
|
69
|
-
db.DB_REFERENCE_DATA,
|
|
70
70
|
db.DB_DERIVED_VALUES,
|
|
71
71
|
"sandbox",
|
|
72
|
-
"test-data",
|
|
73
72
|
]
|
|
74
73
|
file_id = None
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
f"and saved into {args_dict['output_path']}"
|
|
84
|
-
)
|
|
85
|
-
break
|
|
86
|
-
except FileNotFoundError:
|
|
87
|
-
continue
|
|
88
|
-
|
|
89
|
-
if file_id is None:
|
|
90
|
-
logger.error(
|
|
91
|
-
f"The file {args_dict['file_name']} was not found in any of the available DBs."
|
|
74
|
+
for db_name in available_dbs:
|
|
75
|
+
try:
|
|
76
|
+
file_id = db.export_file_db(
|
|
77
|
+
db_name, _io_handler.get_output_directory(), args_dict["file_name"]
|
|
78
|
+
)
|
|
79
|
+
logger.info(
|
|
80
|
+
f"Got file {args_dict['file_name']} from DB {db_name} "
|
|
81
|
+
f"and saved into {_io_handler.get_output_directory()}"
|
|
92
82
|
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
break
|
|
84
|
+
except FileNotFoundError:
|
|
85
|
+
continue
|
|
86
|
+
|
|
87
|
+
if file_id is None:
|
|
88
|
+
logger.error(
|
|
89
|
+
f"The file {args_dict['file_name']} was not found in any of the available DBs."
|
|
90
|
+
)
|
|
91
|
+
raise FileNotFoundError
|
|
96
92
|
|
|
97
93
|
|
|
98
94
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""
|
|
4
|
+
Get a parameter entry from DB for a specific telescope or a site.
|
|
5
|
+
|
|
6
|
+
The application receives a parameter name, a site, a telescope (if applicable) and \
|
|
7
|
+
a version. It then prints out the parameter entry.
|
|
8
|
+
|
|
9
|
+
Command line arguments
|
|
10
|
+
----------------------
|
|
11
|
+
parameter (str, required)
|
|
12
|
+
Parameter name
|
|
13
|
+
|
|
14
|
+
site (str, required)
|
|
15
|
+
South or North.
|
|
16
|
+
|
|
17
|
+
telescope (str, optional)
|
|
18
|
+
Telescope model name (e.g. LST-1, SST-D, ...)
|
|
19
|
+
|
|
20
|
+
log_level (str, optional)
|
|
21
|
+
Log level to print.
|
|
22
|
+
|
|
23
|
+
Raises
|
|
24
|
+
------
|
|
25
|
+
KeyError in case the parameter requested does not exist in the model parameters.
|
|
26
|
+
|
|
27
|
+
Example
|
|
28
|
+
-------
|
|
29
|
+
Get the mirror_list parameter from the DB.
|
|
30
|
+
|
|
31
|
+
.. code-block:: console
|
|
32
|
+
|
|
33
|
+
simtools-db-get-parameter-from-db --parameter mirror_list \\
|
|
34
|
+
--site North --telescope LSTN-01 \\
|
|
35
|
+
--model_version 5.0.0
|
|
36
|
+
|
|
37
|
+
Expected final print-out message:
|
|
38
|
+
|
|
39
|
+
.. code-block:: console
|
|
40
|
+
|
|
41
|
+
{'Applicable': True,
|
|
42
|
+
'File': True,
|
|
43
|
+
'Type': 'str',
|
|
44
|
+
'Value': 'mirror_CTA-N-LST1_v2019-03-31.dat',
|
|
45
|
+
'Version': '5.0.0',
|
|
46
|
+
'_id': ObjectId('608834f257df2db2531b8e78'),
|
|
47
|
+
'entry_date': datetime.datetime(2021, 4, 27, 15, 59, 46, tzinfo=<bson.tz_util.FixedOffset \
|
|
48
|
+
object at 0x7f601dd51d80>)}
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
import json
|
|
53
|
+
import logging
|
|
54
|
+
from pathlib import Path
|
|
55
|
+
from pprint import pprint
|
|
56
|
+
|
|
57
|
+
import simtools.utils.general as gen
|
|
58
|
+
from simtools.configuration import configurator
|
|
59
|
+
from simtools.db import db_handler
|
|
60
|
+
from simtools.io_operations import io_handler
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _parse():
|
|
64
|
+
config = configurator.Configurator(
|
|
65
|
+
description=(
|
|
66
|
+
"Get a parameter entry from DB for a specific telescope or a site. "
|
|
67
|
+
"The application receives a parameter name, a site, a telescope (if applicable), "
|
|
68
|
+
"and a version. It then prints out the parameter entry. "
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
config.parser.add_argument("--parameter", help="Parameter name", type=str, required=True)
|
|
73
|
+
config.parser.add_argument(
|
|
74
|
+
"--db_collection",
|
|
75
|
+
help="DB collection to which to add the file",
|
|
76
|
+
default="telescopes",
|
|
77
|
+
required=False,
|
|
78
|
+
)
|
|
79
|
+
config.parser.add_argument(
|
|
80
|
+
"--output_file",
|
|
81
|
+
help="output file name (if not given: print to stdout)",
|
|
82
|
+
type=str,
|
|
83
|
+
required=False,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return config.initialize(db_config=True, simulation_model="telescope")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main(): # noqa: D103
|
|
90
|
+
args_dict, db_config = _parse()
|
|
91
|
+
|
|
92
|
+
logger = logging.getLogger()
|
|
93
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
94
|
+
|
|
95
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
96
|
+
|
|
97
|
+
if args_dict["db_collection"] == "configuration_sim_telarray":
|
|
98
|
+
pars = db.get_model_parameters(
|
|
99
|
+
args_dict["site"],
|
|
100
|
+
args_dict["telescope"],
|
|
101
|
+
args_dict["model_version"],
|
|
102
|
+
collection="configuration_sim_telarray",
|
|
103
|
+
)
|
|
104
|
+
elif args_dict["db_collection"] == "configuration_corsika":
|
|
105
|
+
pars = db.get_corsika_configuration_parameters(args_dict["model_version"])
|
|
106
|
+
elif args_dict["telescope"] is not None:
|
|
107
|
+
pars = db.get_model_parameters(
|
|
108
|
+
args_dict["site"],
|
|
109
|
+
args_dict["telescope"],
|
|
110
|
+
args_dict["model_version"],
|
|
111
|
+
collection="telescopes",
|
|
112
|
+
)
|
|
113
|
+
else:
|
|
114
|
+
pars = db.get_site_parameters(args_dict["site"], args_dict["model_version"])
|
|
115
|
+
if args_dict["parameter"] not in pars:
|
|
116
|
+
raise KeyError(f"The requested parameter, {args_dict['parameter']}, does not exist.")
|
|
117
|
+
if args_dict["output_file"] is not None:
|
|
118
|
+
_io_handler = io_handler.IOHandler()
|
|
119
|
+
pars[args_dict["parameter"]].pop("_id")
|
|
120
|
+
pars[args_dict["parameter"]].pop("entry_date")
|
|
121
|
+
_output_file = Path(_io_handler.get_output_directory()) / args_dict["output_file"]
|
|
122
|
+
with open(_output_file, "w", encoding="utf-8") as json_file:
|
|
123
|
+
json.dump(pars[args_dict["parameter"]], json_file, indent=4)
|
|
124
|
+
else:
|
|
125
|
+
print()
|
|
126
|
+
pprint(pars[args_dict["parameter"]])
|
|
127
|
+
print()
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
main()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Inspect databases and print (available database names and collections).
|
|
5
|
+
|
|
6
|
+
Command line arguments
|
|
7
|
+
----------------------
|
|
8
|
+
db_name (str, optional)
|
|
9
|
+
Inspect a specific database.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
|
|
14
|
+
import simtools.utils.general as gen
|
|
15
|
+
from simtools.configuration import configurator
|
|
16
|
+
from simtools.db import db_handler
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _parse():
|
|
20
|
+
config = configurator.Configurator(description="Inspect databases")
|
|
21
|
+
config.parser.add_argument(
|
|
22
|
+
"--db_name",
|
|
23
|
+
help="Inspect a specific database (use all to print all databases)",
|
|
24
|
+
default="all",
|
|
25
|
+
required=True,
|
|
26
|
+
)
|
|
27
|
+
return config.initialize(db_config=True, simulation_model="telescope")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main(): # noqa: D103
|
|
31
|
+
args_dict, db_config = _parse()
|
|
32
|
+
|
|
33
|
+
logger = logging.getLogger()
|
|
34
|
+
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
35
|
+
|
|
36
|
+
db = db_handler.DatabaseHandler(mongo_db_config=db_config)
|
|
37
|
+
|
|
38
|
+
databases = db.db_client.list_database_names()
|
|
39
|
+
|
|
40
|
+
for db_name in databases:
|
|
41
|
+
if args_dict["db_name"] != "all" and db_name != args_dict["db_name"]:
|
|
42
|
+
continue
|
|
43
|
+
# missing admin rights; skip config and admin
|
|
44
|
+
if db_name in ("config", "admin", "local"):
|
|
45
|
+
continue
|
|
46
|
+
print("Database:", db_name)
|
|
47
|
+
collections = db.get_collections(db_name=db_name)
|
|
48
|
+
print(" Collections:", collections)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
main()
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
r"""
|
|
4
|
+
Derive the simulation model parameter mirror_reflection_random_angle.
|
|
5
|
+
|
|
6
|
+
This parameter, often referred to as "mirror roughness," is used to align the simulation
|
|
7
|
+
with the measured containment diameter of the optical point-spread function (PSF) for
|
|
8
|
+
individual mirror panels.
|
|
9
9
|
|
|
10
10
|
Description
|
|
11
11
|
-----------
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
* file (table) with measured focal lengths per mirror panel
|
|
31
31
|
(provided through ``--mirror_list``)
|
|
32
32
|
* randomly generated focal lengths using an expected spread (value given through
|
|
33
|
-
``--
|
|
34
|
-
|
|
33
|
+
``--random_focal_length``) around the mean focal length (provided through the
|
|
34
|
+
Model Parameters DB). This option is switched with ``--use_random_focal_length``.
|
|
35
35
|
|
|
36
36
|
The tuning algorithm requires a starting value for the random reflection angle. This is either
|
|
37
|
-
taken from the
|
|
37
|
+
taken from the Model Parameters DB (default) or can be set using the argument ``--rnda``.
|
|
38
38
|
|
|
39
39
|
Ray-tracing simulations are performed for single mirror configurations for each
|
|
40
40
|
mirror given in the mirror_list. The mean simulated containment diameter for all the mirrors
|
|
@@ -83,76 +83,59 @@
|
|
|
83
83
|
default model is read from the simulation model database.
|
|
84
84
|
mirror_list (file, optional)
|
|
85
85
|
Table with mirror ID and panel radius.
|
|
86
|
-
|
|
87
|
-
Use random focal lengths, instead of the measured ones. The argument
|
|
88
|
-
used to replace the default random_focal_length from the model.
|
|
89
|
-
|
|
86
|
+
use_random_focal_length (activation mode, optional)
|
|
87
|
+
Use random focal lengths, instead of the measured ones. The argument random_focal_length
|
|
88
|
+
can be used to replace the default random_focal_length from the model.
|
|
89
|
+
random_focal_length (float, optional)
|
|
90
90
|
Value of the random focal lengths to replace the default random_focal_length. Only used if
|
|
91
|
-
|
|
91
|
+
'use_random_focal_length' is activated.
|
|
92
92
|
no_tuning (activation mode, optional)
|
|
93
93
|
Turn off the tuning - A single case will be simulated and plotted.
|
|
94
94
|
test (activation mode, optional)
|
|
95
95
|
If activated, application will be faster by simulating only few mirrors.
|
|
96
|
-
verbosity (str, optional)
|
|
97
|
-
Log level to print.
|
|
98
96
|
|
|
99
97
|
Example
|
|
100
98
|
-------
|
|
101
99
|
Derive mirror random reflection angle for a mid-sized telescope (MST),
|
|
102
|
-
simulation production
|
|
100
|
+
simulation production 5.0.0
|
|
103
101
|
|
|
104
102
|
.. code-block:: console
|
|
105
103
|
|
|
106
104
|
simtools-derive-mirror-rnda \\
|
|
107
|
-
--site
|
|
108
|
-
--telescope
|
|
105
|
+
--site South \\
|
|
106
|
+
--telescope LSTS-design \\
|
|
107
|
+
--model_version 6.0.0 \\
|
|
109
108
|
--containment_fraction 0.8 \\
|
|
110
|
-
--mirror_list
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--test
|
|
114
|
-
|
|
115
|
-
Runtime about 4 min.
|
|
116
|
-
|
|
117
|
-
The output is saved in `simtools-output/derive_mirror_rnda`.
|
|
118
|
-
Use the parameter ``--output_path`` to change the output directory.
|
|
109
|
+
--mirror_list ./tests/resources/mirror_list_CTA-N-LST1_v2019-03-31_rotated.ecsv
|
|
110
|
+
--rnda 0.003 \\
|
|
111
|
+
--psf_measurement_containment_mean 1.4 \\
|
|
119
112
|
|
|
120
113
|
Expected final print-out message:
|
|
121
114
|
|
|
122
115
|
.. code-block:: console
|
|
123
116
|
|
|
124
117
|
Measured D80:
|
|
125
|
-
Mean = 1.
|
|
118
|
+
Mean = 1.400 cm
|
|
126
119
|
|
|
127
120
|
Simulated D80:
|
|
128
|
-
Mean = 1.
|
|
121
|
+
Mean = 1.406 cm, StdDev = 0.005 cm
|
|
129
122
|
|
|
130
123
|
mirror_random_reflection_angle
|
|
131
|
-
Previous value = 0.
|
|
132
|
-
New value = 0.
|
|
124
|
+
Previous value = 0.003000
|
|
125
|
+
New value = 0.003824
|
|
133
126
|
|
|
134
127
|
"""
|
|
135
128
|
|
|
136
129
|
import logging
|
|
137
130
|
from pathlib import Path
|
|
138
131
|
|
|
139
|
-
import astropy.units as u
|
|
140
|
-
import numpy as np
|
|
141
|
-
from astropy.table import QTable, Table
|
|
142
|
-
|
|
143
|
-
import simtools.data_model.model_data_writer as writer
|
|
144
132
|
import simtools.utils.general as gen
|
|
145
133
|
from simtools.configuration import configurator
|
|
146
|
-
from simtools.
|
|
147
|
-
from simtools.model.telescope_model import TelescopeModel
|
|
148
|
-
from simtools.ray_tracing import RayTracing
|
|
134
|
+
from simtools.ray_tracing.mirror_panel_psf import MirrorPanelPSF
|
|
149
135
|
|
|
150
136
|
|
|
151
137
|
def _parse(label):
|
|
152
|
-
"""
|
|
153
|
-
Parse command line configuration
|
|
154
|
-
"""
|
|
155
|
-
|
|
138
|
+
"""Parse command line configuration."""
|
|
156
139
|
config = configurator.Configurator(
|
|
157
140
|
description="Derive mirror random reflection angle.", label=label
|
|
158
141
|
)
|
|
@@ -196,14 +179,17 @@ def _parse(label):
|
|
|
196
179
|
required=False,
|
|
197
180
|
)
|
|
198
181
|
config.parser.add_argument(
|
|
199
|
-
"--
|
|
182
|
+
"--use_random_focal_length",
|
|
200
183
|
help=("Use random focal lengths."),
|
|
201
184
|
action="store_true",
|
|
202
185
|
required=False,
|
|
203
186
|
)
|
|
204
187
|
config.parser.add_argument(
|
|
205
|
-
"--
|
|
206
|
-
help=
|
|
188
|
+
"--random_focal_length",
|
|
189
|
+
help=(
|
|
190
|
+
"Value of the random focal length. "
|
|
191
|
+
"Only used if 'use_random_focal_length' is activated."
|
|
192
|
+
),
|
|
207
193
|
default=None,
|
|
208
194
|
type=float,
|
|
209
195
|
required=False,
|
|
@@ -214,131 +200,10 @@ def _parse(label):
|
|
|
214
200
|
action="store_true",
|
|
215
201
|
required=False,
|
|
216
202
|
)
|
|
217
|
-
return config.initialize(db_config=True, output=True,
|
|
218
|
-
|
|
203
|
+
return config.initialize(db_config=True, output=True, simulation_model="telescope")
|
|
219
204
|
|
|
220
|
-
def _define_telescope_model(label, args_dict, db_config):
|
|
221
|
-
"""
|
|
222
|
-
Define telescope model and update configuration
|
|
223
|
-
with mirror list and/or random focal length given
|
|
224
|
-
as input
|
|
225
|
-
|
|
226
|
-
Attributes
|
|
227
|
-
----------
|
|
228
|
-
label: str
|
|
229
|
-
Application label.
|
|
230
|
-
args_dict: dict
|
|
231
|
-
Dictionary with configuration parameters.
|
|
232
|
-
db_config:
|
|
233
|
-
Dictionary with database configuration.
|
|
234
|
-
|
|
235
|
-
Returns
|
|
236
|
-
-------
|
|
237
|
-
tel TelescopeModel
|
|
238
|
-
telescope model
|
|
239
205
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
tel = TelescopeModel(
|
|
243
|
-
site=args_dict["site"],
|
|
244
|
-
telescope_model_name=args_dict["telescope"],
|
|
245
|
-
model_version=args_dict["model_version"],
|
|
246
|
-
mongo_db_config=db_config,
|
|
247
|
-
label=label,
|
|
248
|
-
)
|
|
249
|
-
if args_dict["mirror_list"] is not None:
|
|
250
|
-
mirror_list_file = gen.find_file(name=args_dict["mirror_list"], loc=args_dict["model_path"])
|
|
251
|
-
tel.change_parameter("mirror_list", args_dict["mirror_list"])
|
|
252
|
-
tel.add_parameter_file("mirror_list", mirror_list_file)
|
|
253
|
-
if args_dict["random_flen"] is not None:
|
|
254
|
-
tel.change_parameter("random_focal_length", str(args_dict["random_flen"]))
|
|
255
|
-
|
|
256
|
-
return tel
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
def _print_and_write_results(
|
|
260
|
-
args_dict, rnda_start, rnda_opt, mean_d80, sig_d80, results_rnda, results_mean, results_sig
|
|
261
|
-
):
|
|
262
|
-
"""
|
|
263
|
-
Print results to screen and write metadata and data files
|
|
264
|
-
in the requested format
|
|
265
|
-
|
|
266
|
-
"""
|
|
267
|
-
|
|
268
|
-
containment_fraction_percent = int(args_dict["containment_fraction"] * 100)
|
|
269
|
-
|
|
270
|
-
# Printing results to stdout
|
|
271
|
-
print(f"\nMeasured D{containment_fraction_percent}:")
|
|
272
|
-
if args_dict["psf_measurement_containment_sigma"] is not None:
|
|
273
|
-
print(
|
|
274
|
-
f"Mean = {args_dict['psf_measurement_containment_mean']:.3f} cm, "
|
|
275
|
-
f"StdDev = {args_dict['psf_measurement_containment_sigma']:.3f} cm"
|
|
276
|
-
)
|
|
277
|
-
else:
|
|
278
|
-
print(f"Mean = {args_dict['psf_measurement_containment_mean']:.3f} cm")
|
|
279
|
-
print(f"\nSimulated D{containment_fraction_percent}:")
|
|
280
|
-
print(f"Mean = {mean_d80:.3f} cm, StdDev = {sig_d80:.3f} cm")
|
|
281
|
-
print("\nmirror_random_reflection_angle")
|
|
282
|
-
print(f"Previous value = {rnda_start:.6f}")
|
|
283
|
-
print(f"New value = {rnda_opt:.6f}\n")
|
|
284
|
-
|
|
285
|
-
# Result table written to ecsv file using file_writer
|
|
286
|
-
# First entry is always the best fit result
|
|
287
|
-
result_table = QTable(
|
|
288
|
-
[
|
|
289
|
-
[True] + [False] * len(results_rnda),
|
|
290
|
-
([rnda_opt] + results_rnda) * u.deg,
|
|
291
|
-
([0.0] * (len(results_rnda) + 1)),
|
|
292
|
-
([0.0] * (len(results_rnda) + 1)) * u.deg,
|
|
293
|
-
([mean_d80] + results_mean) * u.cm,
|
|
294
|
-
([sig_d80] + results_sig) * u.cm,
|
|
295
|
-
],
|
|
296
|
-
names=(
|
|
297
|
-
"best_fit",
|
|
298
|
-
"mirror_reflection_random_angle_sigma1",
|
|
299
|
-
"mirror_reflection_random_angle_fraction2",
|
|
300
|
-
"mirror_reflection_random_angle_sigma2",
|
|
301
|
-
f"containment_radius_D{containment_fraction_percent}",
|
|
302
|
-
f"containment_radius_sigma_D{containment_fraction_percent}",
|
|
303
|
-
),
|
|
304
|
-
)
|
|
305
|
-
writer.ModelDataWriter.dump(
|
|
306
|
-
args_dict=args_dict,
|
|
307
|
-
metadata=MetadataCollector(args_dict=args_dict).top_level_meta,
|
|
308
|
-
product_data=result_table,
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def _get_psf_containment(logger, args_dict):
|
|
313
|
-
"""
|
|
314
|
-
Read measured single-mirror point-spread function (containment)
|
|
315
|
-
from file and return mean and sigma
|
|
316
|
-
|
|
317
|
-
"""
|
|
318
|
-
|
|
319
|
-
# If this is a test, read just the first few lines since we only simulate those mirrors
|
|
320
|
-
data_end = args_dict["number_of_mirrors_to_test"] + 1 if args_dict["test"] else None
|
|
321
|
-
_psf_list = Table.read(args_dict["psf_measurement"], format="ascii.ecsv", data_end=data_end)
|
|
322
|
-
try:
|
|
323
|
-
args_dict["psf_measurement_containment_mean"] = np.nanmean(
|
|
324
|
-
np.array(_psf_list["psf_opt"].to("cm").value)
|
|
325
|
-
)
|
|
326
|
-
args_dict["psf_measurement_containment_sigma"] = np.nanstd(
|
|
327
|
-
np.array(_psf_list["psf_opt"].to("cm").value)
|
|
328
|
-
)
|
|
329
|
-
except KeyError:
|
|
330
|
-
logger.debug(
|
|
331
|
-
f"Missing column for psf measurement (psf_opt) in {args_dict['psf_measurement']}"
|
|
332
|
-
)
|
|
333
|
-
raise
|
|
334
|
-
|
|
335
|
-
logger.info(
|
|
336
|
-
f"Determined PSF containment to {args_dict['psf_measurement_containment_mean']:.4} "
|
|
337
|
-
f"+- {args_dict['psf_measurement_containment_sigma']:.4} cm"
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
def main():
|
|
206
|
+
def main(): # noqa: D103
|
|
342
207
|
label = Path(__file__).stem
|
|
343
208
|
|
|
344
209
|
args_dict, db_config = _parse(label)
|
|
@@ -346,91 +211,10 @@ def main():
|
|
|
346
211
|
logger = logging.getLogger()
|
|
347
212
|
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
348
213
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if args_dict["psf_measurement"]:
|
|
355
|
-
_get_psf_containment(logger, args_dict)
|
|
356
|
-
if not args_dict["psf_measurement_containment_mean"]:
|
|
357
|
-
logger.error("Missing PSF measurement")
|
|
358
|
-
raise ValueError
|
|
359
|
-
|
|
360
|
-
def run(rnda):
|
|
361
|
-
"""Runs the simulations for one given value of rnda"""
|
|
362
|
-
tel.change_parameter("mirror_reflection_random_angle", str(rnda))
|
|
363
|
-
ray = RayTracing.from_kwargs(
|
|
364
|
-
telescope_model=tel,
|
|
365
|
-
single_mirror_mode=True,
|
|
366
|
-
mirror_numbers=list(range(1, args_dict["number_of_mirrors_to_test"] + 1))
|
|
367
|
-
if args_dict["test"]
|
|
368
|
-
else "all",
|
|
369
|
-
simtel_source_path=args_dict.get("simtel_path", None),
|
|
370
|
-
use_random_focal_length=args_dict["use_random_flen"],
|
|
371
|
-
)
|
|
372
|
-
ray.simulate(test=False, force=True) # force has to be True, always
|
|
373
|
-
ray.analyze(force=True)
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
ray.get_mean("d80_cm").to(u.cm).value,
|
|
377
|
-
ray.get_std_dev("d80_cm").to(u.cm).value,
|
|
378
|
-
)
|
|
379
|
-
|
|
380
|
-
# First - rnda from previous model or from command line
|
|
381
|
-
if args_dict["rnda"] != 0:
|
|
382
|
-
rnda_start = args_dict["rnda"]
|
|
383
|
-
else:
|
|
384
|
-
rnda_start = tel.get_parameter("mirror_reflection_random_angle")["Value"]
|
|
385
|
-
if isinstance(rnda_start, str):
|
|
386
|
-
rnda_start = float(rnda_start.split()[0])
|
|
387
|
-
|
|
388
|
-
logger.info(f"Start value for mirror_reflection_random_angle: {rnda_start} deg")
|
|
389
|
-
|
|
390
|
-
results_rnda = []
|
|
391
|
-
results_mean = []
|
|
392
|
-
results_sig = []
|
|
393
|
-
if args_dict["no_tuning"]:
|
|
394
|
-
rnda_opt = rnda_start
|
|
395
|
-
else:
|
|
396
|
-
|
|
397
|
-
def collect_results(rnda, mean, sig):
|
|
398
|
-
results_rnda.append(rnda)
|
|
399
|
-
results_mean.append(mean)
|
|
400
|
-
results_sig.append(sig)
|
|
401
|
-
|
|
402
|
-
stop = False
|
|
403
|
-
mean_d80, sig_d80 = run(rnda_start)
|
|
404
|
-
rnda = rnda_start
|
|
405
|
-
sign_delta = np.sign(mean_d80 - args_dict["psf_measurement_containment_mean"])
|
|
406
|
-
collect_results(rnda, mean_d80, sig_d80)
|
|
407
|
-
while not stop:
|
|
408
|
-
rnda = rnda - (0.1 * rnda_start * sign_delta)
|
|
409
|
-
if rnda < 0:
|
|
410
|
-
rnda = 0
|
|
411
|
-
collect_results(rnda, mean_d80, sig_d80)
|
|
412
|
-
break
|
|
413
|
-
mean_d80, sig_d80 = run(rnda)
|
|
414
|
-
new_sign_delta = np.sign(mean_d80 - args_dict["psf_measurement_containment_mean"])
|
|
415
|
-
stop = new_sign_delta != sign_delta
|
|
416
|
-
sign_delta = new_sign_delta
|
|
417
|
-
collect_results(rnda, mean_d80, sig_d80)
|
|
418
|
-
|
|
419
|
-
# Linear interpolation using two last rnda values
|
|
420
|
-
results_rnda, results_mean, results_sig = gen.sort_arrays(
|
|
421
|
-
results_rnda, results_mean, results_sig
|
|
422
|
-
)
|
|
423
|
-
rnda_opt = np.interp(
|
|
424
|
-
x=args_dict["psf_measurement_containment_mean"],
|
|
425
|
-
xp=results_mean,
|
|
426
|
-
fp=results_rnda,
|
|
427
|
-
)
|
|
428
|
-
|
|
429
|
-
mean_d80, sig_d80 = run(rnda_opt)
|
|
430
|
-
|
|
431
|
-
_print_and_write_results(
|
|
432
|
-
args_dict, rnda_start, rnda_opt, mean_d80, sig_d80, results_rnda, results_mean, results_sig
|
|
433
|
-
)
|
|
214
|
+
panel_psf = MirrorPanelPSF(label, args_dict, db_config)
|
|
215
|
+
panel_psf.derive_random_reflection_angle(save_figures=True)
|
|
216
|
+
panel_psf.print_results()
|
|
217
|
+
panel_psf.write_optimization_data()
|
|
434
218
|
|
|
435
219
|
|
|
436
220
|
if __name__ == "__main__":
|