SetGuiderOutdir

Bases: KPFTranslatorFunction

Set the value of the kpfguide.OUTDIR keyword

Parameters:
  • outdir (str) –

    The desired output path.

KTL Keywords Used:

  • kpfguide.OUTDIR
Source code in kpf/guider/SetGuiderOutdir.py
10
11
12
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
class SetGuiderOutdir(KPFTranslatorFunction):
    '''Set the value of the kpfguide.OUTDIR keyword

    Args:
        outdir (str): The desired output path.

    KTL Keywords Used:

    - `kpfguide.OUTDIR`
    '''
    @classmethod
    def pre_condition(cls, args, logger, cfg):
        check_input(args, 'outdir')

    @classmethod
    def perform(cls, args, logger, cfg):
        newoutdir = Path(args.get('outdir')).expanduser().absolute()
        kpfguide = ktl.cache('kpfguide')
        kpfguide['OUTDIR'].write(f"{newoutdir}")

    @classmethod
    def post_condition(cls, args, logger, cfg):
        pass

    @classmethod
    def add_cmdline_args(cls, parser, cfg=None):
        parser.add_argument('outdir', type=str,
                            help='The desired output path')
        return super().add_cmdline_args(parser, cfg)