-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2537 from cta-observatory/shower_axis_point
Add function to get point on shower axis in altaz
- Loading branch information
Showing
5 changed files
with
127 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add function ``ctapipe.coordinates.get_point_on_shower_axis`` | ||
that computes a point on the shower axis in alt/az as seen | ||
from a telescope. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import astropy.units as u | ||
import numpy as np | ||
import pytest | ||
from astropy.coordinates import AltAz | ||
|
||
|
||
def test_point_on_shower_axis_far(subarray_prod5_paranal): | ||
"""Test for get_point_on_shower_axis""" | ||
from ctapipe.coordinates import get_point_on_shower_axis | ||
|
||
core_x = 50 * u.m | ||
core_y = 100 * u.m | ||
alt = 68 * u.deg | ||
az = 30 * u.deg | ||
# for a very large distance, should be identical to the shower direction | ||
distance = 1000 * u.km | ||
|
||
point = get_point_on_shower_axis( | ||
core_x=core_x, | ||
core_y=core_y, | ||
alt=alt, | ||
az=az, | ||
telescope_position=subarray_prod5_paranal.tel_coords, | ||
distance=distance, | ||
) | ||
|
||
np.testing.assert_allclose(point.alt, alt, rtol=1e-3) | ||
np.testing.assert_allclose(point.az, az, rtol=1e-2) | ||
|
||
|
||
def test_single_telescope(subarray_prod5_paranal): | ||
from ctapipe.coordinates import ( | ||
MissingFrameAttributeWarning, | ||
get_point_on_shower_axis, | ||
) | ||
|
||
core_x = 50 * u.m | ||
core_y = 100 * u.m | ||
alt = 68 * u.deg | ||
az = 30 * u.deg | ||
distance = 10 * u.km | ||
|
||
point = get_point_on_shower_axis( | ||
core_x=core_x, | ||
core_y=core_y, | ||
alt=alt, | ||
az=az, | ||
telescope_position=subarray_prod5_paranal.tel_coords[0], | ||
distance=distance, | ||
) | ||
|
||
source = AltAz(alt=alt, az=az) | ||
# 10 km is around the shower maximum, should be around 1 degree from the source | ||
with pytest.warns(MissingFrameAttributeWarning): | ||
assert u.isclose(source.separation(point), 1.0 * u.deg, atol=0.1 * u.deg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters