Example #1
0
s_ind=np.argsort(f_start)
f=sort_from_indexes(s_ind,f_uns)
f=np.around(f,decimals=7)
p=sort_from_indexes(s_ind,p_uns)
f0=sort_from_indexes(s_ind,f0_uns)
fs=sort_from_indexes(s_ind,fs_uns)
del_s=sort_from_indexes(s_ind,del_uns)
var_s=sort_from_indexes(s_ind,var_uns)
#pad each list so they can be added together
pad_param=find_pad_param(f,fs[0])
print(pad_param)
wp=[]
del_sp=[]
var_sp=[]
for i in range(0,n_ss):
    wp.append(pad_l(f[i],pad_param,p[i]))
    del_sp.append(pad_l(f[i],pad_param,del_s[i]))
    var_sp.append(pad_l(f[i],pad_param,var_s[i]))

w_ijk=calc_weight_ijk(var_sp)
w_ij=np.transpose(w_ijk)

del_sp_w=[]
var_sp_w=[]
#print(w_ij[3][500:510])
for k in range(0,n_ss):
    del_sp_w.append([a*b for a,b in zip(del_sp[k],w_ij[k])])
    var_sp_w.append([a*b**2 for a,b in zip(var_sp[k],w_ij[k])])
#sum the powers and offset the subspectra for plotting
#sp are offset spectra, offset simply for plotting purposes.
wp_t=[a for a in wp[0]]
Example #2
0
p_array=call_process("20160218")
f=processed_streams(p_array).f
f0=processed_streams(p_array).f0
fs=processed_streams(p_array).fs
p=processed_streams(p_array).p
sig_sq_ij=processed_streams(p_array).sig_sq_ij
delta_ij=processed_streams(p_array).delta_ij
n_ss=len(f)

#pad the streams with zeros for co-adding
pad_param=find_pad_param(f,fs[0])
p_pad=[]
delta_ij_pad=[]
sig_sq_ij_pad=[]
for i in range(0,n_ss):
    p_pad.append(pad_l(f[i],pad_param,p[i]))
    delta_ij_pad.append(pad_l(f[i],pad_param,delta_ij[i]))
    sig_sq_ij_pad.append(pad_l(f[i],pad_param,sig_sq_ij[i]))
#find the weighting factors
w_ijk=calc_weight_ijk(sig_sq_ij_pad)
w_ij=np.transpose(w_ijk)
#weight the delta_ij and sigma_sq_ij padded streams
delta_ij_pad_w=[]
sig_sq_ij_pad_w=[]
for k in range(0,n_ss):
    delta_ij_pad_w.append([a*b for a,b in zip(delta_ij_pad[k],w_ij[k])])
    sig_sq_ij_pad_w.append([a*b**2 for a,b in zip(sig_sq_ij_pad[k],w_ij[k])])
#sum the powers and offset the subspectra for plotting
#offset_snr are offset spectra, offset simply for plotting purposes.
snr_c=[a/math.sqrt(b) if b!=0 else b for a,b in zip(delta_ij_pad_w[0],sig_sq_ij_pad_w[0])]
offset_snr=[]
Example #3
0
wp=[]
n_ss=len(rn)
#Call functions to process data and fill lists
for i in range (0,n_ss):
    ls=process(rn[i])
    p.append(ls[1])
    f.append(ls[0])
    f0.append(ls[2])
    fs=ls[3]
    del ls
#pad each list so they can be added together
pad_param=find_pad_param(f,fs)
print(pad_param)
wp=[]
for i in range(0,n_ss):
    wp.append(pad_l(f[i],pad_param,p[i]))

wp_t=[a for a in wp[0]]
#sum the powers and offset the subspectra for plotting
sp=[]
sp.append([a+10 for a in p[0]])
for i in range (1,n_ss):
    sp.append([a+10*(i%8+1) for a in p[i]])
    wp_t=[a+b for a,b in zip(wp_t,wp[i])]
#create the full frequency list
f_t=np.linspace(pad_param[0],pad_param[1],pad_param[2])
#f_t=np.linspace(pad_param[0]+np.amin(f0)-.0008,pad_param[1]+np.amax(f0)+.0008,pad_param[2])
print(len(f_t[0:len(wp_t)]),len(wp_t))
print(f0)
#plot grand spectrum
plt.plot(f_t[0:len(wp_t)],wp_t)
Example #4
0
f0 = processed_streams(p_array).f0
fs = processed_streams(p_array).fs
p = processed_streams(p_array).p
sig_sq_ij = processed_streams(p_array).sig_sq_ij
delta_ij = processed_streams(p_array).delta_ij
n_ss = len(f)

#pad the streams with zeros for co-adding
print(len(fs))
pad_param = find_pad_param(f, fs[0])
p_pad = []
delta_ij_pad = []
sig_sq_ij_pad = []
for i in range(0, n_ss):
    print(len(f[i]), len(p[i]))
    p_pad.append(pad_l(f[i], pad_param, p[i]))
    delta_ij_pad.append(pad_l(f[i], pad_param, delta_ij[i]))
    sig_sq_ij_pad.append(pad_l(f[i], pad_param, sig_sq_ij[i]))
#find the weighting factors
w_ijk = calc_weight_ijk(sig_sq_ij_pad)
w_ij = np.transpose(w_ijk)
#weight the delta_ij and sigma_sq_ij padded streams
delta_ij_pad_w = []
sig_sq_ij_pad_w = []
for k in range(0, n_ss):
    delta_ij_pad_w.append([a * b for a, b in zip(delta_ij_pad[k], w_ij[k])])
    sig_sq_ij_pad_w.append(
        [a * b**2 for a, b in zip(sig_sq_ij_pad[k], w_ij[k])])

#sum the powers and offset the subspectra for plotting
#offset_snr are offset spectra, offset simply for plotting purposes.
Example #5
0
#for testing
import random
import calc_weights
import pad_list
import numpy as np
ll = []
for i in range(0, 3):
    ll.append([])
    for j in range(0, 10):
        ll[i].append(3 * i + j)
#print(ll)
pad_param = pad_list.find_pad_param(ll, 1)

#print(pad_param)
var = []
for i in range(0, 3):
    var.append([])
    for j in range(0, 10):
        var[i].append(random.random())
var_pad = []
ll_pad = []
for i in range(0, 3):
    var_pad.append(pad_list.pad_l(pad_param[2], pad_param, var[i]))
    ll_pad.append(pad_list.pad_l(pad_param[2], pad_param, ll[i]))
#print(var_pad[i])
w_ijk = calc_weights.calc_weight_ijk(var_pad)
for i in range(0, 3):
    print(len(w_ijk[i]))
    #print(np.transpose(w_ijk[i]))
print(np.transpose(w_ijk))
Example #6
0
#for testing
import random
import calc_weights
import pad_list
import numpy as np
ll=[]
for i in range(0,3):
    ll.append([])
    for j in range (0,10):
        ll[i].append(3*i+j)
#print(ll)
pad_param=pad_list.find_pad_param(ll,1)

#print(pad_param)
var=[]
for i in range (0,3):
    var.append([])
    for j in range(0,10):
        var[i].append(random.random())
var_pad=[]
ll_pad=[]
for i in range (0,3):
    var_pad.append(pad_list.pad_l(pad_param[2],pad_param,var[i]))
    ll_pad.append(pad_list.pad_l(pad_param[2],pad_param,ll[i]))
#print(var_pad[i])
w_ijk=calc_weights.calc_weight_ijk(var_pad)
for i in range(0,3):
    print(len(w_ijk[i]))
    #print(np.transpose(w_ijk[i]))
print(np.transpose(w_ijk))