本文整理匯總了Python中receiver.Receiver.demodulate方法的典型用法代碼示例。如果您正苦於以下問題:Python Receiver.demodulate方法的具體用法?Python Receiver.demodulate怎麽用?Python Receiver.demodulate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類receiver.Receiver
的用法示例。
在下文中一共展示了Receiver.demodulate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import demodulate [as 別名]
else:
channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
# transmit the samples, and retrieve samples back from the channel
try:
samples_rx = channel.xmit_and_recv(mod_samples)
except ZeroDivisionError:
# should only happen for audio channel
print "I didn't get any samples; is your microphone or speaker OFF?"
sys.exit(1)
#################################
# process the received samples
# make receiver
r = Receiver(fc, opt.samplerate, opt.spb)
demod_samples = r.demodulate(samples_rx)
one, zero, thresh = r.detect_threshold(demod_samples)
barker_start = r.detect_preamble(demod_samples, thresh, one)
rcdbits = r.demap_and_check(demod_samples, barker_start)
decoded_bits = r.decode(rcdbits)
# push into sink
sink = Sink()
rcd_payload = sink.process(decoded_bits)
if len(rcd_payload) > 0:
hd, err = common_srcsink.hamming(decoded_bits, databits)
print 'Hamming distance for payload at frequency', fc,'Hz:', hd, 'BER:', err
else:
print 'Could not recover transmission.'
示例2: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import demodulate [as 別名]
channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
# transmit the samples, and retrieve samples back from the channel
try:
samples_rx = channel.xmit_and_recv(mod_samples)
except ZeroDivisionError:
# should only happen for audio channel
print "I didn't get any samples; is your microphone or speaker OFF?"
sys.exit(1)
#################################
# process the received samples
# make receiver
r = Receiver(fc, opt.samplerate, opt.spb)
# demod_samples = r.demodulate(samples_rx)
demod_samples = r.demodulate(mod_samples) # no bit errors, feed directly to receiver
one, zero, thresh = r.detect_threshold(demod_samples)
barker_start = r.detect_preamble(demod_samples, thresh, one)
rcdbits = r.demap_and_check(demod_samples, barker_start)
# push into sink
sink = Sink()
rcd_payload = sink.process(rcdbits)
if len(rcd_payload) > 0:
hd, err = common_srcsink.hamming(rcd_payload, src_payload)
print 'Hamming distance for payload at frequency', fc,'Hz:', hd, 'BER:', err
else:
print 'Could not recover transmission.'
if opt.graph:
示例3: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import demodulate [as 別名]
channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
# transmit the samples, and retrieve samples back from the channel
try:
samples_rx = channel.xmit_and_recv(mod_samples)
except ZeroDivisionError:
# should only happen for audio channel
print "I didn't get any samples; is your microphone or speaker OFF?"
sys.exit(1)
#################################
# process the received samples
# make receiver
r = Receiver(fc, opt.samplerate, opt.spb)
#demod_samples = r.demodulate(samples_rx)
demod_samples = r.demodulate(mod_samples)
one, zero, thresh = r.detect_threshold(demod_samples)
barker_start = r.detect_preamble(demod_samples, thresh, one)
rcdbits = r.demap_and_check(demod_samples, barker_start)
# push into sink
sink = Sink()
rcd_payload = sink.process(rcdbits)
if len(rcd_payload) > 0:
hd, err = common_srcsink.hamming(rcd_payload, src_payload)
print 'Hamming distance for payload at frequency', fc,'Hz:', hd, 'BER:', err
else:
print 'Could not recover transmission.'
if opt.graph:
示例4: Receiver
# 需要導入模塊: from receiver import Receiver [as 別名]
# 或者: from receiver.Receiver import demodulate [as 別名]
else:
channel = ach.AudioChannel(opt.samplerate, opt.chunksize, opt.prefill)
# transmit the samples, and retrieve samples back from the channel
try:
samples_rx = channel.xmit_and_recv(mod_samples)
except ZeroDivisionError:
# should only happen for audio channel
print "I didn't get any samples; is your microphone or speaker OFF?"
sys.exit(1)
#################################
# process the received samples
# make receiver
r = Receiver(fc, opt.samplerate, opt.spb)
demod_samples = r.demodulate(samples_rx) #NEEDS TO BE SAMPLES_RX
one, zero, thresh = r.detect_threshold(demod_samples)
barker_start = r.detect_preamble(demod_samples, thresh, one)
rcdbits = r.demap_and_check(demod_samples, barker_start)
# push into sink
sink = Sink()
rcd_payload = sink.process(rcdbits)
if len(rcd_payload) > 0:
hd, err = common_srcsink.hamming(rcd_payload, src_payload)
print 'Hamming distance for payload at frequency', fc,'Hz:', hd, 'BER:', err
else:
print 'Could not recover transmission.'