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

Use Astropy Coordinate Transofmations For Reconstruction #758

Merged
merged 15 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from 11 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: 0 additions & 7 deletions ctapipe/coordinates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
"""
Coordinates.
"""


from .coordinate_transformations import (pixel_position_to_direction,
alt_to_theta, az_to_phi,
transform_pixel_position)


from .angular_frames import *
from .ground_frames import *

Expand Down
14 changes: 11 additions & 3 deletions ctapipe/coordinates/angular_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ def offset_to_altaz(x_off, y_off, azimuth, altitude):

offset = sqrt(x_off * x_off + y_off * y_off)
pos = np.where(offset == 0) # find offset 0 positions

if len(pos[0]) > 0:
offset[pos] = 1e-12 # add a very small offset to prevent math errors
if np.isscalar(offset):
offset = 1e-14
else:
offset[pos] = 1e-14 # add a very small offset to prevent math errors

atan_off = arctan(offset)

Expand All @@ -236,8 +240,12 @@ def offset_to_altaz(x_off, y_off, azimuth, altitude):
obj_azimuth = arctan2(yp0, -xp0) + azimuth

if len(pos[0]) > 0:
obj_altitude[pos] = altitude
obj_azimuth[pos] = azimuth
if np.isscalar(obj_altitude):
obj_altitude = altitude
obj_azimuth = azimuth
else:
obj_altitude[pos] = altitude
obj_azimuth[pos] = azimuth

obj_altitude = obj_altitude * u.rad
obj_azimuth = obj_azimuth * u.rad
Expand Down
81 changes: 0 additions & 81 deletions ctapipe/coordinates/coordinate_transformations.py

This file was deleted.

Loading