-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecam_altaz2radec.py
executable file
·41 lines (32 loc) · 1.1 KB
/
decam_altaz2radec.py
1
2
3
4
5
6
7
8
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
#!/usr/bin/env python
import sys
import json
import config
import ephem
here = config.my_locations['ctio']
def main(start_time, alt_az_file, out_file):
here.date = start_time
f = open(alt_az_file)
exposures = []
for line in f:
if not line.startswith('#'):
az, alt = line.split()
az.strip()
alt.strip()
ra, dec = here.radec_of(az,alt)
print here.date, az, alt, '=', ra, dec
exposures.append({'expType':'object',
'filter':'r',
'expTime':30,
'object':'Hexapod LUT',
'RA': str(ra),
'dec': str(dec),
'exclude': '[GUIDER, AOS]'
})
here.date = here.date + ephem.minute*1.6
f_out = open(out_file, 'w')
f_out.write(json.dumps(exposures))
if __name__ == '__main__':
now = ephem.now()
print "Current time is %s" % now
main(now + ephem.minute*float(sys.argv[1]), sys.argv[2], sys.argv[3])