Skip to content

Commit

Permalink
Merge pull request #272 from labsaha/drive_pointing_update
Browse files Browse the repository at this point in the history
Updating files for the correction to pointing positions
  • Loading branch information
rlopezcoto committed Jan 24, 2020
2 parents 7e65e2c + 84422cf commit 30daca6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lstchain/pointing/pointings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cal_pointingposition(self, ev_time, drive_data):
drive_container = LSTDriveContainer()
drive_container.time = drive_data['time'].data
drive_container.azimuth_avg = drive_data['azimuth_avg'].data
drive_container.zenith_avg = drive_data['zenith_avg'].data
drive_container.altitude_avg = 90.0 - drive_data['zenith_avg'].data


xp = drive_container.time
Expand All @@ -79,11 +79,11 @@ def cal_pointingposition(self, ev_time, drive_data):

if len(run_times) > 1:
run_azimuth = drive_container.azimuth_avg[time_in_window]
run_zenith = drive_container.zenith_avg[time_in_window]
run_altitude = drive_container.altitude_avg[time_in_window]

ev_azimuth = np.interp(ev_time, run_times, run_azimuth)
ev_zenith = np.interp(ev_time, run_times, run_zenith)
return ev_azimuth, ev_zenith
ev_altitude = np.interp(ev_time, run_times, run_altitude)
return ev_azimuth, ev_altitude
else:
raise Exception("No drive time in the range of event times")

8 changes: 4 additions & 4 deletions lstchain/reco/dl0_to_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def r0_to_dl1(input_filename=get_dataset_path('gamma_test_large.simtel.gz'),
pointings = PointingPosition()
pointings.drive_path = pointing_file_path
drive_data = pointings._read_drive_report()

extra_im = ExtraImageInfo()
extra_im.prefix = '' # get rid of the prefix

Expand Down Expand Up @@ -346,11 +346,11 @@ def r0_to_dl1(input_filename=get_dataset_path('gamma_test_large.simtel.gz'),
Try ucts (default), dragon or tib.")

if pointing_file_path and event_timestamps > 0:
azimuth, zenith = pointings.cal_pointingposition(event_timestamps, drive_data)
azimuth, altitude = pointings.cal_pointingposition(event_timestamps, drive_data)
event.pointing[telescope_id].azimuth = azimuth
event.pointing[telescope_id].altitude = 90.0 - zenith
event.pointing[telescope_id].altitude = altitude
dl1_container.az_tel = azimuth
dl1_container.alt_tel = 90.0 - zenith
dl1_container.alt_tel = altitude

foclen = event.inst.subarray.tel[telescope_id].optics.equivalent_focal_length
width = np.rad2deg(np.arctan2(dl1_container.width, foclen))
Expand Down

0 comments on commit 30daca6

Please sign in to comment.