TakeGuiderExposure

Bases: KPFFunction

Depending on whether the guide camera is running in continuous mode or not, this will either grab the next exposure (if in continuous mode) or trigger a new exposure.

KTL Keywords Used:

  • kpfguide.EXPTIME
  • kpfguide.LASTFILE

Functions Called:

  • kpf.guider.TriggerSingleGuiderExposure
  • kpf.guider.GrabGuiderExposure
Source code in kpf/guider/TakeGuiderExposure.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class TakeGuiderExposure(KPFFunction):
    '''Depending on whether the guide camera is running in continuous mode or
    not, this will either grab the next exposure (if in continuous mode) or
    trigger a new exposure.

    KTL Keywords Used:

    - `kpfguide.EXPTIME`
    - `kpfguide.LASTFILE`

    Functions Called:

    - `kpf.guider.TriggerSingleGuiderExposure`
    - `kpf.guider.GrabGuiderExposure`
    '''
    @classmethod
    def pre_condition(cls, args):
        pass

    @classmethod
    def perform(cls, args):
        kpfguide = ktl.cache('kpfguide')
        exptime = kpfguide['EXPTIME'].read(binary=True)
        lastfile = kpfguide['LASTFILE']

        if guider_is_active():
            if guider_is_saving():
                GrabGuiderExposure.execute({})
            else:
                # not sure what right action is here
                log.warning('Guider is active, but not saving. No image saved.')
        else:
            TriggerSingleGuiderExposure.execute({})

        lastfile.monitor()
        lastfile.wait(timeout=exptime*2+1) # Wait for update which signals a new file

    @classmethod
    def post_condition(cls, args):
        pass