ConfigureForScience

Bases: KPFFunction

Script which configures the instrument for Science observations.

  • Sets octagon / simulcal source
  • Sets source select shutters
  • Set triggered detectors

ARGS:

Source code in kpf/scripts/ConfigureForScience.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
class ConfigureForScience(KPFFunction):
    '''Script which configures the instrument for Science observations.

    - Sets octagon / simulcal source
    - Sets source select shutters
    - Set triggered detectors

    ARGS:
    =====

    '''
    @classmethod
    def pre_condition(cls, observation):
        pass

    @classmethod
    def perform(cls, observation):
        log.info('-------------------------')
        log.info(f"Running {cls.__name__}")
        log.info('-------------------------')

        # Offset if requested
#         NodN = observation.get('NodN', 0)
#         NodE = observation.get('NodE', 0)
#         if abs(NodN) > 0.01 or abs(NodE) > 0.01:
#             EastNorth.execute(observation)

        check_scriptstop()

        # Confirm guiding
        ConfirmGuiding.execute(observation)

        check_scriptstop()

        # Set Octagon
        SetSimulCalSource.execute({})

        check_scriptstop()

        # Set source select shutters
        exposestatus = ktl.cache('kpfexpose', 'EXPOSE')
        if exposestatus.read() != 'Ready':
            log.info(f"Waiting for kpfexpose to be Ready")
            WaitForReady.execute({})
            log.debug(f"kpfexpose is Ready")
        log.info(f"Set Source Select Shutters")
        SetSourceSelectShutters.execute({'OpenScienceShutter': True,
                                         'OpenSkyShutter': not observation.get('BlockSky', False),
                                         'OpenSoCalSciShutter': False,
                                         'OpenSoCalCalShutter': False,
                                         'OpenCalSciSkyShutter': False})

        # Set Triggered Detectors
        observation['TriggerGuide'] = True
        SetTriggeredDetectors.execute(observation)

        check_scriptstop()

    @classmethod
    def post_condition(cls, observation):
        pass