Example #1
0
    def __init__(self, parent, title='', sample_rate=1):
        num_inputs = 3
	gr.hier_block2.__init__(
            self,
            "scope_sink",
            gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
            gr.io_signature(0, 0, 0),
	)
        msgq = gr.msg_queue(2)
        scope = wxgui.oscope_sink_f(sample_rate, msgq)
	self.controller = pubsub()
	self.controller.subscribe(SAMPLE_RATE_KEY, scope.set_sample_rate)
	self.controller.publish(SAMPLE_RATE_KEY, scope.sample_rate)
	self.controller.subscribe(DECIMATION_KEY, scope.set_decimation_count)
	self.controller.publish(DECIMATION_KEY, scope.get_decimation_count)
	self.controller.subscribe(TRIGGER_LEVEL_KEY, scope.set_trigger_level)
	self.controller.publish(TRIGGER_LEVEL_KEY, scope.get_trigger_level)
	self.controller.subscribe(TRIGGER_MODE_KEY, scope.set_trigger_mode)
	self.controller.publish(TRIGGER_MODE_KEY, scope.get_trigger_mode)
	self.controller.subscribe(TRIGGER_SLOPE_KEY, scope.set_trigger_slope)
	self.controller.publish(TRIGGER_SLOPE_KEY, scope.get_trigger_slope)
	self.controller.subscribe(TRIGGER_CHANNEL_KEY, scope.set_trigger_channel)
	self.controller.publish(TRIGGER_CHANNEL_KEY, scope.get_trigger_channel)
	for i in range(num_inputs):
		self.controller[common.index_key(AC_COUPLE_KEY, i)] = False
	common.input_watcher(msgq, self.controller, MSG_KEY)
	#create window
	self.win = my_scope_window(
		parent=parent,
		controller=self.controller,
		size=(600, 300),
		title=title,
		frame_rate=60, #scope_window.DEFAULT_FRAME_RATE,
		num_inputs=num_inputs,
		sample_rate_key=SAMPLE_RATE_KEY,
		t_scale=0.1,
		v_scale=1,
		v_offset=0,
		xy_mode=False,
		trig_mode=wxgui.TRIG_MODE_FREE,
		y_axis_label='Counts',
		ac_couple_key=AC_COUPLE_KEY,
		trigger_level_key=TRIGGER_LEVEL_KEY,
		trigger_mode_key=TRIGGER_MODE_KEY,
		trigger_slope_key=TRIGGER_SLOPE_KEY,
		trigger_channel_key=TRIGGER_CHANNEL_KEY,
		decimation_key=DECIMATION_KEY,
		msg_key=MSG_KEY,
                use_persistence=True,
                persist_alpha=0.001,
	)
	common.register_access_methods(self, self.win)
	for i in range(num_inputs):
		self.wxgui_connect(
			(self, i),
			ac_couple_block(self.controller, common.index_key(AC_COUPLE_KEY, i), SAMPLE_RATE_KEY),
			(scope, i),
		)
Example #2
0
	def __init__(
		self,
		parent,
		unit='%',
		minval=0,
		maxval=100,
		decimal_places=5,
		sample_rate=1,
		number_rate=DEFAULT_NUMBER_RATE,
		label='Bit Error Rate',
		size=DEFAULT_WIN_SIZE,
		show_gauge=True,
		**kwargs #catchall for backwards compatibility
	):
		gr.hier_block2.__init__(
			self,
			"number_sink",
			gr.io_signature(1, 1, self._item_size),
			gr.io_signature(0, 0, 0),
		)
		#blocks
		sd = blks2.stream_to_vector_decimator(
			item_size=self._item_size,
			sample_rate=sample_rate,
			vec_rate=number_rate,
			vec_len=1,
		)
		mult = gr.multiply_const_ff(100)
		add = gr.add_const_ff(1e-10)
		msgq = gr.msg_queue(2)
		sink = gr.message_sink(self._item_size, msgq, True)
		#connect
		self.connect(self, sd, mult, add, sink)
		#controller
		self.controller = pubsub()
		#start input watcher
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = number_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=label,
			units=unit,
			real=self._real,
			minval=minval,
			maxval=maxval,
			decimal_places=decimal_places,
			show_gauge=show_gauge,
			msg_key=MSG_KEY,
			sample_rate_key=SAMPLE_RATE_KEY)
