EstimateOBDuration

Bases: KPFTranslatorFunction

Estimate the duration of the input OB.

This script will determine the OB type (science or calibration) and invoke either EstimateCalOBDuration or EstimateSciOBDuration

ARGS:

:OB: dict A fully specified observing block (OB).

Source code in kpf/utils/EstimateOBDuration.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
39
40
41
42
43
class EstimateOBDuration(KPFTranslatorFunction):
    '''Estimate the duration of the input OB.

    This script will determine the OB type (science or calibration) and invoke
    either `EstimateCalOBDuration` or `EstimateSciOBDuration`

    ARGS:
    =====
    :OB: `dict` A fully specified observing block (OB).
    '''
    @classmethod
    def pre_condition(cls, OB, logger, cfg):
        pass

    @classmethod
    def perform(cls, OB, logger, cfg):
        if OB['Template_Name'] == 'kpf_cal':
            return EstimateCalOBDuration.execute(OB)
        elif OB['Template_Name'] == 'kpf_sci':
            return EstimateSciOBDuration.execute(OB)
        else:
            print(f"Time estimate not supported for {OB['Template_Name']} type")

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

    @classmethod
    def add_cmdline_args(cls, parser, cfg=None):
        parser.add_argument('--fast', '--fastread',
                            dest="fast",
                            default=False, action="store_true",
                            help='Use fast readout mode times for estimate?')
        return super().add_cmdline_args(parser, cfg)