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 80c371e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Ska/Sun/sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@


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')

# Add a terminating row to the data such that for pitch at or greater
# than 180 the allowed roll deviation is defined as 0.
dat.add_row({'pitch': 180, 'rolldev': 0})
return dat


ROLL_TABLE = LazyVal(load_roll_table)
Expand All @@ -28,6 +33,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 80c371e

Please sign in to comment.