-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruvTest.py
67 lines (46 loc) · 1.17 KB
/
ruvTest.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import numpy as np
import sys
import os
from lxml import objectify
import arrayConfigurationTools as ac
import numpy as np
import math
def computeRuv(fileCasa):
"""
Compute the radial distance in the uv plane
"""
f = open(fileCasa, 'r')
xx = []
yy = []
for line in f:
if line[0] != "#":
dat = line.split()
xx.append(float(dat[0]))
yy.append(float(dat[1]))
f.close()
nant = len(xx)
nbl = nant * (nant - 1) / 2
Ruv = np.zeros(nbl)
index = 0
for i in range(nant):
for j in range(0, i):
r2 = (xx[i] - xx[j]) * (xx[i] - xx[j]) + (yy[i] - yy[j]) * (
yy[i] - yy[j])
Ruv[index] = math.sqrt(r2)
index += 1
return (Ruv)
def computeBL(AR, freq):
"""
compute the BL in meter for a resolution AR (applying a Briggs correction
"""
try:
BLmax = 61800 / (freq * AR)
except ZeroDivisionError:
return 0.
if BLmax < 165.6:
BLmax = 165.6
return (BLmax)
# a = ac.ArrayConfigurationCasaFile()
# a.createCasaConfig("examplePads.txt")
# ruv = computeRuv("examplePads.txt.cfg")
# print ruv