• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python top.Top类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中shinysdr.top.Top的典型用法代码示例。如果您正苦于以下问题:Python Top类的具体用法?Python Top怎么用?Python Top使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Top类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_auto_retune

 def test_auto_retune(self):
     # pylint: disable=no-member
     
     f1 = 50e6  # avoid 100e6 because that's a default a couple of places
     dev = simulate.SimulatedDevice(freq=f1, allow_tuning=True)
     bandwidth = dev.get_rx_driver().get_output_type().get_sample_rate()
     top = Top(devices={'s1': dev})
     (_key, receiver) = top.add_receiver('AM', key='a')
     
     # initial state check
     receiver.set_rec_freq(f1)
     self.assertEqual(dev.get_freq(), f1)
     
     # one "page" up
     f2 = f1 + bandwidth * 3/4
     receiver.set_rec_freq(f2)
     self.assertEqual(dev.get_freq(), f1 + bandwidth)
     
     # must wait for tune_delay, which is 0 for simulated source, or it will look still-valid
     yield deferLater(the_reactor, 0.1, lambda: None)
     
     # one "page" down
     receiver.set_rec_freq(f1)
     self.assertEqual(dev.get_freq(), f1)
     
     yield deferLater(the_reactor, 0.1, lambda: None)
     
     # long hop
     receiver.set_rec_freq(200e6)
     self.assertEqual(dev.get_freq(), 200e6)
开发者ID:nunb,项目名称:shinysdr,代码行数:30,代码来源:test_top.py


示例2: AppRoot

class AppRoot(ExportedState):
    def __init__(self, devices, audio_config, features):
        self.__receive_flowgraph = Top(
            devices=devices,
            audio_config=audio_config,
            features=features)
        # TODO: only one session while we sort out other things
        self.__session = Session(
            receive_flowgraph=self.__receive_flowgraph,
            features=features)
    
    @exported_block()
    def get_receive_flowgraph(self):  # TODO needs to go away
        return self.__receive_flowgraph
    
    @exported_block(persists=True)
    def get_devices(self):
        """Return all existant devices.
        
        This exists only for persistence purposes.
        """
        return self.__receive_flowgraph.get_sources()
    
    # TODO: should become something more like 'create new session'
    def get_session(self):
        return self.__session
    
    def close_all_devices(self):
        self.__receive_flowgraph.close_all_devices()
开发者ID:Analias,项目名称:shinysdr,代码行数:29,代码来源:session.py


示例3: test_add_unknown_mode

 def test_add_unknown_mode(self):
     '''
     Specifying an unknown mode should not _fail_.
     '''
     top = Top(devices={'s1': simulate.SimulatedDevice(freq=0)})
     (_key, receiver) = top.add_receiver('NONSENSE', key='a')
     self.assertEqual(receiver.get_mode(), 'AM')
开发者ID:nunb,项目名称:shinysdr,代码行数:7,代码来源:test_top.py


示例4: DemodulatorTester