Example #3
0
 def __init__(
         self,
         parent,
         unit='%',
         minval=0,
         maxval=100,
         decimal_places=5,
         sample_rate=1,
         number_rate=DEFAULT_NUMBER_RATE,
         label='Bit Error Rate',
         size=DEFAULT_WIN_SIZE,
         show_gauge=True,
         **kwargs  #catchall for backwards compatibility
 ):
     gr.hier_block2.__init__(
         self,
         "number_sink",
         gr.io_signature(1, 1, self._item_size),
         gr.io_signature(0, 0, 0),
     )
     #blocks
     sd = blks2.stream_to_vector_decimator(
         item_size=self._item_size,
         sample_rate=sample_rate,
         vec_rate=number_rate,
         vec_len=1,
     )
     mult = gr.multiply_const_ff(100)
     add = gr.add_const_ff(1e-10)
     msgq = gr.msg_queue(2)
     sink = gr.message_sink(self._item_size, msgq, True)
     #connect
     self.connect(self, sd, mult, add, sink)
     #controller
     self.controller = pubsub()
     #start input watcher
     common.input_watcher(msgq, self.controller, MSG_KEY)
     #create window
     self.win = number_window(parent=parent,
                              controller=self.controller,
                              size=size,
                              title=label,
                              units=unit,
                              real=self._real,
                              minval=minval,
                              maxval=maxval,
                              decimal_places=decimal_places,
                              show_gauge=show_gauge,
                              msg_key=MSG_KEY,
                              sample_rate_key=SAMPLE_RATE_KEY)
Example #4
0
	def __init__(
		self,
		parent,
		title='',
		sample_rate=1,
		size=(495,450),
		frame_rate=5,
		const_size=1024,
		mod='DBPSK'):
		#init
		gr.hier_block2.__init__(
			self,
			"const_sink",
			gr.io_signature(1, 1, gr.sizeof_gr_complex),
			gr.io_signature(0, 0, 0),
		)
		self.sd = blks2.stream_to_vector_decimator(
			item_size=gr.sizeof_gr_complex,
			sample_rate=sample_rate,
			vec_rate=frame_rate,
			vec_len=const_size,
		)
		self. agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
		self.gain= gr.multiply_const_cc(utils.gain[mod])
		msgq = gr.msg_queue(2)
		sink = gr.message_sink(gr.sizeof_gr_complex*const_size, msgq, True)
		#connect
		self.connect(self, self.agc, self.gain, self.sd, sink)
		
		#controller
		def setter(p, k, x): p[k] = x
		
		self.controller = pubsub()
		#initial update
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = const_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=title,
			msg_key=MSG_KEY
		)
		common.register_access_methods(self, self.win)
Example #5
0
    def __init__(self,
                 parent,
                 title='',
                 sample_rate=1,
                 size=(495, 450),
                 frame_rate=5,
                 const_size=1024,
                 mod='DBPSK'):
        #init
        gr.hier_block2.__init__(
            self,
            "const_sink",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(0, 0, 0),
        )
        self.sd = blks2.stream_to_vector_decimator(
            item_size=gr.sizeof_gr_complex,
            sample_rate=sample_rate,
            vec_rate=frame_rate,
            vec_len=const_size,
        )
        self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
        self.gain = gr.multiply_const_cc(utils.gain[mod])
        msgq = gr.msg_queue(2)
        sink = gr.message_sink(gr.sizeof_gr_complex * const_size, msgq, True)
        #connect
        self.connect(self, self.agc, self.gain, self.sd, sink)

        #controller
        def setter(p, k, x):
            p[k] = x

        self.controller = pubsub()
        #initial update
        common.input_watcher(msgq, self.controller, MSG_KEY)
        #create window
        self.win = const_window(parent=parent,
                                controller=self.controller,
                                size=size,
                                title=title,
                                msg_key=MSG_KEY)
        common.register_access_methods(self, self.win)
