Esempio n. 1
0
mtype = ['RSSI', 'Phase', 'cross', 'and', 'or', 'xor', 'syn']

mtype_num = len(mtype)
ust = zeros(mtype_num)

''' 采样 ''' 
rssi_A, rssi_B, rssi_E  = sampling_RSSI( sampling_period,sampling_time)  
phase_A,phase_B,phase_E = sampling_phase(sampling_period,sampling_time)
    
''' RSSI量化 '''
bits_A_rssi,drop_list_A = quantize_ASBG_1bit(rssi_A)
bits_B_rssi,drop_list_B = quantize_ASBG_1bit(rssi_B)
bits_A_rssi = remain(bits_A_rssi,drop_list_B)

''' Phase量化 '''
bits_A_phase = quantize_phase(phase_A)

''' 合并 '''
bits_A_cross = merge(bits_A_rssi,bits_A_phase,'cross')
bits_A_and   = merge(bits_A_rssi,bits_A_phase,'and')
bits_A_or    = merge(bits_A_rssi,bits_A_phase,'or')
bits_A_xor   = merge(bits_A_rssi,bits_A_phase,'xor')
bits_A_syn   = merge(bits_A_rssi,bits_A_phase,'syn')

''' 评价性能 '''
ust[0] = UST(bits_A_rssi)
ust[1] = UST(bits_A_phase)
ust[2] = UST(bits_A_cross)
ust[3] = UST(bits_A_and)
ust[4] = UST(bits_A_or)
ust[5] = UST(bits_A_xor)
Esempio n. 2
0
    print 'Running... Current group:', i
    begin = datetime.datetime.now()

    if mtype[i] == 'RSSI':
        for j in range(group_num):
            ''' RSSI Only '''
            bits_A_rssi, drop_list_A = quantize_ASBG_1bit(rssi_A)
            bits_B_rssi, drop_list_B = quantize_ASBG_1bit(rssi_B)
            bits_A_rssi = remain(bits_A_rssi, drop_list_B)
            bits_B_rssi = remain(bits_B_rssi, drop_list_A)

    elif mtype[i] == 'Phase':
        for j in range(group_num):
            ''' Phase Only '''
            bits_A_phase = quantize_phase(phase_A)
            bits_B_phase = quantize_phase(phase_B)

    else:
        for j in range(group_num):
            ''' RSSI量化 '''
            bits_A_rssi, drop_list_A = quantize_ASBG_1bit(rssi_A)
            bits_B_rssi, drop_list_B = quantize_ASBG_1bit(rssi_B)
            bits_A_rssi = remain(bits_A_rssi, drop_list_B)
            bits_B_rssi = remain(bits_B_rssi, drop_list_A)
            ''' Phase量化 '''
            bits_A_phase = quantize_phase(phase_A)
            bits_B_phase = quantize_phase(phase_B)
            ''' 合并 '''
            bits_A = merge(bits_A_rssi, bits_A_phase, mtype[i])
            bits_B = merge(bits_B_rssi, bits_B_phase, mtype[i])
Esempio n. 3
0
''' 多组取平均 '''
group_num = 100
order_num = len(order)
qtype_num = len(qtype)
bmr = zeros((group_num, order_num, qtype_num))
bgr = zeros((group_num, order_num, qtype_num))

for i in range(group_num):
    for j in range(order_num):
        for k in range(qtype_num):
            print 'Running... Current group: ', i, j, k
            ''' 采样 '''
            phase_A, phase_B, phase_E = sampling_phase(sampling_period,
                                                       sampling_time)
            ''' Phase量化 '''
            bits_A = quantize_phase(phase_A, qtype[k], order[j])
            bits_B = quantize_phase(phase_B, qtype[k], order[j])
            ''' 评价性能 '''
            bmr[i, j, k] = BMR(bits_A, bits_B)
            bgr[i, j, k] = BGR(bits_A, sampling_time, sampling_period)

bmr = mean(bmr, 0)
bgr = mean(bgr, 0)
''' 画图 '''
plt.figure(figsize=(8, 5))
plt.plot(order, bmr[:, 0], 'ko-', label=qtype[0])
plt.plot(order, bmr[:, 1], 'k^:', label=qtype[1])
plt.ylim(0, 0.2)
plt.xlabel('Quantize Order')
plt.ylabel('BMR')
plt.title('BMR of different order')