class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator and do some fundamental tests.
    '''
    def __init__(self, mode, state=None):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        if state is None:
            state = {}
        mode_def = lookup_mode(mode)
        if mode_def is None:
            raise Exception('No such mode is registered: ' + repr(mode))
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        self.__top = Top(devices={'s1': SimulatedDevice()})
        (_, receiver) = self.__top.add_receiver(mode, key='a', state=state)
        self.__demodulator = receiver.get_demodulator()
        if not isinstance(self.__demodulator, mode_def.demod_class):
            raise Exception('Demodulator not of expected class: ' + repr(self.__demodulator))
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        state_smoke_test(self.__demodulator)
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:croutonage,项目名称:shinysdr,代码行数:29,代码来源:testutil.py


示例5: test_monitor_vfo_change

 def test_monitor_vfo_change(self):
     freq1 = 1e6
     freq2 = 2e6
     dev = simulate.SimulatedDevice(freq=freq1, allow_tuning=True)
     top = Top(devices={'s1': dev})
     self.assertEqual(top.state()['monitor'].get().get_fft_info()[0], freq1)
     dev.set_freq(freq2)
     yield deferLater(the_reactor, 0.1, lambda: None)  # wait for tune delay
     self.assertEqual(top.state()['monitor'].get().get_fft_info()[0], freq2)
开发者ID:nunb,项目名称:shinysdr,代码行数:9,代码来源:test_top.py


示例6: test_close

 def test_close(self):
     l = set()
     top = Top(devices={'m': Device(
         rx_driver=ShutdownMockDriver(l, 'rx'),
         tx_driver=ShutdownMockDriver(l, 'tx'),
         components={'c': ShutdownMockDriver(l, 'c')})})
     top.close_all_devices()
     # TODO: Add support for closing non-driver components (making this set [rx,tx,c]).
     self.assertEqual(l, set(['rx', 'tx']))
开发者ID:nunb,项目名称:shinysdr,代码行数:9,代码来源:test_top.py


示例7: test_mono

	def test_mono(self):
		top = Top(devices={'s1': simulate.SimulatedDevice(freq=0)}, stereo=False)
		queue = gr.msg_queue()
		(_key, _receiver) = top.add_receiver('AM', key='a')
		top.set_unpaused(True)  # there should be an attempted start
		top.add_audio_queue(queue, 48000)
		top.remove_audio_queue(queue)
开发者ID:shadown,项目名称:shinysdr,代码行数:7,代码来源:test_top.py


示例8: test_receiver_device_default

 def test_receiver_device_default(self):
     '''
     Receiver should default to the monitor device, not other receiver's device.
     '''
     top = Top(devices={
         's1': simulate.SimulatedDevice(),
         's2': simulate.SimulatedDevice(),
     })
     
     (_key, receiver1) = top.add_receiver('AM', key='a')
     top.set_source_name('s2')
     receiver1.set_device_name('s1')
     (_key, receiver2) = top.add_receiver('AM', key='b')
     self.assertEquals(receiver2.get_device_name(), 's2')
     self.assertEquals(receiver1.get_device_name(), 's1')
开发者ID:nunb,项目名称:shinysdr,代码行数:15,代码来源:test_top.py


示例9: AppRoot

class AppRoot(ExportedState):
    def __init__(self, **kwargs):
        # TODO: don't just forward args, do something more sensible, or take as args
        self.__receive_flowgraph = Top(**kwargs)
        # TODO: only one session while we sort out other things
        self.__session = Session(self.__receive_flowgraph)
    
    @exported_block()
    def get_receive_flowgraph(self):
        return self.__receive_flowgraph
    
    # TODO: should become something more like 'create new session'
    def get_session(self):
        return self.__session
    
    def close_all_devices(self):
        self.__receive_flowgraph.close_all_devices()
开发者ID:croutonage,项目名称:shinysdr,代码行数:17,代码来源:session.py


示例10: __init__

 def __init__(self, mode, state=None):
     # TODO: Refactor things so that we can take the demod ctor rather than a mode string
     # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
     if state is None:
         state = {}
     self.__top = Top(devices={'s1': SimulatedDevice()})
     self.__top.add_receiver(mode, key='a', state=state)
     self.__top.start()  # TODO overriding internals
开发者ID:nunb,项目名称:shinysdr,代码行数:8,代码来源:testutil.py


示例11: test_receiver_source_switch

 def test_receiver_source_switch(self):
     '''
     Regression test: Switching sources was not updating receiver input frequency.
     '''
     freq1 = 1e6
     freq2 = 2e6
     top = Top(devices={
         's1': simulate.SimulatedDevice(freq=freq1),
         's2': simulate.SimulatedDevice(freq=freq2),
     })
     
     (_key, receiver) = top.add_receiver('AM', key='a')
     receiver.set_rec_freq(freq2)
     receiver.set_device_name('s1')
     self.assertFalse(receiver.get_is_valid(), 'receiver initially invalid')
     receiver.set_device_name('s2')
     self.assertTrue(receiver.get_is_valid(), 'receiver now valid')
开发者ID:nunb,项目名称:shinysdr,代码行数:17,代码来源:test_top.py


示例12: __init__

 def __init__(self, devices, audio_config, features):
     self.__receive_flowgraph = Top(
         devices=devices,
         audio_config=audio_config,
         features=features)
     # TODO: only one session while we sort out other things
     self.__session = Session(
         receive_flowgraph=self.__receive_flowgraph,
         features=features)
开发者ID:Analias,项目名称:shinysdr,代码行数:9,代码来源:session.py


示例13: test_mono

 def test_mono(self):
     top = Top(devices={'s1': simulate.SimulatedDevice(freq=0)},
         features={'stereo':False})
     queue = gr.msg_queue()
     (_key, _receiver) = top.add_receiver('AM', key='a')
     top.add_audio_queue(queue, 48000)
     top.remove_audio_queue(queue)
开发者ID:Analias,项目名称:shinysdr,代码行数:7,代码来源:test_top.py


示例14: test_monitor_source_switch

 def test_monitor_source_switch(self):
     freq1 = 1e6
     freq2 = 2e6
     # TODO: Also test signal type switching (not yet supported by SimulatedDevice)
     top = Top(devices={
         's1': simulate.SimulatedDevice(freq=freq1),
         's2': simulate.SimulatedDevice(freq=freq2),
     })
     top.set_source_name('s1')
     self.assertEqual(top.state()['monitor'].get().get_fft_info()[0], freq1)
     top.set_source_name('s2')
     self.assertEqual(top.state()['monitor'].get().get_fft_info()[0], freq2)
开发者ID:nunb,项目名称:shinysdr,代码行数:12,代码来源:test_top.py


示例15: __init__

 def __init__(self, mode, state=None):
     # TODO: Refactor things so that we can take the demod ctor rather than a mode string
     if state is None:
         state = {}
     mode_def = lookup_mode(mode)
     if mode_def is None:
         raise Exception('No such mode is registered: ' + repr(mode))
     # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
     self.__top = Top(devices={'s1': SimulatedDevice()})
     (_, receiver) = self.__top.add_receiver(mode, key='a', state=state)
     self.__demodulator = receiver.get_demodulator()
     if not isinstance(self.__demodulator, mode_def.demod_class):
         raise Exception('Demodulator not of expected class: ' + repr(self.__demodulator))
     self.__top.start()  # TODO overriding internals
开发者ID:croutonage,项目名称:shinysdr,代码行数:14,代码来源:testutil.py


示例16: DemodulatorTester

class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator and do some fundamental tests.
    '''
    def __init__(self, mode, state=None):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        if state is None:
            state = {}
        self.__top = Top(devices={'s1': SimulatedDevice()})
        (_, receiver) = self.__top.add_receiver(mode, key='a', state=state)
        self.__demodulator = receiver.get_demodulator()
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        state_smoke_test(self.__demodulator)
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:langxj,项目名称:shinysdr,代码行数:24,代码来源:testutil.py