Example #6
0
	def __init__(
		self,
		parent,
		baseband_freq=0,
		ref_scale=2.0,
		y_per_div=10,
		y_divs=8,
		ref_level=50,
		sample_rate=1,
		pspectrum_len=512,
		specest_rate=specest_window.DEFAULT_FRAME_RATE,
		average=False,
		avg_alpha=None,
		title='',
		size=specest_window.DEFAULT_WIN_SIZE,
		peak_hold=False,
        use_persistence=False,
        persist_alpha=None,
        n = 1,
        m = 150,
        nsamples = 256,
        estimator = 'esprit',
		**kwargs #do not end with a comma
	):
		#ensure avg alpha
		if avg_alpha is None: avg_alpha = 2.0/specest_rate
                #ensure analog alpha
                if persist_alpha is None: 
                  actual_specest_rate=float(sample_rate/pspectrum_len)/float(max(1,int(float((sample_rate/pspectrum_len)/specest_rate))))
                  #print "requested_specest_rate ",specest_rate
                  #print "actual_specest_rate    ",actual_specest_rate
                  analog_cutoff_freq=0.5 # Hertz
                  #calculate alpha from wanted cutoff freq
                  persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_specest_rate)
                  
		#init
		gr.hier_block2.__init__(
			self,
			"spectrum_sink",
			gr.io_signature(1, 1, self._item_size),
			gr.io_signature(0, 0, 0),
		)
		#blocks
		fft = self._specest_chain(
			sample_rate=sample_rate,
			pspectrum_len=pspectrum_len,
			frame_rate=specest_rate,
			ref_scale=ref_scale,
			avg_alpha=avg_alpha,
			average=average,
            n = n,
            m = m,
            nsamples = nsamples,
            estimator = estimator
		)
		msgq = gr.msg_queue(2)
		sink = gr.message_sink(gr.sizeof_float*pspectrum_len, msgq, True)

		#controller
		self.controller = pubsub()
		self.controller.subscribe(AVERAGE_KEY, fft.set_average)
		self.controller.publish(AVERAGE_KEY, fft.average)
		self.controller.subscribe(AVG_ALPHA_KEY, fft.set_avg_alpha)
		self.controller.publish(AVG_ALPHA_KEY, fft.avg_alpha)
		self.controller.subscribe(SAMPLE_RATE_KEY, fft.set_sample_rate)
		self.controller.publish(SAMPLE_RATE_KEY, fft.sample_rate)
		#start input watcher
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = specest_window.specest_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=title,
			real=self._real,
			spectrum_len=pspectrum_len,
			baseband_freq=baseband_freq,
			sample_rate_key=SAMPLE_RATE_KEY,
			y_per_div=y_per_div,
			y_divs=y_divs,
			ref_level=ref_level,
			average_key=AVERAGE_KEY,
			avg_alpha_key=AVG_ALPHA_KEY,
			peak_hold=peak_hold,
			msg_key=MSG_KEY,
            use_persistence=use_persistence,
            persist_alpha=persist_alpha,
		)
		common.register_access_methods(self, self.win)
		setattr(self.win, 'set_baseband_freq', getattr(self, 'set_baseband_freq')) #BACKWARDS
		setattr(self.win, 'set_peak_hold', getattr(self, 'set_peak_hold')) #BACKWARDS
		#connect
		self.wxgui_connect(self, fft, sink)
Example #7
0
	def __init__(
		self,
		parent,
		ref_scale=2.0,
		y_per_div=10,
		y_divs=8,
		ref_level=50,
		sample_rate=1,
		data_len=1024,
		update_rate=plot_window.DEFAULT_FRAME_RATE,
		average=False,
		avg_alpha=None,
		title='',
		size=plot_window.DEFAULT_WIN_SIZE,
		peak_hold=False,
		use_persistence=False,
		persist_alpha=None,
		**kwargs #do not end with a comma
	):
		#ensure avg alpha
		if avg_alpha is None:
			avg_alpha = 2.0/update_rate
		#ensure analog alpha
		if persist_alpha is None:
			actual_update_rate=float(sample_rate/data_len)/float(max(1,int(float((sample_rate/data_len)/update_rate))))
			#print "requested_specest_rate ",update_rate
			#print "actual_update_rate    ",actual_update_rate
			analog_cutoff_freq=0.5 # Hertz
			#calculate alpha from wanted cutoff freq
			persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_update_rate)
		
		self._average = average
		self._avg_alpha = avg_alpha
		self._sample_rate = sample_rate
		
		#init
		gr.hier_block2.__init__(
			self,
			"plot_sink",
			gr.io_signature(1, 1, gr.sizeof_float*data_len),
			gr.io_signature(0, 0, 0),
		)
		#blocks
		msgq = gr.msg_queue(2)
		sink = gr.message_sink(gr.sizeof_float*data_len, msgq, True)
		
		#controller
		self.controller = pubsub()
		self.controller.subscribe(AVERAGE_KEY, self.set_average)
		self.controller.publish(AVERAGE_KEY, self.average)
		self.controller.subscribe(AVG_ALPHA_KEY, self.set_avg_alpha)
		self.controller.publish(AVG_ALPHA_KEY, self.avg_alpha)
		self.controller.subscribe(SAMPLE_RATE_KEY, self.set_sample_rate)
		self.controller.publish(SAMPLE_RATE_KEY, self.sample_rate)
		#start input watcher
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = plot_window.plot_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=title,
			data_len=data_len,
			sample_rate_key=SAMPLE_RATE_KEY,
			y_per_div=y_per_div,
			y_divs=y_divs,
			ref_level=ref_level,
			average_key=AVERAGE_KEY,
			avg_alpha_key=AVG_ALPHA_KEY,
			peak_hold=peak_hold,
			msg_key=MSG_KEY,
			use_persistence=use_persistence,
			persist_alpha=persist_alpha,
		)
		common.register_access_methods(self, self.win)
		setattr(self.win, 'set_peak_hold', getattr(self, 'set_peak_hold')) #BACKWARDS
		self.wxgui_connect(self, sink)
