def __init__(self,
                 parent,
                 title='',
                 sample_rate=1,
                 size=default_scopesink_size,
                 frame_decim=default_frame_decim,
                 v_scale=default_v_scale,
                 t_scale=None,
                 num_inputs=1,
                 xy_mode=False,
                 **kwargs):

        gr.hier_block2.__init__(
            self, "scope_sink_c",
            gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
            gr.io_signature(0, 0, 0))

        msgq = gr.msg_queue(2)  # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
            c2f = blocks.complex_to_float()
            self.connect((self, i), c2f)
            self.connect((c2f, 0), (self.guts, 2 * i + 0))
            self.connect((c2f, 1), (self.guts, 2 * i + 1))

        self.win = scope_window(
            win_info(msgq, sample_rate, frame_decim, v_scale, t_scale,
                     self.guts, title), parent)
        self.win.info.xy = xy_mode
Beispiel #2
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),
		)
Beispiel #3
0
    def __init__(self, parent, title='', sample_rate=1,
                 size=default_scopesink_size, frame_decim=default_frame_decim,
                 v_scale=default_v_scale, t_scale=None, num_inputs=1, **kwargs):

        gr.hier_block2.__init__(self, "scope_sink_f",
                                gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
                                gr.io_signature(0,0,0))

        msgq = gr.msg_queue(2)         # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
          self.connect((self, i), (self.guts, i))

        self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
                                          v_scale, t_scale, self.guts, title), parent)
Beispiel #4
0
    def __init__(self, parent, title='', sample_rate=1,
                 size=default_scopesink_size, frame_decim=default_frame_decim,
                 v_scale=default_v_scale, t_scale=None, num_inputs=1, xy_mode=False, **kwargs):

        gr.hier_block2.__init__(self, "scope_sink_c",
                                gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0))

        msgq = gr.msg_queue(2)         # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
	        c2f = blocks.complex_to_float()
	        self.connect((self, i), c2f)
	        self.connect((c2f, 0),(self.guts, 2*i+0))
	        self.connect((c2f, 1),(self.guts, 2*i+1))

        self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
                                         v_scale, t_scale, self.guts, title), parent)
        self.win.info.xy = xy_mode
    def __init__(self,
                 parent,
                 title='',
                 sample_rate=1,
                 size=default_scopesink_size,
                 frame_decim=default_frame_decim,
                 v_scale=default_v_scale,
                 t_scale=None,
                 num_inputs=1,
                 **kwargs):

        gr.hier_block2.__init__(
            self, "scope_sink_f",
            gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
            gr.io_signature(0, 0, 0))

        msgq = gr.msg_queue(2)  # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
            self.connect((self, i), (self.guts, i))

        self.win = scope_window(
            win_info(msgq, sample_rate, frame_decim, v_scale, t_scale,
                     self.guts, title), parent)
Beispiel #6
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),
         )
