本文整理匯總了Python中receiver.Receiver.hangUp方法的典型用法代碼示例。如果您正苦於以下問題:Python Receiver.hangUp方法的具體用法?Python Receiver.hangUp怎麽用?Python Receiver.hangUp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類receiver.Receiver
的用法示例。
在下文中一共展示了Receiver.hangUp方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import hangUp [as 別名]
import random
from receiver import Receiver
# tests the receiver
a = []
e = []
rec = Receiver()
for i in range(25):
for j in range(10):
a.append(random.randint(1, 100))
e.append(random.randint(1, 100))
print "sending: %r" % i
rec.receiveIdeal(e, a)
e = []
a = []
rec.hangUp()
示例2: testblockLPC
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import hangUp [as 別名]
def testblockLPC(signal, blocksize, numcoef, ideal=False, compress=False, lookback = True, showplot=True, bitdepth=1):
#Set up receiver
recv = Receiver(lookback = lookback)
e_complete = zeros(0)
#Process blocks
for i in range(len(signal)/blocksize):
#find LPC coefficients
a = levinson(signal[i*blocksize:(i+1)*blocksize], numcoef, False)
#build error
e = zeros(blocksize)
if ideal == True:
if i == 0 or recv.lookback == False:
e = idealError(signal[i*blocksize:(i+1)*blocksize], a, zeros(len(a)))
else:
e = idealError(signal[i*blocksize:(i+1)*blocksize], a, signal[i*blocksize-len(a):i*blocksize])
if compress == True:
temp_e = compressError(e, bitdepth)
temp_e = shiftCompressedError(temp_e, bitdepth)
e = scaleRMS(e, temp_e)
else:
classification = classify(signal[i*blocksize:(i+1)*blocksize])
classification[1].sort()
if classification[0] or True:
for i in range(len(e)):
# for p in classification[1]:
if i%60 == 0:
e[i] = 1
else:
e = randn(len(e))
# e = e*classification[2]
e_complete = append(e_complete, e)
#Xmit and rebuild
recv.receiveIdeal(e, a)
#complete the transmission
recv.hangUp()
if showplot == True:
#Plot results
subplot(3, 1, 1)
title("Signal Reconstruction with Impulse Train", size=20)
plot(signal, label="Input Signal", lw=2)
legend()
subplot(3, 1, 2)
plot(e_complete, label="Excitation Signal", lw=2)
legend()
subplot(3, 1, 3)
plot(recv.output, label="Decoded Signal", lw=2)
# ylim([-5, 5])
legend()
show()
return recv.output