Bases: KPFTranslatorFunction
Set the Laser Frequency Comb (LFC) to "AstroComb" mode. This should
be used during operation of the LFC.
KTL Keywords Used:
kpfcal.OPERATIONMODE
kpfmon.HB_MENLOSTA
Scripts Called:
kpf.calbench.WaitForLFCReady
Source code in kpf/calbench/SetLFCtoAstroComb.py
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 | class SetLFCtoAstroComb(KPFTranslatorFunction):
'''Set the Laser Frequency Comb (LFC) to "AstroComb" mode. This should
be used during operation of the LFC.
KTL Keywords Used:
- `kpfcal.OPERATIONMODE`
- `kpfmon.HB_MENLOSTA`
Scripts Called:
- `kpf.calbench.WaitForLFCReady`
'''
@classmethod
def pre_condition(cls, args, logger, cfg):
heartbeat = ktl.cache('kpfmon', 'HB_MENLOSTA')
hb_success = heartbeat.waitFor('== "OK"', timeout=3)
if hb_success is False:
raise FailedPreCondition(f"Menlo heartbeat is not OK: {heartbeat.read()}")
lfc_mode = ktl.cache('kpfcal', 'OPERATIONMODE').read()
if lfc_mode not in ['AstroComb', 'StandbyHigh']:
raise FailedPreCondition(f"LFC must be in AstroComb or StandbyHigh: {lfc_mode}")
@classmethod
def perform(cls, args, logger, cfg):
lfc_mode = ktl.cache('kpfcal', 'OPERATIONMODE')
log.info('Setting LFC to AstroComb')
lfc_mode.write('AstroComb')
time_shim = cfg.getfloat('times', 'LFC_shim_time', fallback=10)
time.sleep(time_shim)
@classmethod
def post_condition(cls, args, logger, cfg):
success = WaitForLFCReady.execute({})
if success is not True:
raise FailedPostCondition('LFC did not reach expected state')
|