Exemplo n.º 1
0
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]]
del_c=[a for a in del_sp_w[0]]
var_c=[a for a in var_sp_w[0]]
print(np.amin(var_uns[0]),np.amin(w_ij[0]))
snr_c=[a/math.sqrt(b) if b!=0 else 0 for a,b in zip(del_sp_w[0],var_sp_w[0])]
Exemplo n.º 2
0
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=[]
offset_dij=[]
offset_sij=[]
offset=10
offset_snr.append([a+offset for a in snr_c])
Exemplo n.º 3
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))
Exemplo n.º 4
0
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.
normed_signal_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])
]
Exemplo n.º 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))