Skip to content

Commit

Permalink
Handle pitch at 180
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanconn committed Mar 15, 2022
1 parent c1b408f commit 8dc3bd4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Ska/Sun/sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@


def load_roll_table():
return Table.read(Path(__file__).parent / 'data' / 'pitch_roll.fits.gz')
dat = Table.read(Path(__file__).parent / 'data' / 'pitch_roll.fits.gz')
dat.add_row({'pitch': 180, 'rolldev': 0})
return dat


ROLL_TABLE = LazyVal(load_roll_table)
Expand All @@ -28,6 +30,9 @@ def allowed_rolldev(pitch):
"""
idx0 = np.searchsorted(ROLL_TABLE.val['pitch'], pitch, side='left')
idx1 = np.searchsorted(ROLL_TABLE.val['pitch'], pitch, side='right')
idx_max = len(ROLL_TABLE.val) - 1
idx0 = np.clip(idx0, 0, idx_max)
idx1 = np.clip(idx1, 0, idx_max)
# These need some bound checking at the edges
val0 = ROLL_TABLE.val['rolldev'][idx0]
val1 = ROLL_TABLE.val['rolldev'][idx1]
Expand Down

0 comments on commit 8dc3bd4

Please sign in to comment.