@@ -125,11 +125,9 @@ def apply_pointing_model_lat(vers, params, ancil):
125125
126126 if vers == 'lat_naive' :
127127 return _new_boresight (ancil .samps , az = az , el = el , roll = roll )
128-
129- if vers == "lat_v1" :
128+ elif vers == "lat_v1" :
130129 az1 , el1 , roll1 = model_lat_v1 (params , az , el , roll )
131130 return _new_boresight (ancil .samps , az = az1 , el = el1 , roll = roll1 )
132-
133131 else :
134132 raise ValueError (f'Unimplemented pointing model "{ vers } "' )
135133
@@ -156,6 +154,10 @@ def model_lat_v1(params, az, el, roll):
156154 - mir_center_{xi,eta}0: The (xi,eta) coordinate in the El-structure-centered
157155 focal plane that appears fixed when the mirrors are rotated about the ray from
158156 sky that hits the center of both mirrors.
157+ - base_tilt_{cos,sin}: Base tilt coefficients, in radians.
158+ - el_sag_{quad,lin}: Dimensionless coefficients for the quadradtic
159+ and linear components of the elevation sag.
160+ - el_sag_pivot: The elevation in radians to treat as the sag's zero point.
159161
160162 """
161163 _p = dict (param_defaults ['lat_v1' ])
@@ -217,7 +219,26 @@ def model_lat_v1(params, az, el, roll):
217219 * q_el_roll * q_el_axis_center
218220 * q_cr_roll * q_cr_center
219221 )
220- new_az , el , roll = quat .decompose_lonlat (q_hs )* np .array ([- 1 , 1 , 1 ])[..., None ]
222+ az , el , roll = quat .decompose_lonlat (q_hs )* np .array ([- 1 , 1 , 1 ])[..., None ]
223+ cr = el - roll - np .deg2rad (60 )
224+
225+ # Base tilt
226+ q_base_tilt = get_base_tilt_q (params ['base_tilt_cos' ], params ['base_tilt_sin' ])
227+
228+ # El sag
229+ el_sag = params ['el_sag_quad' ]* (el - params ['el_sag_pivot' ])** 2
230+ el_sag += params ['el_sag_lin' ]* (el - params ['el_sag_pivot' ])
231+ el += el_sag
232+
233+ # Lonlat rotation after v1 model and el sag is applied
234+ q_lonlat = quat .rotation_lonlat (- 1 * az , el ) * quat .euler (2 , roll )
235+
236+ # Horizon Coordinates
237+ q_hs = q_base_tilt * q_lonlat
238+ new_az , el , _ = quat .decompose_lonlat (q_hs )* np .array ([- 1 , 1 , 1 ])[..., None ]
239+
240+ # Get new roll with the modified el
241+ roll = el - cr - np .deg2rad (60 )
221242
222243 # Make corrected az as close as possible to the input az.
223244 change = ((new_az - az_orig ) + np .pi ) % (2 * np .pi ) - np .pi
@@ -318,6 +339,11 @@ def model_sat_v1(params, az, el, roll):
318339 'cr_center_eta0' : 0 ,
319340 'mir_center_xi0' : 0 ,
320341 'mir_center_eta0' : 0 ,
342+ 'base_tilt_cos' : 0 ,
343+ 'base_tilt_sin' : 0 ,
344+ 'el_sag_quad' : 0 ,
345+ 'el_sag_lin' : 0 ,
346+ 'el_sag_pivot' : np .pi / 2. ,
321347 },
322348 'sat_v1' : {
323349 'enc_offset_az' : 0. ,
0 commit comments