-
Notifications
You must be signed in to change notification settings - Fork 10
/
chan_util.py
executable file
·72 lines (55 loc) · 1.69 KB
/
chan_util.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
67
68
69
70
global nschan, ifbw, nschanx, nsavg
nschan = 4096
ifbw = 600.
nschanx = 341
nsavg = [64,97,131,162,200,227,262]+[284]*27
def chan_asmt(bnd):
# Input band (bnd) ranges from 1-34, but the code below uses band,
# which ranges from 0-33.
band = bnd - 1
if bnd < 1 or bnd > 34:
# Error in band number provided
return -1
global nschan, ifbw, nschanx, nsavg
df = ifbw/nschan
chasmt = [0]*nschanx
# Create list of science channels for each band up to this one
nscichan = []
for n in nsavg[0:band+1]:
nscichan.append(int(500/(n*df)))
# Sum number of science channels for all bands up to but
# not including this one.
nsci = 0
if band is 0:
pass
else:
for n in nscichan[0:band]:
nsci += n
for i in range(nscichan[band]):
chasmt += [i+nsci+1]*nsavg[band]
nrest = 4096 - len(chasmt)
chasmt += [0]*nrest
return chasmt
def start_freq(band):
# Input band (bnd) ranges from 1-34
if band < 1 or band > 34:
# Error in band number provided
return -1
global nschan, ifbw, nschanx, nsavg
df = ifbw/nschan
sf = []
# Create list of frequencies for each science channel in this band
nscichan = int(500/(nsavg[band-1]*df))
for n in range(nscichan):
sf.append(0.450 + band*0.5 + (nschanx + nsavg[band-1]*n)*df/1000.)
return sf
def sci_bw(band):
# Input band (bnd) ranges from 1-34
if band < 1 or band > 34:
# Error in band number provided
return -1
global nschan, ifbw, nschanx, nsavg
df = ifbw/nschan
nscichan = int(500/(nsavg[band-1]*df))
scibw = [nsavg[band-1]*df/1000.]*nscichan
return scibw