本文整理汇总了Python中util.Data类的典型用法代码示例。如果您正苦于以下问题:Python Data类的具体用法?Python Data怎么用?Python Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_calc_data
def get_calc_data():
data = RegsData(sz=16)
data.add_page('calc0')
data.add('label0', label='Fmix = Fvco / DIV')
data.add_page('calc1')
data.add('Fmix', wdgt='spin', value=Data.spn(356.25, 2850, 0.01), text='1440', msg='Fmix', src=Fmix_src_cb)
data.add('Fvco1', wdgt='entry', state='readonly', msg='Fvco', src=Fvco_src_cb)
data.add('DIV', wdgt='combo', state='readonly', text='2', value=['2', '4', '8'], msg='DIV', src=lambda d,v: d.list_src('R22', 3, 4, ['2', '4', '8'], v))
data.add_page('calc2')
data.add('label1', label='Fvco = 2 x Fpfd x (INT + FRAC/MOD )')
data.add_page('calc3')
data.add('Fvco', wdgt='entry', state='readonly', msg='Fvco', src=Fvco_src_cb)
data.add('Fpfd1', wdgt='entry', state='readonly', msg='Fpfd', src=Fpfd_src_cb)
data.add('INT', wdgt='spin', value=Data.spn(21, 123), msg='INT', src=lambda d,v: d.bits_src('R02', 0, 10, v))
data.add('FRAC', wdgt='spin', value=Data.spn(0, 63535), msg='FRAC', src=lambda d,v: d.bits_src('R03', 0, 15, v))
data.add('MOD', wdgt='spin', value=Data.spn(1, 63535), msg='MOD', src=lambda d,v: d.bits_src('R04', 0, 15, v))
data.add_page('calc4')
data.add('label0', label='Fpfd = REFin x REFSEL')
data.add_page('calc5')
data.add('Fpfd', wdgt='entry', state='readonly', msg='Fpfd', src=Fpfd_src_cb)
data.add('REFin', wdgt='entry', state='readonly', msg='REFin', src=lambda d,v: d.dev_src('refin'))
data.add('REFSEL', wdgt='combo', state='readonly', value=refsel_list, msg='REFSEL', src=lambda d,v: d.list_src('R21', 0, 2, refsel_list, v))
data.add_page('calc6')
data.add('MUXOUT', wdgt='combo', state='readonly', value=muxout_list, label='MUXOUT', width=30, src=lambda d,v: d.list_src('R21', 4, 6, muxout_list, v))
data.add_page('calc7')
data.add('VCOSEL', wdgt='combo', state='readonly', value=vcosel_list, label='VCOSEL', src=lambda d,v: d.list_src('R22', 0, 2, vcosel_list, v))
return data
示例2: get_ctrl
def get_ctrl(dev):
spn_max, spn_step = 2.5, 0.05
if dev['type'] == 'AD5620_2_5V':
spn_max = 5
data = Data(name='Voltage', send=True, io_cb=util_io_cb)
fmt_cb = lambda val, read, spn_max=spn_max: float_fmt_cb(val, read, spn_max)
cmd_cb = lambda dev, cmd, val: spi_efc_cmd_cb(dev, cmd, val, ncpha='0', cpol='0')
data.add('out', label='OUT, V', wdgt='spin', value=Data.spn(0, spn_max, spn_step), fmt_cb=fmt_cb, cmd_cb=cmd_cb)
return data
示例3: __init__
def __init__(self, dev, title='File IO'):
data = Data()
data.dev = dev
data.buttons = OD()
#data.buttons['TX stop'] = self.dma_stop_cb
self.add_tx_cmds(data, txcrc32=False)
data.add('txstop', wdgt='button', text='TX stop', click_cb=self.dma_stop_cb)
self.add_rx_cmds(data)
Control.__init__(self, data, dev, title=title)
self.fileext = 'pcm'
self.center()
示例4: get_mntr
def get_mntr(dev):
mntr = Data(name='status', send=True, io_cb=dev_io_cb)
mntr.add('status', wdgt='alarm', trace_cb=alarm_trace_cb, fmt_cb=status_fmt_cb, msg='Power supply')
add_status = lambda n, msg: mntr.add('status%d' % n, wdgt='alarm', send=False, trace_cb=alarm_trace_cb, fmt_cb=lambda val, read: status_fmt_cb(val,read,n), msg=msg)
add_status(1, 'Synth1 lock detect')
add_status(2, 'Synth2 (aux) lock detect')
add_status(3, 'Output level < threshold')
mntr.add_page('mntr')
mntr.add('5_5v', wdgt='entry', label='5.5V', state='readonly', msg='5.5V')
mntr.add('txl', wdgt='entry', label='TXL', state='readonly', msg='TX signal level')
return mntr
示例5: __init__
def __init__(self, dev, title='FW upgrade'):
data = Data()
data.dev = dev
data.buttons = OD()
self.txcrc32 = True
self.add_tx_cmds(data, txcrc32=self.txcrc32)
Control.__init__(self, data, dev, title=title)
data.cmds['send'].w.configure(text='Start upgrade')
self.fileext = 'bin'
self.filemode = 'rb'
self.io_start = lambda *args: asyncio.async(self.io.start())
示例6: get_lpf_ctrl
def get_lpf_ctrl(data=None, cmd=None):
if not data:
data = Data(name='LPF', io_cb=util_io_cb)
if not cmd:
cmd = 'lpf'
data.add(cmd, label='LPF, MHz', wdgt='spin', text='15', value={'min':0, 'max':31, 'step':1}, fmt_cb=lpf_fmt_cb, cmd_cb=lpf_cmd_cb, send=True)
data.add('g3', label='Preamplifier gain', wdgt='radio', text=gain_list[2][0], value=gain_list[2], fmt_cb=lambda v,r: gain_fmt_cb(v,r,2), send=False)
data.add('g2', label='Postamplifier gain', wdgt='radio', text=gain_list[1][0], value=gain_list[1], fmt_cb=lambda v,r: gain_fmt_cb(v,r,1), send=False)
data.add('g1', label='VGA max gain', wdgt='radio', text=gain_list[0][0], value=gain_list[0], fmt_cb=lambda v,r: gain_fmt_cb(v,r,0), send=False)
示例7: get_mntr
def get_mntr(dev):
mntr = Data(io_cb=dev_io_cb)
mntr.add_page('mntr', send=True)
mntr.add('synth1', wdgt='alarm', trace_cb=alarm_trace_cb, fmt_cb=synth_fmt_cb, msg='Synthesizer 1')
mntr.add('synth2', wdgt='alarm', trace_cb=alarm_trace_cb, fmt_cb=synth_fmt_cb, msg='Synthesizer 2')
mntr.add('uout1', wdgt='entry', state='readonly', msg='Uout1, V')
mntr.add('uout2', wdgt='entry', state='readonly', msg='Uout2, V')
mntr.add('uout3', wdgt='entry', state='readonly', msg='abs(Uout1-Uout2), V')
return mntr
示例8: get_mntr
def get_mntr(dev):
mntr = Data(name='mntr', send=True, io_cb=dev_io_cb)
#mntr.add('temp', wdgt='entry', msg='Temperature')
#am('dma0', 'DMA0')
#am('dma1', 'DMA1')
#am('dma2', 'DMA2')
#am('dma3', 'DMA3')
avti=lambda k,msg,i,send=False: mntr.add(k,wdgt='alarm',cmd='vtune',send=send,msg=msg,fmt_cb=lambda val,read: vtune_fmt_cb(val,read,i),trace_cb=alarm_trace_cb)
avti('txvtuneh', 'TX VTUNE_H', 0, True)
avti('txvtunel', 'TX VTUNE_L', 1)
avti('rxvtuneh', 'TX VTUNE_H', 2)
avti('rxvtunel', 'TX VTUNE_L', 3)
return mntr
示例9: get_mntr
def get_mntr(self):
data = Data(name='Monitor')
data.add('az', label='Azimuth', wdgt='entry', state='readonly', send=True, cmd_cb=polus_cmd_cb)
data.add('el', label='Elevation', wdgt='entry', state='readonly', send=True, cmd_cb=polus_cmd_cb)
def add_alarm(k, bit, msg, cmd_cb=None):
data.add(k, wdgt='alarm', send=True if cmd_cb else False, cmd_cb=cmd_cb, fmt_cb=lambda val, read: alarm_fmt_cb(val, read, bit), msg=msg, trace_cb=alarm_trace_cb)
add_alarm('az+', 0, 'az+', cmd_cb=lambda *args: 'POLUS.status')
add_alarm('az-', 1, 'az-')
#add_alarm('limaz+', 4, 'limaz+')
#add_alarm('limaz-', 5, 'limaz-')
add_alarm('el+', 2, 'el+')
add_alarm('el-', 3, 'el-')
#add_alarm('limel+', 6, 'limel+')
#add_alarm('limel-', 7, 'limel-')
return data
示例10: get_ctrl
def get_ctrl(dev):
ctrl_buttons = OD([('Reset', reset_cb), ('Write', write_cb)])
data = Data(buttons=ctrl_buttons, io_cb=dev_io_cb)
data.add_page('Generator', send=True)
data.add('freq', label='Frequency, MHz', wdgt='spin', value={'min':0.1, 'max':12400, 'step':0.1}, text='1451')
data.add('amp', label='Amplitude, dBm', wdgt='spin', value={'min':-40, 'max':-6, 'step':0.5}, text='-40')
return data
示例11: get_mntr
def get_mntr(dev):
data = Data('mntra', send=True, io_cb=dev_serial_io_cb)
for ch in range(1, 9):
data.add('a%d'%ch,cmd='fetch',wdgt='alarm',msg='CH%d'%ch,fmt_cb=lambda val,read,c=ch:fmt_cb1(val,read,c),send=(ch==1),trace_cb=alarm_trace_cb)
data.add_page('mntre', send=True)
for ch in range(1, 9):
v = data.add('CH%d'%ch, wdgt='entry', label='CH%d'%ch, msg='CH%d'%ch)
data.cmds.columns = 4
return data
示例12: add_memory_cb
def add_memory_cb(self):
mem = Data(name='mem')
mem.add('name', label='Name', wdgt='entry', text='new')
mem.add('addr', label='Start address', wdgt='entry', text='00000000')
mem.add('sz', label='Size in bytes', wdgt='entry', text='4')
dlg = Control(data=mem, parent=self.root, title='Add memory', pady=5)
dlg.add_buttons_ok_cancel()
dlg.do_modal()
if not hasattr(dlg, 'kw'):
return
if len(dlg.kw.keys()) == 0:
return
self.add_memory(dlg.kw['name'], dlg.kw['addr'], dlg.kw['sz'])
示例13: init_common_layout
def init_common_layout(self):
self.add_menu_file(file_save=False)
self.menu_bank = self.add_menu_bank()
self.fl = tk.Frame(self.frame)
self.fl.pack(fill=tk.BOTH, expand=1, side=tk.LEFT)
self.fr = tk.Frame(self.frame)
self.fr.pack(fill=tk.BOTH, expand=0, side=tk.RIGHT)
self.pdata = Data()
self.ptabs = ttk.Notebook(self.fl)
self.ptabs.pack(fill=tk.BOTH, expand=1, padx=5, pady=5)
self.pdata.bind_tab_cb(self.ptabs, self.plot_update)
self.tabs = ttk.Notebook(self.fr)
self.tabs.pack(fill=tk.BOTH, expand=1, padx=5, pady=5)
self.bank_add()
self.data.bind_tab_cb(self.tabs, self.plot_update)
示例14: get_ctrl
def get_ctrl(dev):
gnsw_list = ['6dB', '12dB']
gnsw_fmt_cb = lambda val, read=True: gpio_list_fmt_cb(val, read, gnsw_list, 0)
gnsw_cmd_cb = lambda dev, cmd, val: gpio_cmd_cb(dev, cmd, val, 0)
ofds_list = ['Enable', 'Disable']
ofds_fmt_cb = lambda val, read=True: gpio_list_fmt_cb(val, read, ofds_list, 1)
ofds_cmd_cb = lambda dev, cmd, val: gpio_cmd_cb(dev, cmd, val, 1)
lpf_cmd_cb = lambda dev, cmd, val: spi_efc_cmd_cb(dev, cmd, val, ncpha='1', cpol='1')
data = Data(name='LPF', send=True, io_cb=util_io_cb)
data.add('gnsw', label='Gain switch', wdgt='radio', value=gnsw_list, fmt_cb=gnsw_fmt_cb, cmd_cb=gnsw_cmd_cb)
data.add('ofds', label='Offset correction loop', wdgt='radio', value=ofds_list, fmt_cb=ofds_fmt_cb, cmd_cb=ofds_cmd_cb)
data.add('lpf', label='LPF, MHz', wdgt='spin', value={'min':1, 'max':30, 'step':1}, fmt_cb=lpf_fmt_cb, cmd_cb=lpf_cmd_cb)
return data
示例15: get_ctrl
def get_ctrl(dev):
ctrl = Data(name='Settings', send=True, io_cb=dev_io_cb)
ctrl.add('agc_en', label='AGC Enable', wdgt='radio', value=OD([('ON', '1'), ('OFF', '0')]))
ctrl.add('agc_lvl', label='AGC Level', wdgt='spin', value=Data.spn(0, 2.5, 0.1))
ctrl.add('bpf', label='Band Pass Filter', wdgt='combo', state='readonly', value=OD([('11MHz', '0'), ('5.5MHz', '2'), ('250kHz', '3')]))
ctrl.add('bas', label='BAS output', wdgt='radio', value=OD([('Ch1 (sig)', '0'), ('Ch3 (br)', '1')]))
ctrl.add('test', label='TEST output', wdgt='combo', state='readonly', value=OD([('Synth1(835-1140,1MHz)', '3'), ('Synth2(150,7MHz)', '1'), ('Synth3(1125-1140,1MHz)', '0'), ('XTAL(26MHz)', '2')]))
ctrl.add('freq', label='Channel1 freq', wdgt='spin', value=Data.spn(975, 1000, 0.01), cmd_cb=freq_cmd_cb)
ctrl.add('inv', label='Channel1 inv', wdgt='check', fmt_cb=inv_fmt_cb, trace_cb=inv_trace_cb)
ctrl.add('gain', label='Channel1 gain', wdgt='spin', value=Data.spn(19, 65, 0.5))
ctrl.add('freqbr', label='Channel3(br) freq', wdgt='spin', value=Data.spn(975, 1000.1, 0.01))
ctrl.add('gainbr', label='Channel3(br) gain', wdgt='spin', value=Data.spn(29.5, 77.5, 0.5))
ctrl.add('thrs1', label='Threshold1', wdgt='spin', value=Data.spn(0, 200, 1))
ctrl.add('thrs2', label='Threshold2', wdgt='spin', value=Data.spn(0, 200, 1))
ctrl.add('thrsb', label='Threshold (br)', wdgt='spin', value=Data.spn(0, 10, 0.1))
ctrl.add_page('System')
ctrl.add('commit', label='EFC commit enable', wdgt='combo', state='readonly', value=['ON', 'OFF'], text='ON')
return ctrl