Bases: KPFFunction
Sets the OBSERVER keyword for the science detectors in the kpfexpose
keyword service.
Parameters: |
-
observer
(str )
–
The desired value of the OBSERVER keyword.
|
KTL Keywords Used:
Source code in kpf/spectrograph/SetObserver.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 | class SetObserver(KPFFunction):
'''Sets the OBSERVER keyword for the science detectors in the kpfexpose
keyword service.
Args:
observer (str): The desired value of the OBSERVER keyword.
KTL Keywords Used:
- `kpfexpose.OBSERVER`
'''
@classmethod
def pre_condition(cls, args):
check_input(args, 'observer')
@classmethod
def perform(cls, args):
OBSERVER = ktl.cache('kpfexpose', 'OBSERVER')
log.info(f"Setting OBSERVER to {args.get('observer')}")
OBSERVER.write(args.get('observer'))
@classmethod
def post_condition(cls, args):
observerval = args.get('observer')
timeout = cfg.getfloat('times', 'kpfexpose_response_time', fallback=1)
OBSERVER = ktl.cache('kpfexpose', 'OBSERVER')
if OBSERVER.waitFor(f'== "{observerval}"', timeout=timeout) is not True:
raise FailedToReachDestination(OBSERVER.read(), observerval)
@classmethod
def add_cmdline_args(cls, parser):
parser.add_argument('observer', type=str,
help='The OBSERVER keyword')
return super().add_cmdline_args(parser)
|