simonsobs / socs

Simons Observatory specific OCS agents.
BSD 2-Clause "Simplified" License
12 stars 12 forks source link

HWPSupervisor: timestamps for encoder readings #681

Closed mhasself closed 3 months ago

mhasself commented 4 months ago

In supervisor, the hwp_state is captured through certain data from hwp_encoder agent:

    self._update_from_keymap(op, {
            'enc_freq': 'approx_hwp_freq',
            'last_quad': 'last_quad',
            'last_quad_time': 'last_quad_time',
    })

In the case that quad and last_quad_time are not valid (ahem), then this dataset doesn't include a timestamp.

I believe the supervisor should capture (and check!!) the key encoder_last_updated (from here).

I am going to change ocs-web panel to report the timestamp from encoder_last_updated, in anticipation of this being added ...

jlashner commented 4 months ago

Yes, I can do this. Just so I know what to check for, for the invalid data do last_quad and last_quad_time contain None?

Looking at the encoder code, I'm not seeing how encoder_last_updated can be anything but a valid time, but maybe I'm missing something. I can at least make sure the returned value is a float.

mhasself commented 4 months ago

Ya sorry, by "check" I mean that the spin freq should be treated as stale (i.e. as missing), if its associated timestamp is too far in the past.

This protects you against data acq processes stalling out.

(I know that's a potential big change in the logic... haven't investigated how big.)

mhasself commented 4 months ago

It looks like last_quad and last_quad_time are sometimes just not populated. So I think they will be valid (but potentially stale), or absent.