-
Notifications
You must be signed in to change notification settings - Fork 15
Description
This came up in discussion on sorunlib (see simonsobs/sorunlib#179 (review)) -- but I think we should modify the HWP Supervisor agent's pid_to_freq method to remove the inherent relationship between the sign of the target_freq argument and the direction the HWP spins in.
As currently written a client using pid_to_freq needs to know the relationship between the direction ('cw' or 'ccw') and the sign of the target_freq, i.e. that +2.0 Hz corresponds to 'ccw'. But this correspondence can change depending on the hardware/software configuration, i.e. if --forward-dir changes in the SCF.
I think it would be better to change pid_to_freq to take an unsigned target_freq and a direction argument (either 'cw' or 'ccw'). The agent can then determine the appropriate direction to rotate in via something like:
if params['direction'] == 'cw':
d = '0' if self.forward_is_cw else '1'
elif params['direction'] == 'ccw':
d = '1' if self.forward_is_cw else '0'The motivation here is to remove the hardcoded correspondence that is currently needed in downstream code, i.e. in sorunlib:
if target_hwp_direction == 'ccw':
run.hwp.set_freq(freq=2.0)
elif target_hwp_direction == 'cw':
run.hwp.set_freq(freq=-2.0)It would also make schedules perhaps more readable, since the unfamiliar user would read something like:
run.hwp.set_freq(freq=2, direction='cw')instead of just:
run.hwp.set_freq(freq=-2)@ykyohei I'd be curious to hear your thoughts.