EastNorth

Bases: KPFFunction

Move the telescope a given distance in arcseconds East and/or North.

Parameters:
  • East (float) –

    Distance to move the telescope East in arcseconds.

  • North (float) –

    Distance to move the telescope North in arcseconds.

KTL Keywords Used:

  • dcs.RAOFF
  • dcs.DECOFF
  • dcs.REL2CURR
  • dcs.AXESTAT
Source code in kpf/telescope/EastNorth.py
 9
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class EastNorth(KPFFunction):
    '''Move the telescope a given distance in arcseconds East and/or North.

    Args:
        East (float): Distance to move the telescope East in arcseconds.
        North (float): Distance to move the telescope North in arcseconds.

    KTL Keywords Used:

    - `dcs.RAOFF`
    - `dcs.DECOFF`
    - `dcs.REL2CURR`
    - `dcs.AXESTAT`
    '''
    @classmethod
    def pre_condition(cls, args):
        max_offset = cfg.getfloat('telescope', 'max_offset', fallback=900)
        check_input(args, 'NodE', allowed_types=[int, float],
                    value_min=-max_offset, value_max=max_offset)
        check_input(args, 'NodN', allowed_types=[int, float],
                    value_min=-max_offset, value_max=max_offset)

    @classmethod
    def perform(cls, args):
        dcsint = cfg.getint('telescope', 'telnr', fallback=1)
        dcs = ktl.cache(f'dcs{dcsint:1d}')
        if KPF_is_selected_instrument():
            east = args.get('NodE', 0)
            north = args.get('NodN', 0)
            log.info(f'Ofsetting telescope: {east:.2f} {north:.2f}')
            dcs['RAOFF'].write(east)
            dcs['DECOFF'].write(north)
            dcs['REL2CURR'].write(True)
        else:
            INSTRUME = dcs['INSTRUME'].read()
            log.error(f'Selected instrument is {INSTRUME}, not KPF. No telescope moves allowed.')

    @classmethod
    def post_condition(cls, args):
        if KPF_is_selected_instrument():
            dcsint = cfg.getfloat('telescope', 'telnr', fallback=1)
            AXESTAT = ktl.cache(f'dcs{dcsint}', 'AXESTAT')
            tracking = AXESTAT.waitfor('=="tracking"')
            if tracking == False:
                raise FailedPostCondition('dcs.AXESTAT did not return to "tracking"', timeout=20)

    @classmethod
    def add_cmdline_args(cls, parser):
        parser.add_argument('NodE', type=float,
            help="Distance to move the telescope East in arcseconds")
        parser.add_argument('NodN', type=float,
            help="Distance to move the telescope North in arcseconds")
        return super().add_cmdline_args(parser)