Skip to content

Commit

Permalink
Merge pull request #2431 from LukasBeiske/check_coord_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
kosack authored Oct 30, 2023
2 parents 6817199 + 45d7738 commit 0b0fac6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ctapipe/tools/train_disp_reconstructor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import astropy.units as u
import numpy as np

from ctapipe.containers import CoordinateFrameType
from ctapipe.core import Tool
from ctapipe.core.traits import Bool, Int, IntTelescopeParameter, Path
from ctapipe.exceptions import TooFewEvents
Expand Down Expand Up @@ -127,6 +128,13 @@ def _read_table(self, telescope_type):
f"No events after quality query for telescope type {telescope_type}"
)

if not np.all(
table["subarray_pointing_frame"] == CoordinateFrameType.ALTAZ.value
):
raise ValueError(
"Pointing information for training data has to be provided in horizontal coordinates"
)

table = self.models.feature_generator(table, subarray=self.loader.subarray)

table[self.models.target] = self._get_true_disp(table)
Expand Down
2 changes: 2 additions & 0 deletions docs/changes/2431.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Check that the array pointing is given in horizontal coordinates
before training a ``DispReconstructor``.

0 comments on commit 0b0fac6

Please sign in to comment.