Beispiel #7
0
    def __init__(
            self,
            parent,
            title='',
            sample_rate=1,
            size=scope_window.DEFAULT_WIN_SIZE,
            v_scale=0,
            t_scale=0,
            v_offset=0,
            xy_mode=False,
            ac_couple=False,
            num_inputs=1,
            trig_mode=scope_window.DEFAULT_TRIG_MODE,
            y_axis_label='Counts',
            frame_rate=scope_window.DEFAULT_FRAME_RATE,
            use_persistence=False,
            persist_alpha=None,
            **kwargs  #do not end with a comma
    ):
        #ensure analog alpha
        if persist_alpha is None:
            actual_frame_rate = float(frame_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_frame_rate)

        if not t_scale: t_scale = 10.0 / sample_rate
        #init
        gr.hier_block2.__init__(
            self,
            "scope_sink",
            gr.io_signature(num_inputs, num_inputs, self._item_size),
            gr.io_signature(0, 0, 0),
        )
        #scope
        msgq = gr.msg_queue(2)
        scope = wxgui.oscope_sink_f(sample_rate, msgq)
        #controller
        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)
        actual_num_inputs = self._real and num_inputs or num_inputs * 2
        #init ac couple
        for i in range(actual_num_inputs):
            self.controller[common.index_key(AC_COUPLE_KEY, i)] = ac_couple

    #start input watcher
        common.input_watcher(msgq, self.controller, MSG_KEY)
        #create window
        self.win = scope_window.scope_window(
            parent=parent,
            controller=self.controller,
            size=size,
            title=title,
            frame_rate=frame_rate,
            num_inputs=actual_num_inputs,
            sample_rate_key=SAMPLE_RATE_KEY,
            t_scale=t_scale,
            v_scale=v_scale,
            v_offset=v_offset,
            xy_mode=xy_mode,
            trig_mode=trig_mode,
            y_axis_label=y_axis_label,
            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=use_persistence,
            persist_alpha=persist_alpha,
        )
        common.register_access_methods(self, self.win)
        #connect
        if self._real:
            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),
                )
        else:
            for i in range(num_inputs):
                c2f = blocks.complex_to_float()
                self.wxgui_connect((self, i), c2f)
                for j in range(2):
                    self.connect(
                        (c2f, j),
                        ac_couple_block(
                            self.controller,
                            common.index_key(AC_COUPLE_KEY, 2 * i + j),
                            SAMPLE_RATE_KEY),
                        (scope, 2 * i + j),
                    )
Beispiel #8
0
	def __init__(
		self,
		parent,
		title='',
		sample_rate=1,
		size=scope_window.DEFAULT_WIN_SIZE,
		v_scale=0,
		t_scale=0,
		v_offset=0,
		xy_mode=False,
		ac_couple=False,
		num_inputs=1,
		trig_mode=scope_window.DEFAULT_TRIG_MODE,
		y_axis_label='Counts',
		frame_rate=scope_window.DEFAULT_FRAME_RATE,
                use_persistence=False,
                persist_alpha=None,
		**kwargs #do not end with a comma
	):
                #ensure analog alpha
                if persist_alpha is None:
                  actual_frame_rate=float(frame_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_frame_rate)

		if not t_scale: t_scale = 10.0/sample_rate
		#init
		gr.hier_block2.__init__(
			self,
			"scope_sink",
			gr.io_signature(num_inputs, num_inputs, self._item_size),
			gr.io_signature(0, 0, 0),
		)
		#scope
		msgq = gr.msg_queue(2)
		scope = wxgui.oscope_sink_f(sample_rate, msgq)
		#controller
		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)
		actual_num_inputs = self._real and num_inputs or num_inputs*2
		#init ac couple
		for i in range(actual_num_inputs):
			self.controller[common.index_key(AC_COUPLE_KEY, i)] = ac_couple
		#start input watcher
		common.input_watcher(msgq, self.controller, MSG_KEY)
		#create window
		self.win = scope_window.scope_window(
			parent=parent,
			controller=self.controller,
			size=size,
			title=title,
			frame_rate=frame_rate,
			num_inputs=actual_num_inputs,
			sample_rate_key=SAMPLE_RATE_KEY,
			t_scale=t_scale,
			v_scale=v_scale,
			v_offset=v_offset,
			xy_mode=xy_mode,
			trig_mode=trig_mode,
			y_axis_label=y_axis_label,
			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=use_persistence,
                        persist_alpha=persist_alpha,
		)
		common.register_access_methods(self, self.win)
		#connect
		if self._real:
			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),
				)
		else:
			for i in range(num_inputs):
				c2f = blocks.complex_to_float()
				self.wxgui_connect((self, i), c2f)
				for j in range(2):
					self.connect(
						(c2f, j),
						ac_couple_block(self.controller, common.index_key(AC_COUPLE_KEY, 2*i+j), SAMPLE_RATE_KEY),
						(scope, 2*i+j),
					)