Bases: KPFScript
Script which configures the instrument for Cal OBs.
- OB -
ObservingBlock
or dict
A valid observing block (OB).
Source code in kpf/scripts/ConfigureForCalibrations.py
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
62
63
64
65
66
67
68
69
70
71 | class ConfigureForCalibrations(KPFScript):
'''Script which configures the instrument for Cal OBs.
ARGS:
=====
* __OB__ - `ObservingBlock` or `dict` A valid observing block (OB).
'''
@classmethod
def pre_condition(cls, args, OB=None):
pass
@classmethod
def perform(cls, args, OB=None):
if isinstance(OB, dict):
OB = ObservingBlock(OB)
calibrations = OB.Calibrations
log.info('-------------------------')
log.info(f"Running {cls.__name__}")
for i,calibration in enumerate(calibrations):
log.debug(f"Calibration {i+1}/{len(calibrations)}")
for key in calibration.to_dict():
log.debug(f" {key}: {calibration.get(key)}")
log.info('-------------------------')
check_scriptstop()
# Power on needed lamps
lamps = set([c.get('CalSource') for c in calibrations])
for lamp in lamps:
if IsCalSourceEnabled.execute({'CalSource': lamp}) == True:
if lamp in ['Th_daily', 'Th_gold', 'U_daily', 'U_gold',
'BrdbandFiber', 'WideFlat']:
CalLampPower.execute({'lamp': lamp, 'power': 'on'})
# Set back illumination LEDs to off
log.debug(f"Ensuring back illumination LEDs are off")
CalLampPower.execute({'lamp': 'ExpMeterLED', 'power': 'off'})
CalLampPower.execute({'lamp': 'CaHKLED', 'power': 'off'})
CalLampPower.execute({'lamp': 'SciLED', 'power': 'off'})
CalLampPower.execute({'lamp': 'SkyLED', 'power': 'off'})
check_scriptstop()
ConfigureFIU.execute({'mode': 'Calibration'})
check_scriptstop()
@classmethod
def post_condition(cls, args, OB=None):
pass
|