EstimateOBDuration

Bases: KPFScript

Estimate the duration of the input OB. Uses estimates of instrument configuration time, slew time, acquire time, and readout time and combines those with the information in the observing block to estimate how long it will take to execute the observing block.

ARGS:

:fast: bool Estimate the duration assuming fast read mode? :OB: dict or ObservingBlock A fully specified observing block (OB).

Source code in kpf/scripts/EstimateOBDuration.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
class EstimateOBDuration(KPFScript):
    '''Estimate the duration of the input OB. Uses estimates of instrument
    configuration time, slew time, acquire time, and readout time and combines
    those with the information in the observing block to estimate how long it
    will take to execute the observing block.

    ARGS:
    =====
    :fast: `bool` Estimate the duration assuming fast read mode?
    :OB: `dict` or `ObservingBlock` A fully specified observing block (OB).
    '''
    @classmethod
    def pre_condition(cls, args, OB=None):
        pass

    @classmethod
    def perform(cls, args, OB=None):
        if OB is not None and type(OB) != ObservingBlock:
            OB = ObservingBlock(OB)
        fast = args.get('fast', False)
        duration = 0

        if OB.Calibrations is not None:
            duration += estimate_calibration_time(OB.Calibrations, cfg, fast=fast)

        if OB.Observations is not None:
            duration += estimate_observation_time(OB.Observations, cfg, fast=fast)

#         print(f"{duration/60:.0f} min")
        return duration/60

    @classmethod
    def post_condition(cls, args, OB=None):
        pass

    @classmethod
    def add_cmdline_args(cls, parser):
        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)