ConfigureFIU

Bases: KPFFunction

Set the FIU mode (kpffiu.MODE). If the wait option is fale this will retry the move if it fails with a configurable number of retries.

Parameters:
  • mode (str) –

    The desired FIU mode. Allowed values: Stowed, Alignment, Acquisition, Observing, Calibration

  • wait (bool) –

    Wait for move to complete before returning? (default: True)

KTL Keywords Used:

  • kpffiu.MODE

Functions Called:

  • kpf.calbench.ConfigureFIUOnce
  • kpf.calbench.WaitForConfigureFIU
Source code in kpf/fiu/ConfigureFIU.py
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
53
54
55
56
57
58
59
60
61
62
class ConfigureFIU(KPFFunction):
    '''Set the FIU mode (kpffiu.MODE). If the wait option is fale this will
    retry the move if it fails with a configurable number of retries.

    Args:
        mode (str): The desired FIU mode. Allowed values: Stowed, Alignment,
            Acquisition, Observing, Calibration
        wait (bool): Wait for move to complete before returning? (default: True)

    KTL Keywords Used:

    - `kpffiu.MODE`

    Functions Called:

    - `kpf.calbench.ConfigureFIUOnce`
    - `kpf.calbench.WaitForConfigureFIU`
    '''
    @classmethod
    def pre_condition(cls, args):
        keyword = ktl.cache('kpffiu', 'MODE')
        allowed_values = list(keyword._getEnumerators())
        if 'None' in allowed_values:
            allowed_values.pop(allowed_values.index('None'))
        check_input(args, 'mode', allowed_values=allowed_values)

    @classmethod
    def perform(cls, args):
        dest = args.get('mode')
        wait = args.get('wait', True)
        log.info(f"Configuring FIU for {dest}")
        ConfigureFIUOnce.execute({'mode': dest, 'wait': wait})
        if wait == True:
            WaitForConfigureFIU.execute({'mode': dest})

    @classmethod
    def post_condition(cls, args):
        pass

    @classmethod
    def add_cmdline_args(cls, parser):
        parser.add_argument('mode', type=str,
                            choices=['Stowed', 'Alignment', 'Acquisition',
                                     'Observing', 'Calibration'],
                            help='Desired mode (see kpffiu.MODE)')
        parser.add_argument("--nowait", dest="wait",
                            default=True, action="store_false",
                            help="Send move and return immediately?")
        return super().add_cmdline_args(parser)