PredictGuiderParameters

Bases: KPFTranslatorFunction

Estimate the proper gain and FPS given the stellar Jmag.

Parameters:
  • Jmag (float) –

    The J magnitude of the target.

Scripts Called:

  • kpf.guider.SetGuiderGain
  • kpf.guider.SetGuiderFPS
Source code in kpf/guider/PredictGuiderParameters.py
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class PredictGuiderParameters(KPFTranslatorFunction):
    '''Estimate the proper gain and FPS given the stellar Jmag.

    Args:
        Jmag (float): The J magnitude of the target.

    Scripts Called:

     - `kpf.guider.SetGuiderGain`
     - `kpf.guider.SetGuiderFPS`
    '''
    @classmethod
    def pre_condition(cls, args, logger, cfg):
        check_input(args, 'Jmag', allowed_types=[int, float])

    @classmethod
    def perform(cls, args, logger, cfg):
        Jmag = args.get('Jmag')
        if Jmag < 5.5:
            gain = 'Low'
            fps = 100
        elif Jmag < 8.0:
            gain = 'Medium'
            fps = 100
        elif Jmag < 12.0:
            gain = 'High'
            fps = 100
        elif Jmag < 12.8:
            gain = 'High'
            fps = 50
        elif Jmag < 13.8:
            gain = 'High'
            fps = 20
        elif Jmag < 14.5:
            gain = 'High'
            fps = 10
        elif Jmag < 17.0:
            gain = 'high'
            fps = 1
        else:
            gain = 'high'
            fps = 1
        log.info(f"Predicted GuideCamGain = {gain}")
        log.info(f"Predicted GuideFPS = {fps:d}")
        result = {'GuideCamGain': gain, 'GuideFPS': fps}
        if args.get('set', False):
            SetGuiderGain.execute(result)
            SetGuiderFPS.execute(result)
        return result

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

    @classmethod
    def add_cmdline_args(cls, parser, cfg=None):
        parser.add_argument('Jmag', type=float,
                            help="The J magnitude of the target")
        parser.add_argument("--set", dest="set",
            default=False, action="store_true",
            help="Set these values after calculating?")
        return super().add_cmdline_args(parser, cfg)