コード例 #1
0
 def state_def(self, callback):
     super(MonitorSink, self).state_def(callback)
     # TODO make this possible to be decorator style
     callback(StreamCell(self, 'fft',
         type=BulkDataT(array_format='b', info_format='dff'),
         label='Spectrum'))
     callback(StreamCell(self, 'scope',
         type=BulkDataT(array_format='f', info_format='d'),
         label='Scope'))
コード例 #2
0
 def state_def(self):
     for d in super(MonitorSink, self).state_def():
         yield d
     # TODO make this possible to be decorator style
     yield 'fft', StreamCell(self,
                             'fft',
                             type=BulkDataT(array_format='b',
                                            info_format='dff'),
                             label='Spectrum')
     yield 'scope', StreamCell(self,
                               'scope',
                               type=BulkDataT(array_format='f',
                                              info_format='d'),
                               label='Scope')
コード例 #3
0
 def state_def(self):
     for d in super(MonitorSink, self).state_def():
         yield d
     # TODO make this possible to be decorator style
     yield 'fft', ElementQueueCell(queue=self.__fft_queue,
                                   info_getter=self._get_fft_info,
                                   type=BulkDataT(array_format='b',
                                                  info_format='dff'),
                                   interest_tracker=self.__interest,
                                   label='Spectrum')
     yield 'scope', ElementQueueCell(queue=self.__scope_queue,
                                     info_getter=self._get_scope_info,
                                     type=BulkDataT(array_format='f',
                                                    info_format='d'),
                                     interest_tracker=self.__interest,
                                     label='Scope')
コード例 #4
0
    def state_def(self):
        def info_getter():
            self.info_value += 1
            return (self.info_value, )

        yield 's', ElementSinkCell(info_getter=info_getter,
                                   type=BulkDataT('b', 'b'))
コード例 #5
0
 def setUpForBulkData(self):
     self.cell = ElementSinkCell(
         info_getter=self.info_getter,
         type=BulkDataT(array_format='f', info_format='d'),
         interest_tracker=LoopbackInterestTracker())
     self.dtype = numpy.uint8
     self.sink = self.cell.create_sink_internal(self.dtype)
コード例 #6
0
ファイル: test_types.py プロジェクト: mikekiwa/shinysdr
 def test_buffer_append_and_truncate(self):
     # TODO: add more tests
     buf = BulkDataT('', '').create_buffer(history_length=2)
     buf.append([BulkDataElement(info=(), data=b'\x01')])
     buf.append([BulkDataElement(info=(), data=b'\x02')])
     self.assertEqual(buf.get(), [
         BulkDataElement(info=(), data=b'\x01'),
         BulkDataElement(info=(), data=b'\x02')])
     buf.append([BulkDataElement(info=(), data=b'\x03')])
     self.assertEqual(buf.get(), [
         BulkDataElement(info=(), data=b'\x02'),
         BulkDataElement(info=(), data=b'\x03')])
コード例 #7
0
ファイル: test_types.py プロジェクト: kpreid/shinysdr
 def test_buffer_append_and_truncate(self):
     # TODO: add more tests
     buf = BulkDataT('', '').create_buffer(history_length=2)
     buf.append([BulkDataElement(info=(), data=b'\x01')])
     buf.append([BulkDataElement(info=(), data=b'\x02')])
     self.assertEqual(buf.get(), [
         BulkDataElement(info=(), data=b'\x01'),
         BulkDataElement(info=(), data=b'\x02')])
     buf.append([BulkDataElement(info=(), data=b'\x03')])
     self.assertEqual(buf.get(), [
         BulkDataElement(info=(), data=b'\x02'),
         BulkDataElement(info=(), data=b'\x03')])
コード例 #8
0
 def state_def(self):
     yield 's', StreamCell(self, 's', type=BulkDataT('', 'b'))
コード例 #9
0
ファイル: blocks.py プロジェクト: thejeshgn/shinysdr
    def __init__(self,
                 signal_type=None,
                 enable_scope=False,
                 freq_resolution=4096,
                 time_length=2048,
                 window_type=windows.WIN_BLACKMAN_HARRIS,
                 frame_rate=30.0,
                 input_center_freq=0.0,
                 paused=False,
                 context=None):
        assert isinstance(signal_type, SignalType)
        assert context is not None

        itemsize = signal_type.get_itemsize()
        gr.hier_block2.__init__(
            self,
            type(self).__name__,
            gr.io_signature(1, 1, itemsize),
            gr.io_signature(0, 0, 0),
        )

        # constant parameters
        self.__power_offset = 40  # TODO autoset or controllable
        self.__itemsize = itemsize
        self.__context = context
        self.__enable_scope = enable_scope

        # settable parameters
        self.__signal_type = signal_type
        self.__freq_resolution = int(freq_resolution)
        self.__time_length = int(time_length)
        self.__window_type = _window_type_enum(window_type)
        self.__frame_rate = float(frame_rate)
        self.__input_center_freq = float(input_center_freq)
        self.__paused = bool(paused)

        # interest tracking
        # this is indirect because we ignore interest when paused
        self.__interested_cell = LooseCell(type=bool,
                                           value=False,
                                           writable=False,
                                           persists=False)
        self.__has_subscriptions = False
        self.__interest = InterestTracker(self.__cell_interest_callback)

        self.__fft_cell = ElementSinkCell(info_getter=self._get_fft_info,
                                          type=BulkDataT(array_format='b',
                                                         info_format='dff'),
                                          interest_tracker=self.__interest,
                                          label='Spectrum')
        self.__scope_cell = ElementSinkCell(info_getter=self._get_scope_info,
                                            type=BulkDataT(array_format='f',
                                                           info_format='d'),
                                            interest_tracker=self.__interest,
                                            label='Scope')

        # stuff created by __do_connect
        self.__gate = None
        self.__frame_dec = None
        self.__frame_rate_to_decimation_conversion = 0.0

        self.__do_connect()
コード例 #10
0
ファイル: test_values.py プロジェクト: vpoluyaktov/shinysdr
 def setUpForBulkData(self):
     self.cell = ElementQueueCell(
         queue=self.queue,
         info_getter=self.info_getter,
         type=BulkDataT(array_format='f', info_format='d'),
         interest_tracker=LoopbackInterestTracker())