Example #8
0
    def __init__(self,
        parent,
        minval=0,
        maxval=1,
        sample_rate=1,
        graphing_rate=1,
        size=antdiag_window.DEFAULT_WIN_SIZE,
        peak_hold=False,
        serial_port='/dev/ttyUSB0',
        rotation_speed=60,
        **kwargs #catchall for backwards compatibility
        ):
            #init
        self._item_size=gr.sizeof_float
        gr.hier_block2.__init__(
            self,
            "antenna_diagram",
            gr.io_signature(1, 1, self._item_size),
            gr.io_signature(0, 0, 0),
        )
        #blocks
        sd = blocks.stream_to_vector_decimator(
            item_size=gr.sizeof_float,
            sample_rate=sample_rate,
            vec_rate=graphing_rate,
            vec_len=1,
        )

        #mult = blocks.multiply_const_ff(factor)
        #add = blocks.add_const_ff(ref_level)
        #avg = filter.single_pole_iir_filter_ff(1.0)

        msgq = gr.msg_queue(2)
        sink = blocks.message_sink(self._item_size, msgq, True)
        #controller
        self.controller = pubsub()
        self.controller.subscribe(SAMPLE_RATE_KEY, sd.set_sample_rate)
        self.controller.publish(SAMPLE_RATE_KEY, sd.sample_rate)
        self.controller[antdiag_window.SERIAL_PORT_KEY] = serial_port
        #self.controller[AVERAGE_KEY] = False
        #self.controller[AVG_ALPHA_KEY] = None
        #def update_avg(*args):
        #   if self.controller[AVERAGE_KEY]: avg.set_taps(self.controller[AVG_ALPHA_KEY])
        #   else: avg.set_taps(1.0)
        #update_avg()
        #self.controller.subscribe(AVERAGE_KEY, update_avg)
        #self.controller.subscribe(AVG_ALPHA_KEY, update_avg)

        #start input watcher
        common.input_watcher(msgq, self.controller, MSG_KEY)
        #create window
        self.win = antdiag_window.antdiag_window(
            parent=parent,
            controller=self.controller,
            size=size,
            minval=minval,
            maxval=maxval,
            peak_hold=peak_hold,
            msg_key=MSG_KEY,
            graphing_rate=graphing_rate,
            rotation_speed=rotation_speed
        )
        common.register_access_methods(self, self.controller)
        #backwards compadibility
        self.set_show_gauge = self.win.show_gauges
        #connect

        #self.wxgui_connect(self, sd, mult, add, avg, sink)
        self.wxgui_connect(self, sd, sink)
Example #9
0
	def __init__(
		self,
		parent,
		x_offset=0,
		ref_level=50,
		#sample_rate=1,
		data_len=512*2,
		#fft_rate=waterfall_window.DEFAULT_FRAME_RATE,
		#average=False,
		#avg_alpha=None,
		title='',
		size=waterfall_window.DEFAULT_WIN_SIZE,
		ref_scale=2.0,
		dynamic_range=80,
		num_lines=256,
		win=None,
		always_run=False,
		**kwargs #do not end with a comma
	):
		#ensure avg alpha
		#if avg_alpha is None: avg_alpha = 2.0/fft_rate
		#init
		gr.hier_block2.__init__(
			self,
			"waterfall_sink",
			gr.io_signature(1, 1, gr.sizeof_float * data_len),
			gr.io_signature(0, 0, 0),
		)
		#blocks
		msgq = gr.msg_queue(2)
		sink = blocks.message_sink(gr.sizeof_float*data_len, msgq, True)
		#controller
		self.controller = pubsub()
		#start input watcher
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = waterfall_window.waterfall_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=title,
			data_len=data_len,
			num_lines=num_lines,
			x_offset=x_offset,
			#decimation_key=DECIMATION_KEY,
			#sample_rate_key=SAMPLE_RATE_KEY,
			#frame_rate_key=FRAME_RATE_KEY,
			dynamic_range=dynamic_range,
			ref_level=ref_level,
			#average_key=AVERAGE_KEY,
			#avg_alpha_key=AVG_ALPHA_KEY,
			msg_key=MSG_KEY,
		)
		common.register_access_methods(self, self.win)
		setattr(self.win, 'set_baseband_freq', getattr(self, 'set_baseband_freq')) #BACKWARDS	# FIXME
		#connect
		if always_run:
			connect_fn = self.connect
		else:
			connect_fn = self.wxgui_connect
		
		connect_fn(self, sink)
