Skip to content

Commit

Permalink
Use alt for CTA, zd for FACT
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasNickel committed May 28, 2020
1 parent dfbfe2c commit 4a616ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions aict_tools/cta_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
raise ImportError('This functionality requires ctapipe to be installed')


def horizontal_to_camera_cta_simtel(zd, az, zd_pointing, az_pointing, focal_length):
def horizontal_to_camera_cta_simtel(alt, az, alt_pointing, az_pointing, focal_length):
with warnings.catch_warnings():

altaz = AltAz()
source_altaz = SkyCoord(
az=u.Quantity(az, u.deg, copy=False),
alt=u.Quantity(90 - zd, u.deg, copy=False),
alt=u.Quantity(alt, u.deg, copy=False),
frame=altaz,
)

tel_pointing = SkyCoord(
alt=u.Quantity(90 - zd_pointing, u.deg, copy=False),
alt=u.Quantity(alt_pointing, u.deg, copy=False),
az=u.Quantity(az_pointing, u.deg, copy=False),
frame=altaz,
)
Expand Down
16 changes: 9 additions & 7 deletions aict_tools/scripts/train_disp_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,24 @@ def main(configuration_path, signal_path, predictions_path, disp_model_path, sig
from ..cta_helpers import horizontal_to_camera_cta_simtel
source_x, source_y = horizontal_to_camera_cta_simtel(
az=df[model_config.source_az_column],
zd=df[model_config.source_zd_column] if model_config.source_zd_column
else (90-df[model_config.source_alt_column]),
alt=df[model_config.source_alt_column] if model_config.source_alt_column
else (90-df[model_config.source_zd_column]),
az_pointing=df[model_config.pointing_az_column],
zd_pointing=df[model_config.pointing_zd_column] if model_config.pointing_zd_column
else (90-df[model_config.pointing_alt_column]),
alt_pointing=df[model_config.pointing_alt_column]
if model_config.pointing_alt_column
else (90-df[model_config.pointing_zd_column]),
focal_length=df[model_config.focal_length_column],
)
elif model_config.coordinate_transformation == 'FACT':

source_x, source_y = horizontal_to_camera(
az=df[model_config.source_az_column],
zd=df[model_config.source_zd_column] if model_config.source_zd_column
else (90-df[model_config.source_alt_column]),
else (90-df[model_config.source_alt_column]),
az_pointing=df[model_config.pointing_az_column],
zd_pointing=df[model_config.pointing_zd_column] if model_config.pointing_zd_column
else (90-df[model_config.pointing_alt_column]),
zd_pointing=df[model_config.pointing_zd_column]
if model_config.pointing_zd_column
else (90-df[model_config.pointing_alt_column]),
)

log.info('Using projected disp: {}'.format(model_config.project_disp))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cta_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def test_horizontal_to_camera():
expected_x = df.x
expected_y = df.y
transformed_x, transformed_y = horizontal_to_camera_cta_simtel(
zd=df.zd,
alt=90-df.zd,
az=df.az,
zd_pointing=df.zd_pointing,
alt_pointing=90-df.zd_pointing,
az_pointing=df.az_pointing,
focal_length=df.focal_length,
)
Expand Down

0 comments on commit 4a616ef

Please sign in to comment.