Skip to content

Commit 31415b4

Browse files
authored
Merge pull request #1162 from simonsobs/fix_pointing_model_pi_issue
Pointing model quat.deconstruct_lonlat issue. Fixed right now by minimizing the difference between original azimuth values and the corrected values.
2 parents 1e17035 + 6c1c487 commit 31415b4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sotodlib/coords/pointing_model.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def model_sat_v1(params, az, el, roll):
175175
raise ValueError(f'Handling of model param "{k}" is not implemented.')
176176

177177
# Construct offsetted encoders.
178+
az_orig = az.copy()
178179
az_twist = params['az_rot'] * (el + params['enc_offset_el'])
179180
az = az + params['enc_offset_az'] + az_twist
180181
el = el + params['enc_offset_el']
@@ -195,7 +196,12 @@ def model_sat_v1(params, az, el, roll):
195196
* q_fp_offset * ~q_fp_rot * quat.euler(2, roll) * q_fp_rot)
196197

197198
neg_az, el, roll = quat.decompose_lonlat(q_hs)
198-
return -neg_az, el, roll
199+
200+
# Make corrected az as close as possible to the input az.
201+
change = ((-neg_az - az_orig) + np.pi) % (2 * np.pi) - np.pi
202+
new_az = az_orig + change
203+
204+
return new_az, el, roll
199205

200206

201207
# Support functions

0 commit comments

Comments
 (0)