Example #10
0
    def __init__(
            self,
            parent,
            ref_scale=2.0,
            y_per_div=10,
            y_divs=8,
            ref_level=50,
            sample_rate=1,
            data_len=1024,
            update_rate=plot_window.DEFAULT_FRAME_RATE,
            average=False,
            avg_alpha=None,
            title='',
            size=plot_window.DEFAULT_WIN_SIZE,
            peak_hold=False,
            use_persistence=False,
            persist_alpha=None,
            **kwargs  #do not end with a comma
    ):
        #ensure avg alpha
        if avg_alpha is None:
            avg_alpha = 2.0 / update_rate
        #ensure analog alpha
        if persist_alpha is None:
            actual_update_rate = float(sample_rate / data_len) / float(
                max(1, int(float((sample_rate / data_len) / update_rate))))
            #print "requested_specest_rate ",update_rate
            #print "actual_update_rate    ",actual_update_rate
            analog_cutoff_freq = 0.5  # Hertz
            #calculate alpha from wanted cutoff freq
            persist_alpha = 1.0 - math.exp(
                -2.0 * math.pi * analog_cutoff_freq / actual_update_rate)

        self._average = average
        self._avg_alpha = avg_alpha
        self._sample_rate = sample_rate

        #init
        gr.hier_block2.__init__(
            self,
            "plot_sink",
            gr.io_signature(1, 1, gr.sizeof_float * data_len),
            gr.io_signature(0, 0, 0),
        )
        #blocks
        msgq = gr.msg_queue(2)
        sink = blocks.message_sink(gr.sizeof_float * data_len, msgq, True)

        #controller
        self.controller = pubsub()
        self.controller.subscribe(AVERAGE_KEY, self.set_average)
        self.controller.publish(AVERAGE_KEY, self.average)
        self.controller.subscribe(AVG_ALPHA_KEY, self.set_avg_alpha)
        self.controller.publish(AVG_ALPHA_KEY, self.avg_alpha)
        self.controller.subscribe(SAMPLE_RATE_KEY, self.set_sample_rate)
        self.controller.publish(SAMPLE_RATE_KEY, self.sample_rate)
        #start input watcher
        common.input_watcher(msgq, self.controller, MSG_KEY)
        #create window
        self.win = plot_window.plot_window(
            parent=parent,
            controller=self.controller,
            size=size,
            title=title,
            data_len=data_len,
            sample_rate_key=SAMPLE_RATE_KEY,
            y_per_div=y_per_div,
            y_divs=y_divs,
            ref_level=ref_level,
            average_key=AVERAGE_KEY,
            avg_alpha_key=AVG_ALPHA_KEY,
            peak_hold=peak_hold,
            msg_key=MSG_KEY,
            use_persistence=use_persistence,
            persist_alpha=persist_alpha,
        )
        common.register_access_methods(self, self.win)
        setattr(self.win, 'set_peak_hold',
                getattr(self, 'set_peak_hold'))  #BACKWARDS
        self.wxgui_connect(self, sink)
