On 11/02/2011 09:48 PM, Johnathan Corgan wrote:
On Wed, Nov 2, 2011 at 18:41, Marcus D. Leech <mle...@ripnet.com <mailto:mle...@ripnet.com>> wrote:

    Also, I wonder whether it has anything to do with the fact that
    it's a gr_sync_block, and not a gr_sync_decimator.  The FIR
    filters are all
      gr_sync_decimators, and perhaps the block executors treatment of
    them and their history setting is the main difference here.


I don't think it matters. Grepping the tree to find out what code pays attention to d_history member in the block class turns up...very little aside from the initial block construction sequence (creating buffers, etc.)

Johnathan
OK, so here's a new attemp, with dynamic selection of taps for the FIR filter. It also appears to not work. Only filter taps that exist on
  startup are working properly.  Gulp.



--
Marcus Leech
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org

Attachment: delay_test.grc
Description: application/gnuradio-grc

#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Delay Test
# Generated: Wed Nov  2 22:19:21 2011
##################################################

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.wxgui import forms
from gnuradio.wxgui import scopesink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx

class delay_test(grc_wxgui.top_block_gui):

	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Delay Test")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.taps4 = taps4 = [0.0,0.0,0.0,0.0,1.0]
		self.taps3 = taps3 = [0.0,0.0,0.0,1.0]
		self.taps2 = taps2 = [0.0,0.0,1.0]
		self.taps1 = taps1 = [0.0,1.0]
		self.taps0 = taps0 = [1.0]
		self.tapsarray = tapsarray = [taps0,taps1,taps2,taps3,taps4]
		self.delay = delay = 0
		self.taps = taps = tapsarray[delay]
		self.samp_rate = samp_rate = 200e3

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.gr_sig_source_x_0 = gr.sig_source_f(samp_rate, gr.GR_COS_WAVE, 25000, 1, 0)
		self.gr_fir_filter_xxx_0 = gr.fir_filter_fff(1, (taps))
		self._delay_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.delay,
			callback=self.set_delay,
			label="Delay",
			choices=[0, 1, 2, 3, 4],
			labels=[],
			style=wx.RA_HORIZONTAL,
		)
		self.Add(self._delay_chooser)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.wxgui_scopesink2_0, 1))
		self.connect((self.gr_throttle_0, 0), (self.gr_fir_filter_xxx_0, 0))
		self.connect((self.gr_fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0))

	def get_taps4(self):
		return self.taps4

	def set_taps4(self, taps4):
		self.taps4 = taps4
		self.set_tapsarray([self.taps0,self.taps1,self.taps2,self.taps3,self.taps4])

	def get_taps3(self):
		return self.taps3

	def set_taps3(self, taps3):
		self.taps3 = taps3
		self.set_tapsarray([self.taps0,self.taps1,self.taps2,self.taps3,self.taps4])

	def get_taps2(self):
		return self.taps2

	def set_taps2(self, taps2):
		self.taps2 = taps2
		self.set_tapsarray([self.taps0,self.taps1,self.taps2,self.taps3,self.taps4])

	def get_taps1(self):
		return self.taps1

	def set_taps1(self, taps1):
		self.taps1 = taps1
		self.set_tapsarray([self.taps0,self.taps1,self.taps2,self.taps3,self.taps4])

	def get_taps0(self):
		return self.taps0

	def set_taps0(self, taps0):
		self.taps0 = taps0
		self.set_tapsarray([self.taps0,self.taps1,self.taps2,self.taps3,self.taps4])

	def get_tapsarray(self):
		return self.tapsarray

	def set_tapsarray(self, tapsarray):
		self.tapsarray = tapsarray
		self.set_taps(self.tapsarray[self.delay])

	def get_delay(self):
		return self.delay

	def set_delay(self, delay):
		self.delay = delay
		self.set_taps(self.tapsarray[self.delay])
		self._delay_chooser.set_value(self.delay)

	def get_taps(self):
		return self.taps

	def set_taps(self, taps):
		self.taps = taps
		self.gr_fir_filter_xxx_0.set_taps((self.taps))

	def get_samp_rate(self):
		return self.samp_rate

	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate)
		self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)

if __name__ == '__main__':
	parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
	(options, args) = parser.parse_args()
	tb = delay_test()
	tb.Run(True)

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to