Bases: KPFFunction
Return a boolean indicating whether the telescope has been released.
Note that this uses the schedule API which resets at local midnight, so if
the current time is after midnight and before 8am, this assumes release.
Source code in kpf/observatoryAPIs/GetTelescopeRelease.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 | class GetTelescopeRelease(KPFFunction):
'''Return a boolean indicating whether the telescope has been released.
Note that this uses the schedule API which resets at local midnight, so if
the current time is after midnight and before 8am, this assumes release.
'''
@classmethod
def pre_condition(cls, args):
pass
@classmethod
def perform(cls, args):
utnow = datetime.datetime.utcnow()
if utnow.hour >= 10 and utnow.hour < 18:
# log.debug(f'UT hour > 10 assume release')
return True
params = {'telnr': args.get('telnr', 1)}
result = query_observatoryAPI('schedule', 'getTelescopeReadyState', params)
log.debug(f'getTelescopeReadyState returned {result}')
return result.get('State', '') == 'Ready'
@classmethod
def post_condition(cls, args):
pass
|