Example #11
0
 def __init__(self, parent, title='', sample_rate=1):
     num_inputs = 3
     gr.hier_block2.__init__(
         self,
         "scope_sink",
         gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
         gr.io_signature(0, 0, 0),
     )
     msgq = gr.msg_queue(2)
     scope = wxgui.oscope_sink_f(sample_rate, msgq)
     self.controller = pubsub()
     self.controller.subscribe(SAMPLE_RATE_KEY, scope.set_sample_rate)
     self.controller.publish(SAMPLE_RATE_KEY, scope.sample_rate)
     self.controller.subscribe(DECIMATION_KEY, scope.set_decimation_count)
     self.controller.publish(DECIMATION_KEY, scope.get_decimation_count)
     self.controller.subscribe(TRIGGER_LEVEL_KEY, scope.set_trigger_level)
     self.controller.publish(TRIGGER_LEVEL_KEY, scope.get_trigger_level)
     self.controller.subscribe(TRIGGER_MODE_KEY, scope.set_trigger_mode)
     self.controller.publish(TRIGGER_MODE_KEY, scope.get_trigger_mode)
     self.controller.subscribe(TRIGGER_SLOPE_KEY, scope.set_trigger_slope)
     self.controller.publish(TRIGGER_SLOPE_KEY, scope.get_trigger_slope)
     self.controller.subscribe(TRIGGER_CHANNEL_KEY,
                               scope.set_trigger_channel)
     self.controller.publish(TRIGGER_CHANNEL_KEY, scope.get_trigger_channel)
     for i in range(num_inputs):
         self.controller[common.index_key(AC_COUPLE_KEY, i)] = False
     common.input_watcher(msgq, self.controller, MSG_KEY)
     #create window
     self.win = my_scope_window(
         parent=parent,
         controller=self.controller,
         size=(600, 300),
         title=title,
         frame_rate=60,  #scope_window.DEFAULT_FRAME_RATE,
         num_inputs=num_inputs,
         sample_rate_key=SAMPLE_RATE_KEY,
         t_scale=0.1,
         v_scale=1,
         v_offset=0,
         xy_mode=False,
         trig_mode=wxgui.TRIG_MODE_FREE,
         y_axis_label='Counts',
         ac_couple_key=AC_COUPLE_KEY,
         trigger_level_key=TRIGGER_LEVEL_KEY,
         trigger_mode_key=TRIGGER_MODE_KEY,
         trigger_slope_key=TRIGGER_SLOPE_KEY,
         trigger_channel_key=TRIGGER_CHANNEL_KEY,
         decimation_key=DECIMATION_KEY,
         msg_key=MSG_KEY,
         use_persistence=True,
         persist_alpha=0.001,
     )
     common.register_access_methods(self, self.win)
     for i in range(num_inputs):
         self.wxgui_connect(
             (self, i),
             ac_couple_block(self.controller,
                             common.index_key(AC_COUPLE_KEY, i),
                             SAMPLE_RATE_KEY),
             (scope, i),
         )
Example #12
0
    def __init__(
            self,
            parent,
            x_offset=0,
            ref_level=50,
            #sample_rate=1,
            data_len=512 * 2,
            #fft_rate=waterfall_window.DEFAULT_FRAME_RATE,
            #average=False,
            #avg_alpha=None,
            title='',
            size=waterfall_window.DEFAULT_WIN_SIZE,
            ref_scale=2.0,
            dynamic_range=80,
            num_lines=256,
            win=None,
            always_run=False,
            **kwargs  #do not end with a comma
    ):
        #ensure avg alpha
        #if avg_alpha is None: avg_alpha = 2.0/fft_rate
        #init
        gr.hier_block2.__init__(
            self,
            "waterfall_sink",
            gr.io_signature(1, 1, gr.sizeof_float * data_len),
            gr.io_signature(0, 0, 0),
        )
        #blocks
        msgq = gr.msg_queue(2)
        sink = blocks.message_sink(gr.sizeof_float * data_len, msgq, True)
        #controller
        self.controller = pubsub()
        #start input watcher
        common.input_watcher(msgq, self.controller, MSG_KEY)
        #create window
        self.win = waterfall_window.waterfall_window(
            parent=parent,
            controller=self.controller,
            size=size,
            title=title,
            data_len=data_len,
            num_lines=num_lines,
            x_offset=x_offset,
            #decimation_key=DECIMATION_KEY,
            #sample_rate_key=SAMPLE_RATE_KEY,
            #frame_rate_key=FRAME_RATE_KEY,
            dynamic_range=dynamic_range,
            ref_level=ref_level,
            #average_key=AVERAGE_KEY,
            #avg_alpha_key=AVG_ALPHA_KEY,
            msg_key=MSG_KEY,
        )
        common.register_access_methods(self, self.win)
        setattr(self.win, 'set_baseband_freq',
                getattr(self, 'set_baseband_freq'))  #BACKWARDS	# FIXME
        #connect
        if always_run:
            connect_fn = self.connect
        else:
            connect_fn = self.wxgui_connect

        connect_fn(self, sink)