From b8ba19026406fee27b435d24ce8775483dd4579a Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 1 Mar 2023 06:59:14 -0500 Subject: [PATCH] Update to use -1.0 outside of allowed planning liimits --- ska_sun/sun.py | 11 +++++------ ska_sun/tests/test_sun.py | 15 ++++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ska_sun/sun.py b/ska_sun/sun.py index 93b35d8..a7776b0 100755 --- a/ska_sun/sun.py +++ b/ska_sun/sun.py @@ -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) @@ -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) @@ -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 diff --git a/ska_sun/tests/test_sun.py b/ska_sun/tests/test_sun.py index 35d4ed1..650c84b 100644 --- a/ska_sun/tests/test_sun.py +++ b/ska_sun/tests/test_sun.py @@ -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], ] )