示例17: test_source_switch_update

	def test_source_switch_update(self):
		'''
		Regression test: Switching sources was not updating receiver input frequency.
		'''
		top = Top(sources={
			's1': simulate.SimulatedSource(freq=0),
			's2': simulate.SimulatedSource(freq=1e6),
		})
		top.set_source_name('s1')
		(_, receiver) = top.add_receiver('AM', key='a')
		receiver.set_rec_freq(1e6)
		self.assertFalse(receiver.get_is_valid())
		top.set_source_name('s2')
		self.assertTrue(receiver.get_is_valid())
开发者ID:amberadams,项目名称:shinysdr,代码行数:14,代码来源:test_top.py


示例18: test_source_switch_update

 def test_source_switch_update(self):
     '''
     Regression test: Switching sources was not updating receiver input frequency.
     '''
     freq = 1e6
     top = Top(devices={
         's1': simulate.SimulatedDevice(freq=0),
         's2': simulate.SimulatedDevice(freq=freq),
     })
     top.set_source_name('s1')
     self.assertEqual(top.monitor.get_fft_info()[0], 0)
     
     (_key, receiver) = top.add_receiver('AM', key='a')
     receiver.set_rec_freq(freq)
     self.assertFalse(receiver.get_is_valid())
     
     top.set_source_name('s2')
     # TODO: instead of top.monitor, should go through state interface
     self.assertEqual(top.monitor.get_fft_info()[0], freq)
     self.assertTrue(receiver.get_is_valid())
开发者ID:gstark307,项目名称:shinysdr,代码行数:20,代码来源:test_top.py


示例19: DemodulatorTester

class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator.
    '''
    def __init__(self, mode):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        self.__top = Top(devices={'s1': SimulatedDevice()})
        self.__top.add_receiver(mode, key='a')
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        pass
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:gstark307,项目名称:shinysdr,代码行数:21,代码来源:testutil.py


示例20: __init__

 def __init__(self, **kwargs):
     # TODO: don't just forward args, do something more sensible, or take as args
     self.__receive_flowgraph = Top(**kwargs)
     # TODO: only one session while we sort out other things
     self.__session = Session(self.__receive_flowgraph)
开发者ID:croutonage,项目名称:shinysdr,代码行数:5,代码来源:session.py



注:本文中的shinysdr.top.Top类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python values.CollectionState类代码示例发布时间:2022-05-27
下一篇:
Python math.dB函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap