本文整理汇总了Python中gnuradio.filter.fir_filter_ccf方法的典型用法代码示例。如果您正苦于以下问题:Python filter.fir_filter_ccf方法的具体用法?Python filter.fir_filter_ccf怎么用?Python filter.fir_filter_ccf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnuradio.filter
的用法示例。
在下文中一共展示了filter.fir_filter_ccf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gnuradio import filter [as 别名]
# 或者: from gnuradio.filter import fir_filter_ccf [as 别名]
def __init__(self):
gr.top_block.__init__(self, name="Doorbell Top Block")
# RF Config
self.threshold_min = -60
self.threshold_max = -50
self.samp_rate = samp_rate = 100e3
self.gain = gain = 30
self.freq = freq = 315e6
self.decimation = 10
# USRP
self.usrp = uhd.usrp_source("", uhd.stream_args("fc32"))
self.usrp.set_samp_rate(samp_rate)
self.usrp.set_center_freq(freq, 0)
self.usrp.set_gain(gain, 0)
self.usrp.set_antenna("TX/RX", 0)
# Low Pass Filter
self.lpf = filter.fir_filter_ccf(self.decimation,
firdes.low_pass(1, samp_rate, 50e3, 10e3, firdes.WIN_HAMMING, 6.76))
# Complex to Power (dB)
self._10log10 = blocks.nlog10_ff(10, 1, 0)
self.complex_to_mag_squared = blocks.complex_to_mag_squared(1)
# Threshold
self.threshold = blocks.threshold_ff(self.threshold_min, self.threshold_max, 0)
# Framer
self.framer = doorbell_framer()
# Connect the blocks
self.connect((self.usrp, 0), (self.lpf, 0))
self.connect((self.lpf, 0), (self.complex_to_mag_squared, 0))
self.connect((self.complex_to_mag_squared, 0), (self._10log10, 0))
self.connect((self._10log10, 0), (self.threshold, 0))
self.connect((self.threshold, 0), (self.framer, 0))
# Doorbell Framer
示例2: __init__
# 需要导入模块: from gnuradio import filter [as 别名]
# 或者: from gnuradio.filter import fir_filter_ccf [as 别名]
def __init__(self):
gr.top_block.__init__(self, "Top Block")
##################################################
# Variables
##################################################
self.trans_width = trans_width = 10e3
self.samp_rate = samp_rate = 1e6
self.mult_const = mult_const = 100
self.lowpass_decimation = lowpass_decimation = 10
self.freq = freq = 344940000
self.cutoff_freq = cutoff_freq = 50e3
##################################################
# Blocks
##################################################
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
self.osmosdr_source_0.set_sample_rate(samp_rate)
self.osmosdr_source_0.set_center_freq(freq, 0)
self.osmosdr_source_0.set_freq_corr(0, 0)
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
self.osmosdr_source_0.set_gain_mode(True, 0)
self.osmosdr_source_0.set_gain(0, 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(0, 0)
self.low_pass_filter_0 = filter.fir_filter_ccf(lowpass_decimation, firdes.low_pass(
1, samp_rate, cutoff_freq, trans_width, firdes.WIN_HAMMING, 6.76))
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((mult_const, ))
self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_char*1, '/tmp/grcfifo', False)
self.blocks_file_sink_1.set_unbuffered(False)
self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
##################################################
# Connections
##################################################
self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_0, 0))
self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_1, 0))
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_uchar_0, 0))
self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))
self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
示例3: rebuild_filters
# 需要导入模块: from gnuradio import filter [as 别名]
# 或者: from gnuradio.filter import fir_filter_ccf [as 别名]
def rebuild_filters(self,config,value = None):
if self.cw_base == None:
return
if value == None:
value = config['bw_mode']
am_bw = (8000,3000,2000)[value]
fm_bw = (8000,6000,4000)[value]
wfm_bw = (60e3,40e3,20e3)[value]
ssb_bw = (5000,2400,1800)[value]
cw_bw = (self.cw_base*2/3,self.cw_base/2,self.cw_base/3)[value]
am_taps = firdes.low_pass(
1, self.audio_rate, am_bw, 500, firdes.WIN_HAMMING, 6.76)
fm_taps = firdes.low_pass(
1, self.audio_rate, fm_bw, 500, firdes.WIN_HAMMING, 6.76)
wfm_taps = firdes.low_pass(
1, self.if_sample_rate, wfm_bw, 4e3, firdes.WIN_HAMMING, 6.76)
ssb_taps = firdes.low_pass(
1, self.audio_rate, ssb_bw, 100, firdes.WIN_HAMMING, 6.76)
#print("CW Base: %d - %d - %d" % (self.cw_base-cw_bw,self.cw_base + cw_bw,self.audio_rate))
cw_taps = firdes.band_pass(
1, self.audio_rate, self.cw_base-cw_bw,self.cw_base+cw_bw, 100, firdes.WIN_HAMMING, 6.76)
if self.low_pass_filter_am == None:
self.low_pass_filter_am = filter.fir_filter_ccf(1, am_taps)
else:
self.low_pass_filter_am.set_taps(am_taps)
if self.low_pass_filter_fm == None:
self.low_pass_filter_fm = filter.fir_filter_ccf(1, fm_taps)
else:
self.low_pass_filter_fm.set_taps(fm_taps)
if self.low_pass_filter_wfm == None:
self.low_pass_filter_wfm = filter.fir_filter_ccf(1, wfm_taps)
else:
self.low_pass_filter_wfm.set_taps(wfm_taps)
if self.low_pass_filter_ssb == None:
self.low_pass_filter_ssb = filter.fir_filter_fff(1, ssb_taps)
else:
self.low_pass_filter_ssb.set_taps(ssb_taps)
if self.band_pass_filter_cw == None:
self.band_pass_filter_cw = filter.fir_filter_fff(1, cw_taps)
else:
self.band_pass_filter_cw.set_taps(cw_taps)
# calculate gcd using Euclid's algorithm