Bases: KPFFunction
Sets the OBJECT keyword for the science detectors in the kpfexpose
keyword service.
ARGS:
:Object: str
The desired object keyword value.
Source code in kpf/spectrograph/SetObject.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 | class SetObject(KPFFunction):
'''Sets the OBJECT keyword for the science detectors in the kpfexpose
keyword service.
ARGS:
=====
:Object: `str` The desired object keyword value.
'''
@classmethod
def pre_condition(cls, args):
pass
@classmethod
def perform(cls, args):
OBJECT = ktl.cache('kpfexpose', 'OBJECT')
obj = args.get('Object', '')
if obj is None:
obj = ''
log.debug(f"Setting OBJECT to '{obj}'")
OBJECT.write(obj)
@classmethod
def post_condition(cls, args):
obj = args.get('Object', '')
if obj is None:
obj = ''
timeout = cfg.getfloat('times', 'kpfexpose_response_time', fallback=1)
OBJECT = ktl.cache('kpfexpose', 'OBJECT')
if OBJECT.waitFor(f"== '{obj}'", timeout=timeout) is not True:
raise FailedToReachDestination(OBJECT.read(), obj)
@classmethod
def add_cmdline_args(cls, parser):
parser.add_argument('Object', type=str,
help='The OBJECT keyword')
return super().add_cmdline_args(parser)
|