本文整理汇总了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