forked from kd7lxl/Signal-Server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathant2azel.py
executable file
·26 lines (21 loc) · 869 Bytes
/
ant2azel.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
#!/usr/bin/env python
import sys
from os.path import splitext
def db_to_norm(db):
return 10**(db/10.)
antfilename = sys.argv[1]
basename = splitext(antfilename)[0]
with open(antfilename, 'r') as ant:
with open(basename + '.az', 'w') as az:
# azimuth offset (e.g., 0, 120, or 240)
az.write("0\n")
# Read the first 360 lines of the file, which correspond to azimuth
for i in xrange(360):
az.write("%d\t%0.4f\n" % (i, db_to_norm(float(next(ant)))))
with open(basename + '.el', 'w') as el:
# (mechanical downtilt, azimuth of tilt)
el.write("%0.1f\t%0.1f\n" % (0.0, 0.0))
# Read the lines for elevations +10 through -90).
# The rest of the .ant is unused.
for i, line in enumerate(list(ant)[80:181], -10):
el.write("%d\t%0.4f\n" % (i, db_to_norm(float(line))))