Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check pointing coordinate frame in DispReconstructor #2431

Merged
merged 5 commits into from
Oct 30, 2023
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
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``.