ResetDetectors

Bases: KPFFunction

Resets the kpfexpose service by setting kpfexpose.EXPOSE = Reset

Description from Will Deich: This sets EXPOSE=Reset for the appropriate service. For the ktlcamerad services, that just means, “even though you’ve not received (from camerad) the normal sequence of messages for a completed exposure, pretend everything is fine for starting a new exposure.”

ARGS:

None

Source code in kpf/spectrograph/ResetDetectors.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
class ResetDetectors(KPFFunction):
    '''Resets the kpfexpose service by setting kpfexpose.EXPOSE = Reset

    Description from Will Deich:
    This sets EXPOSE=Reset for the appropriate service.  For the 
    ktlcamerad services, that just means, “even though you’ve not received
    (from camerad) the normal sequence of messages for a completed exposure,
    pretend everything is fine for starting a new exposure.”

    ARGS:
    =====
    None
    '''
    @classmethod
    def pre_condition(cls, args):
        pass

    @classmethod
    def perform(cls, args):
        kpfexpose = ktl.cache('kpfexpose')
        log.warning(f"Resetting: kpfexpose.EXPOSE = Reset")
        kpfexpose['EXPOSE'].write('Reset')
        log.debug('Reset command sent')

    @classmethod
    def post_condition(cls, args):
        timeout = cfg.getfloat('times', 'kpfexpose_reset_time', fallback=10)
        log.debug(f'Waiting {timeout:.1f} s for EXPOSE to be Readout or Ready')
        expr = f"($kpfexpose.EXPOSE == 'Ready') or ($kpfexpose.EXPOSE == 'Readout')"
        log.warning(f"Waiting for kpfexpose to be Ready or Readout")
        success = ktl.waitFor(expr, timeout=timeout)
        if success is not True:
            kpfexposeexpose = ktl.cache('kpfexpose', 'EXPOSE')
            raise FailedToReachDestination(kpfexposeexpose.read(), 'Ready or Readout')
        else:
            kpfexpose = ktl.cache('kpfexpose')
            log.info(f"Reset detectors done")
            log.info(f"kpfexpose.EXPOSE = {kpfexpose['EXPOSE'].read()}")
            log.info(f"kpfexpose.EXPLAINR = {kpfexpose['EXPLAINR'].read()}")
            log.info(f"kpfexpose.EXPLAINNR = {kpfexpose['EXPLAINNR'].read()}")