本文整理汇总了Python中receive_path.receive_path函数的典型用法代码示例。如果您正苦于以下问题:Python receive_path函数的具体用法?Python receive_path怎么用?Python receive_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了receive_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self._rx_freq = options.rx_freq # receiver's center frequency
self._rx_gain = options.rx_gain # receiver's gain
self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to use
self._decim = options.decim # Decimating rate for the USRP (prelim)
self._fusb_block_size = options.fusb_block_size # usb info for USRP
self._fusb_nblocks = options.fusb_nblocks # usb info for USRP
self._which = options.which # linklab, which USRP to use
if self._rx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
raise SystemExit
# Set up USRP source
self.u_src = uhd.usrp_source(
device_addr=options.args, stream_args=uhd.stream_args(cpu_format="fc32", channels=range(1))
)
print "Setting Rx Params. Fs=%e, Fc=%e, G=%f" % (self._bandwidth, self._rx_freq, self._rx_gain)
self.u_src.set_samp_rate(self._bandwidth)
self.u_src.set_center_freq(self._rx_freq)
self.u_src.set_gain(self._rx_gain)
# Set up receive path
self.rxpath = receive_path(callback, options)
self.connect(self.u_src, self.rxpath)
示例2: __init__
def __init__(self, demodulator, rx_callback, options):
gr.top_block.__init__(self)
if(options.rx_freq is not None):
# Work-around to get the modulation's bits_per_symbol
args = demodulator.extract_kwargs_from_options(options)
symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol()
self.source = uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol, options.rx_freq,
options.lo_offset, options.rx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
options.samples_per_symbol = self.source._sps
elif(options.from_file is not None):
sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file)))
self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
else:
sys.stderr.write("No source defined, pulling samples from null source.\n\n")
self.source = blocks.null_source(gr.sizeof_gr_complex)
# Set up receive path
# do this after for any adjustments to the options that may
# occur in the sinks (specifically the UHD sink)
self.rxpath = receive_path(demodulator, rx_callback, options)
self.connect(self.source, self.rxpath)
示例3: __init__
def __init__(self, demod_class, rx_callback, options):
gr.top_block.__init__(self)
self.rxpath = receive_path(demod_class, rx_callback, options)
self.audio_tx = audio_tx(options.audio_output)
if(options.rx_freq is not None):
self.source = uhd_receiver(options.args, options.bitrate,
options.samples_per_symbol,
options.rx_freq, options.rx_gain,
options.antenna, options.verbose)
options.samples_per_symbol = self.source._sps
audio_rate = self.audio_tx.sample_rate
usrp_rate = self.source.get_sample_rate()
rrate = audio_rate / usrp_rate
self.resampler = blks2.pfb_arb_resampler_ccf(rrate)
self.connect(self.source, self.resampler, self.rxpath)
elif(options.from_file is not None):
self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate)
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
self.connect(self.source, self.thr, self.rxpath)
else:
self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
self.source = gr.null_source(gr.sizeof_gr_complex)
self.connect(self.source, self.thr, self.rxpath)
self.connect(self.audio_tx)
示例4: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self._rx_freq = options.rx_freq # receiver's center frequency
self._rx_gain = options.rx_gain # receiver's gain
self._rx_subdev_spec = options.rx_subdev_spec # daughterboard to use
self._decim = options.decim # Decimating rate for the USRP (prelim)
self._fusb_block_size = options.fusb_block_size # usb info for USRP
self._fusb_nblocks = options.fusb_nblocks # usb info for USRP
if self._rx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
raise SystemExit
# Set up USRP source
self._setup_usrp_source()
ok = self.set_freq(self._rx_freq)
if not ok:
print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq))
raise ValueError, eng_notation.num_to_str(self._rx_freq)
g = self.subdev.gain_range()
if options.show_rx_gain_range:
print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
% (g[0], g[1], g[2])
self.set_gain(options.rx_gain)
self.set_auto_tr(True) # enable Auto Transmit/Receive switching
# Set up receive path
self.rxpath = receive_path(callback, options)
self.connect(self.u, self.rxpath)
示例5: __init__
def __init__(self, options):
gr.top_block.__init__(self, "rx_mpsk")
print "USRP decimation rate", options.decim_rate
# Create a USRP source at desired board, sample rate, frequency, and gain
self._setup_usrp(options.which,
options.decim_rate,
options.rx_subdev_spec,
options.freq,
options.gain)
# Create the BERT receiver
if_rate = self._usrp.adc_rate()/options.decim_rate
self._receiver = receive_path(if_rate,
options.rate,
options.excess_bw,
options.costas_alpha,
options.costas_beta,
options.costas_max,
options.mm_gain_mu,
options.mm_gain_omega,
options.mm_omega_limit)
self.connect(self._usrp, self._receiver)
示例6: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self._rx_freq = options.rx_freq # receiver's center frequency
self._rx_gain = options.rx_gain # receiver's gain
self._rate = options.rate # USRP sample rate
self._snr = options.snr
if self._rx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
raise SystemExit
# Set up USRP source
self._setup_usrp_source()
self.set_freq(self._rx_freq)
g = self.u.get_gain_range()
if options.show_rx_gain_range:
print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
% (g.start(), g.stop(), g.step())
self.set_gain(options.rx_gain)
if options.verbose:
self._print_verbage()
# Set up receive path
self.rxpath = receive_path(callback, options)
#self.file = gr.file_sink(gr.sizeof_gr_complex, "usrp_source.dat")
self.connect(self.u, self.rxpath)
示例7: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
#init receive
self._rx_freq = options.rx_freq
self._rx_gain = options.rx_gain
self._rx_subdev_spec = options.rx_subdev_spec
self._decim = options.decim
#init transmit
self._tx_freq = options.tx_freq
self._tx_subdev_spec = options.tx_subdev_spec
self._interp = options.interp
#init both
self._fusb_block_size = options.fusb_block_size
self._fusb_nblocks = options.fusb_nblocks
#check receive
if self._rx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
raise SystemExit
#check transmit
if self._tx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be specified\n")
raise SystemExit
#set up usrp source
self._setup_usrp_source()
#self._setup_usrp_sink()
self.rx_path = receive_path(callback, options)
self.connect(self.rx_u, self.rx_path)
示例8: __init__
def __init__(self,demodulator, rx_callback, options):
gr.top_block.__init__(self)
'''
Constructor for top block of Power Estimator
Creates the graph for calculating mean and variance
'''
if(options.rx_freq is not None):
# Work-around to get the modulation's bits_per_symbol
args = demodulator.extract_kwargs_from_options(options)
symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol()
########## Node 1 - USRP Source ##########
self.u= uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol, options.rx_freq,
options.lo_offset, options.rx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
#options.samples_per_symbol = self.source._sps
self.rxpath = receive_path(demodulator, rx_callback, options)
if options.type == 'Rx' or options.type=='Rx/S':
self.connect(self.u, self.rxpath)
########## Node 2 - Data Statistic Generator ##########
self.d = periodogram(options)
########## Connect - USRP to DS Generator ##########
if options.type=='Rx/S' or options.type=='S':
self.connect(self.u,self.d)
示例9: __init__
def __init__(self, mod_class, demod_class,
rx_callback, options):
gr.top_block.__init__(self)
# Get the modulation's bits_per_symbol
args = mod_class.extract_kwargs_from_options(options)
symbol_rate = options.bitrate / mod_class(**args).bits_per_symbol()
self.source = uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol,
options.rx_freq, options.rx_gain,
options.spec, options.antenna,
options.verbose)
self.sink = uhd_transmitter(options.args, symbol_rate,
options.samples_per_symbol,
options.tx_freq, options.tx_gain,
options.spec, options.antenna,
options.verbose)
options.samples_per_symbol = self.source._sps
self.txpath = transmit_path(mod_class, options)
self.rxpath = receive_path(demod_class, rx_callback, options)
self.connect(self.txpath, self.sink)
self.connect(self.source, self.rxpath)
示例10: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self.source = uhd_receiver(
options.args,
options.bandwidth,
options.rx_freq,
options.rx_gain,
options.spec,
options.antenna,
options.verbose,
)
self.sink = uhd_transmitter(
options.args,
options.bandwidth,
options.tx_freq,
options.tx_gain,
options.spec,
options.antenna,
options.verbose,
)
self.txpath = transmit_path(options)
self.rxpath = receive_path(callback, options)
self.connect(self.txpath, self.sink)
self.connect(self.source, self.rxpath)
示例11: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "bladerf=1" )
self.osmosdr_source_0.set_sample_rate(5e6)
self.osmosdr_source_0.set_center_freq(2.412e9, 0)
self.osmosdr_source_0.set_freq_corr(10, 0)
self.osmosdr_source_0.set_dc_offset_mode(1, 0)
self.osmosdr_source_0.set_iq_balance_mode(1, 0)
self.osmosdr_source_0.set_gain_mode(True, 0)
self.osmosdr_source_0.set_gain(20, 0)
self.osmosdr_source_0.set_if_gain(20, 0)
self.osmosdr_source_0.set_bb_gain(20, 0)
self.osmosdr_source_0.set_antenna("", 0)
self.osmosdr_source_0.set_bandwidth(5e6, 0)
if(options.from_file is not None):
self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file)
else:
self.source = blocks.null_source(gr.sizeof_gr_complex)
# Set up receive path
# do this after for any adjustments to the options that may
# occur in the sinks (specifically the UHD sink)
self.rxpath = receive_path(callback, options)
self.connect(self.osmosdr_source_0, self.rxpath)
示例12: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
### Rx Side ###
if(options.rx_freq is not None):
self.source = uhd_receiver(options.args_rx,
options.bandwidth,
options.rx_freq, options.rx_gain,
options.spec, options.antenna,
options.verbose)
elif(options.from_file is not None):
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
else:
self.source = gr.null_source(gr.sizeof_gr_complex)
# Set up receive path
# do this after for any adjustments to the options that may
# occur in the sinks (specifically the UHD sink)
self.rxpath = receive_path(callback, options)
## Tx Side ###
if(options.tx_freq is not None):
self.sink = uhd_transmitter(options.args_tx,
options.bandwidth,
options.tx_freq, options.tx_gain,
options.spec, options.antenna,
options.verbose)
elif(options.to_file is not None):
self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
else:
self.sink = gr.null_sink(gr.sizeof_gr_complex)
# do this after for any adjustments to the options that may
# occur in the sinks (specifically the UHD sink)
self.txpath = transmit_path(options)
self.connect(self.txpath, self.sink)
# self.txpath = gr.message_source(gr.sizeof_gr_complex, 3)
# nco_sensitivity = 2.0/options.fft_length # correct for fine frequency
# self.nco = ftw.pnc_frequency_modulator_fc(nco_sensitivity)
# self.connect(self.txpath, self.sink) # self.nco,
# if you use two USRPs and want to synchonized
# need to change uhd_interface.py
# self.source.config_mimo()
# time.sleep(1) # to make sync stable
if options.debug:
self.connect(self.source, gr.file_sink(gr.sizeof_gr_complex, 'rx.dat')) # Save reception signal
else:
self.connect(self.source, self.rxpath)
#self.connect(self.source, gr.file_sink(gr.sizeof_gr_complex, 'rx.dat'))
if(options.verbose):
self._print_verbage()
示例13: __init__
def __init__(self, mod_class, demod_class,
rx_callback, options):
gr.top_block.__init__(self)
self.txpath = transmit_path(mod_class, options)
self.rxpath = receive_path(demod_class, rx_callback, options)
self.connect(self.txpath);
self.connect(self.rxpath);
示例14: __init__
def __init__(self, callback, options):
gr.top_block.__init__(self)
self.source = uhd_receiver(options.args,
options.bandwidth, options.rx_freq,
options.lo_offset, options.rx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
self.rxpath = receive_path(callback, options)
self.connect(self.source, self.rxpath)
示例15: _setup_rx_path
def _setup_rx_path(self,options):
if options.tx_ant == 1:
if options.rx_ant == 1:
self.rxpath = receive_path(options)
#self._setup_rpc_manager()
#self.connect(self.source, self.rxpath)
else:
print "Two Rx antennas"
self.rxpath = receive_path_12(options)