Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/simtools/sim_events/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ def _process_file_info(self, file_id, file):
e_min = event_header["energy_min"]
e_max = event_header["energy_max"]
zenith = np.degrees(event_header["zenith"])
# relative to geomagnetic north - requires update in pycorsikaio to
# read rotation angle
azimuth = np.degrees(event_header["azimuth"])
# Rotate to geographic north
azimuth = np.degrees(
event_header["azimuth"] - event_header["angle_array_x_magnetic_north"]
)
view_cone_min = event_header["viewcone_inner_angle"]
view_cone_max = event_header["viewcone_outer_angle"]
core_min = 0.0
Expand Down
4 changes: 3 additions & 1 deletion tests/unit_tests/sim_events/test_writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path
from unittest.mock import MagicMock, patch

import numpy as np
import pytest
from eventio.simtel import (
ArrayEvent,
Expand Down Expand Up @@ -432,6 +433,7 @@ def test_process_file_info_else(monkeypatch, tmp_path):
"energy_max": 5.0,
"zenith": 0.5,
"azimuth": 1.0,
"angle_array_x_magnetic_north": 0.1,
"viewcone_inner_angle": 0.1,
"viewcone_outer_angle": 0.2,
}
Expand Down Expand Up @@ -460,5 +462,5 @@ def test_process_file_info_else(monkeypatch, tmp_path):
assert info["core_scatter_min"] == pytest.approx(0.0)
assert info["core_scatter_max"] == pytest.approx(100.0)
assert info["zenith"] == pytest.approx(28.64788975654116)
assert info["azimuth"] == pytest.approx(57.29577951308232)
assert info["azimuth"] == pytest.approx(np.rad2deg(1.0 - 0.1))
assert info["nsb_level"] == pytest.approx(0.0)