SetGuiderOutdir

Bases: KPFFunction

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(KPFFunction):
    '''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):
        check_input(args, 'outdir')

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

    @classmethod
    def post_condition(cls, args):
        pass

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