Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/1940.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add search patterns in integration tests and fix bug when using a isotropic angular distribution in the illuminator simulations.
3 changes: 3 additions & 0 deletions src/simtools/simtel/simulator_light_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ def _get_angular_distribution_string_for_sim_telarray(self):
)
return option_string

if option_string == "isotropic":
return option_string

width = self.calibration_model.get_parameter_value_with_unit(
"flasher_angular_distribution_width"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,23 @@ applications:
test: true
log_level: DEBUG
integration_tests:
- output_file: logfile.log
- output_file: xyzls.simtel.zst
- test_output_files:
- file: logfile.log
path_descriptor: output_path
- file: xyzls.simtel.zst
path_descriptor: output_path
- expected_log_output:
pattern:
- "Initialize for run"
- "Total number of photons produced in this run"
- "Sim_telarray finished at"
- "CORSIKA IACT finished at"
- "Tel. triggered: "
- "Finished."
forbidden_pattern:
- "Error"
file: logfile.log
path_descriptor: output_path
model_version_use_current: true
test_name: run-configurable-position
schema_name: application_workflow.metaschema
Expand Down
19 changes: 17 additions & 2 deletions tests/integration_tests/config/simulate_illuminator_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,23 @@ applications:
test: true
log_level: DEBUG
integration_tests:
- output_file: logfile.log
- output_file: xyzls.simtel.zst
- test_output_files:
- file: logfile.log
path_descriptor: output_path
- file: xyzls.simtel.zst
path_descriptor: output_path
- expected_log_output:
pattern:
- "Initialize for run"
- "Total number of photons produced in this run"
- "Sim_telarray finished at"
- "CORSIKA IACT finished at"
- "Tel. triggered: "
- "Finished."
forbidden_pattern:
- "Error"
file: logfile.log
path_descriptor: output_path
model_version_use_current: true
test_name: run-layout
schema_name: application_workflow.metaschema
Expand Down
17 changes: 17 additions & 0 deletions tests/unit_tests/simtel/test_simulator_light_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -1610,3 +1610,20 @@ def test__calibration_pointing_direction_with_custom_params(simulator_instance):
simulator_instance.telescope_model.get_parameter_value_with_unit.assert_called_with(
"array_element_position_ground"
)


def test__get_angular_distribution_string_for_sim_telarray_isotropic(simulator_instance):
"""Test isotropic distribution returns just the token."""
simulator_instance.calibration_model.get_parameter_value.return_value = "Isotropic"

# Even if width is available (though it shouldn't be for isotropic), it should be ignored
mock_width = Mock()
mock_width.to.return_value.value = 10.0
simulator_instance.calibration_model.get_parameter_value_with_unit.return_value = mock_width

result = simulator_instance._get_angular_distribution_string_for_sim_telarray()
assert result == "isotropic"

# Verify width was NOT requested (or at least not used in the return string)
# Based on implementation, width is requested AFTER the check, so it should NOT be called.
simulator_instance.calibration_model.get_parameter_value_with_unit.assert_not_called()