Skip to content

Commit

Permalink
Use Astropy Coordinate Transofmations For Reconstruction (#758)
Browse files Browse the repository at this point in the history
* fix trafos to work for single pairs of coordinates which are not passed as arrays

* change hillasreconstructor to use proper coordinate transformation and work on proper alt az angles

* remove unused coordinate_transformaitons file

* remove unused methods in linalg

* remove deleted methods from init

* handle nans in lstsqrs matrix

* refactoring and h_max_predictor

* renaming and refromatting

* adapt test to new hillasreco

* pass rcond explicetly to get rid of astropy warning

* adapt example plot theta script

* remove debugging dummy function

* adapt theta notebook

* fix some codacity style issues
  • Loading branch information
kbruegge authored and kosack committed Jun 18, 2018
1 parent eac1d0b commit 1c41fc3
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 602 deletions.
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

0 comments on commit 1c41fc3

Please sign in to comment.