Skip to content

Commit

Permalink
Update to use -1.0 outside of allowed planning liimits
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed Mar 1, 2023
1 parent 04db5af commit b8ba190
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
11 changes: 5 additions & 6 deletions ska_sun/sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

def load_roll_table():
"""Load the pitch/roll table from the chandra_models repo."""
dat = chandra_models.get_data(
CHANDRA_MODELS_PITCH_ROLL_FILE, read_func=Table.read
)
dat = chandra_models.get_data(CHANDRA_MODELS_PITCH_ROLL_FILE, read_func=Table.read)
# Sanity check that the pitch values are monotonically increasing.
assert np.all(np.diff(dat["pitch"]) > 0)

Expand All @@ -37,7 +35,8 @@ def allowed_rolldev(pitch):
This performs a linear interpolation of the values in the pitch/roll table in
the chandra_models repo in ``chandra_models/pitch_roll/pitch_roll_constraint.csv``.
For pitch values outside the range of the table the returned rolldev is 0.
For pitch values outside the range of the table the returned rolldev is -1.0,
corresonding to a pitch angle outside of the planning limits.
:param pitch: float, ndarray
Sun pitch angle (deg)
Expand All @@ -48,8 +47,8 @@ def allowed_rolldev(pitch):
x=pitch,
xp=ROLL_TABLE.val["pitch"],
fp=ROLL_TABLE.val["off_nom_roll"],
left=0,
right=0,
left=-1.0,
right=-1.0,
)
return out

Expand Down
15 changes: 8 additions & 7 deletions ska_sun/tests/test_sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
# Expected pitch, rolldev pairs
exp_pitch_rolldev = np.array(
[
[0, 0],
[40, 0],
[56.0, 0],
[0, -1.0],
[40, -1.0],
[56.0, -1.0],
[85.49229, 4.95597],
[85.52, 4.9560848],
[124.99, 12.23652],
[125, 12.2380],
[135, 13.979],
[138, 14.516],
[179.9, 18.749],
[179.997, 18.749],
[180, 0],
[181, 0],
[177.9, 18.749],
[177.997, 18.749],
[178.0, -1.0],
[180, -1.0],
[181, -1.0],
]
)

Expand Down

0 comments on commit b8ba190

Please sign in to comment.