-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathplot_antpos_hera19.py
executable file
·36 lines (31 loc) · 1.13 KB
/
plot_antpos_hera19.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
#! /usr/bin/env python
import aipy as a, numpy as n, pylab as p
import sys, optparse
import IPython
o = optparse.OptionParser()
a.scripting.add_standard_options(o, cal=True)
o.add_option('--aspect_neq', action='store_true', help='Do not force equal aspect in x/y plot.')
o.add_option('--nonumbers', action='store_true', help='Do not plot antenna numbers next to symbols.')
opts, args = o.parse_args(sys.argv[1:])
th = n.arange(0, 2*n.pi, .01)
r = 5.
aa = a.cal.get_aa(opts.cal, .1, .1, 1)
antpos = [aa.get_baseline(0,i,src='z') for i in range(len(aa.ants))]
antpos = n.array(antpos) * a.const.len_ns / 100.
x,y,z = antpos[:,0], antpos[:,1], antpos[:,2]
x -= n.average(x)
y -= n.average(y)
for ant,(xa,ya,za) in enumerate(zip(x,y,z)):
hx,hy = r*za*n.cos(th)+xa, r*za*n.sin(th)+ya
if za > 0: fmt = '#eeeeee'
else: fmt = '#a0a0a0'
#p.fill(hx,hy, fmt)
if za != 0:
p.plot(xa,ya,'k.')
if not opts.nonumbers: p.text(xa,ya, str(ant))
p.grid()
p.xlabel("East-West Antenna Position (m)")
p.ylabel("North-South Antenna Position (m)")
a = p.gca()
if not opts.aspect_neq: a.set_aspect('equal')
p.savefig('antpos_hera19.png')