本文整理汇总了Python中Display.View.show方法的典型用法代码示例。如果您正苦于以下问题:Python View.show方法的具体用法?Python View.show怎么用?Python View.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display.View
的用法示例。
在下文中一共展示了View.show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: User
# 需要导入模块: from Display import View [as 别名]
# 或者: from Display.View import show [as 别名]
class User(QDialog, Ui_Dialog):
"""
Class documentation goes here.
"""
def __init__(self, parent = None):
"""
Constructor
"""
# QDialog.__init__(self, parent, Qt.FramelessWindowHint)
QDialog.__init__(self, parent)
self.setupUi(self)
self.nerfModel = Model()
self.dispView = View(None, NUM_CHANNEL, DISPLAY_SCALING, VIEWER_REFRESH_RATE, \
CHANNEL_COLOR)
self.dispView.show()
self.data = []
self.isLogData = False
self.connect(self.dispView.timer, SIGNAL("timeout()"), self.onCheckMoney)
# self.connect(self, SIGNAL("initRT"), self.on_horizontalSlider_sliderMoved)
# self.emit(SIGNAL("initRT"), 1)
self.on_horizontalSlider_valueChanged(1)
# self.connect(self.doubleSpinBox_0, SIGNAL("editingFinished()"), self.onNewWire00In)
# self.connect(self.doubleSpinBox_0, SIGNAL("valueChanged(double)"), self.onNewWire00In)
#
# self.connect(self.doubleSpinBox_1, SIGNAL("editingFinished()"), self.onNewWire01In)
# self.connect(self.doubleSpinBox_1, SIGNAL("valueChanged(double)"), self.onNewWire01In)
self.connect(self.doubleSpinBox_2, SIGNAL("editingFinished()"), self.onNewWireIn2)
self.connect(self.doubleSpinBox_2, SIGNAL("valueChanged(double)"), self.onNewWireIn2)
self.connect(self.doubleSpinBox_3, SIGNAL("editingFinished()"), self.onNewWireIn3)
self.connect(self.doubleSpinBox_3, SIGNAL("valueChanged(double)"), self.onNewWireIn3)
#
self.connect(self.doubleSpinBox_4, SIGNAL("editingFinished()"), self.onNewWireIn4)
self.connect(self.doubleSpinBox_4, SIGNAL("valueChanged(double)"), self.onNewWireIn4)
self.connect(self.doubleSpinBox_5, SIGNAL("editingFinished()"), self.onNewWireIn5)
self.connect(self.doubleSpinBox_5, SIGNAL("valueChanged(double)"), self.onNewWireIn5)
self.connect(self.doubleSpinBox_6, SIGNAL("editingFinished()"), self.onNewWireIn6)
self.connect(self.doubleSpinBox_6, SIGNAL("valueChanged(double)"), self.onNewWireIn6)
#
# self.connect(self.doubleSpinBox_7, SIGNAL("editingFinished()"), self.onNewWire07In)
# self.connect(self.doubleSpinBox_7, SIGNAL("valueChanged(double)"), self.onNewWire07In)
#
# self.connect(self.doubleSpinBox_8, SIGNAL("editingFinished()"), self.onNewWire08In)
# self.connect(self.doubleSpinBox_8, SIGNAL("valueChanged(double)"), self.onNewWire08In)
#
# self.connect(self.doubleSpinBox_9, SIGNAL("editingFinished()"), self.onNewWire09In)
# self.connect(self.doubleSpinBox_9, SIGNAL("valueChanged(double)"), self.onNewWire09In)
self.connect(self.doubleSpinBox_14, SIGNAL("editingFinished()"), self.onNewWireIn14)
self.connect(self.doubleSpinBox_14, SIGNAL("valueChanged(double)"), self.onNewWireIn14)
self.connect(self.doubleSpinBox_15, SIGNAL("editingFinished()"), self.onNewWireIn15)
self.connect(self.doubleSpinBox_15, SIGNAL("valueChanged(double)"), self.onNewWireIn15)
def onCheckMoney(self):
"""
This method is the handler for "WANT MONEY" messages,
"""
newData = [0.0 for ix in range(NUM_CHANNEL)]
for i in xrange(NUM_CHANNEL):
newData[i] = self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])
#if i == 3:
#newData[i] = newData[i] / 100
#newData[i] = max(-65535, min(65535, self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])))
if i == 5:
print newData[i]
# newSpike = self.nerfModel.ReadPipe(0xA1, 4000) # read ## bytes
self.dispView.newData(newData)
# if (self.isLogData):
# self.data.append(newData)
def onClkRate(self, value):
newHalfCnt = 100 * (10 **6) / SAMPLING_RATE / NUM_NEURON / value / 2 / 4
self.nerfModel.SendPara(newVal = newHalfCnt, trigEvent = DATA_EVT_CLKRATE)
# def onNewWireIn(self, evt):
# newWireIn = eval('self.doubleSpinBox_'+str(evt)+u'.value()')
# self.nerfModel.SendPara(newVal = newWireIn, trigEvent = evt)
def onNewWireIn2(self):
newWireIn = eval('self.doubleSpinBox_'+str(2)+u'.value()')
self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 2)
def onNewWireIn3(self):
newWireIn = self.doubleSpinBox_3.value()
if SEND_TYPE[3] == 'int32': newWireIn = int(newWireIn)
self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 3)
#.........这里部分代码省略.........
示例2: User
# 需要导入模块: from Display import View [as 别名]
# 或者: from Display.View import show [as 别名]
class User(QDialog, Ui_Dialog):
"""
Class documentation goes here.
"""
def __init__(self, parent = None):
"""
Constructor
"""
# QDialog.__init__(self, parent, Qt.FramelessWindowHint)
QDialog.__init__(self, parent)
self.setupUi(self)
self.nerfModel = Model()
pipeInData = gen_sin(F = 1.0, AMP = 100.0, T = 2.0)
self.nerfModel.SendPipe(pipeInData)
self.dispView = View(None, VIEWER_REFRESH_RATE, CHIN_PARAM)
self.dispView.show()
self.data = []
self.isLogData = False
# Create float_spin for each input channel
self.ctrl_all = []
for (trig_id, name, type, value) in CHOUT_PARAM:
exec interp('self.ctrl_#{name} = CtrlChannel(hostDialog=self, name=name, id=trig_id, type=type, value=value)')
exec interp('self.connect(self.ctrl_#{name}.doubleSpinBox, SIGNAL("editingFinished()"), self.onNewWireIn)')
exec interp('self.connect(self.ctrl_#{name}.doubleSpinBox, SIGNAL("valueChanged(double)"), self.onNewWireIn)')
exec interp('self.ctrl_all.append(self.ctrl_#{name})')
# Timer for pulling data, separated from timer_display
self.timer = QTimer(self)
self.connect(self.timer, SIGNAL("timeout()"), self.onSyncData)
self.timer.start(VIEWER_REFRESH_RATE )
self.on_horizontalSlider_valueChanged(5)
def onSyncData(self):
"""
Core function of Controller, which polls data from Model(fpga) and sends them to Viewer.
"""
newData = []
for xaddr, xtype in zip(DATA_OUT_ADDR, CH_TYPE):
#newData[i] = self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])
# if i == 3:
# newData[i] = newData[i] / 100
newData.append(max(-16777216, min(16777216, self.nerfModel.ReadFPGA(xaddr, xtype))))
print newData[0::6] # printing
# newSpike1 = self.nerfModel.ReadPipe(0xA0, 5000) # read ## bytes
# newSpike2 = self.nerfModel.ReadPipe(0xA1, 5000) # read ## bytes
# newSpike3 = self.nerfModel.ReadPipe(0xA2, 5000) # read ## bytes
# newSpike4 = self.nerfModel.ReadPipe(0xA3, 5000) # read ## bytes
# newSpike5 = self.nerfModel.ReadPipe(0xA4, 5000) # read ## bytes
newSpike1 = ""
newSpike2 = ""
newSpike3 = ""
newSpike4 = ""
newSpike5 = ""
#newSpike = "" # read ## bytes
self.dispView.newDataIO(newData, [newSpike1, newSpike2, newSpike3, newSpike4, newSpike5])
#self.dispView.newDataIO(newData, [])
if (self.isLogData):
self.data.append(newData)
def onClkRate(self, value):
""" value = how many times of 1/10 real-time
"""
# F_fpga = C * NUM_NEURON * V * F_emu , (C : cycles_per_neuron = 2, V = 365)
# if F_fpga = 200Mhz, F_emu = 1khz)
# halfcnt = F_fpga / F_neuron / 2 = F_fpga / (C * NUM_NEURON * V * F_emu) / 2
NUM_CYCLE = 2
newHalfCnt = 200 * (10 **6) / (NUM_CYCLE * NUM_NEURON * value * SAMPLING_RATE/10 ) /2
print 'halfcnt=%d' %newHalfCnt
print 'value=%d' %value
self.nerfModel.SendPara(bitVal = newHalfCnt, trigEvent = DATA_EVT_CLKRATE)
def onNewWireIn(self):
for ctrl in self.ctrl_all:
newWireIn = ctrl.doubleSpinBox.value()
if newWireIn != ctrl.currVal:
ctrl.currValue = newWireIn
if (ctrl.type == 'int32'):
bitVal = ConvertType(floor(newWireIn), fromType = 'i', toType = 'I')
# print bitVal
elif (ctrl.type == 'float32'):
bitVal = ConvertType(newWireIn, fromType = 'f', toType = 'I')
self.nerfModel.SendPara(bitVal = bitVal, trigEvent = ctrl.id)
def plotData(self, data):
from pylab import plot, show, subplot
#.........这里部分代码省略.........
示例3: User
# 需要导入模块: from Display import View [as 别名]
# 或者: from Display.View import show [as 别名]
class User(QDialog, Ui_Dialog):
"""
Class documentation goes here.
"""
def __init__(self, parent = None):
"""
Constructor
"""
# QDialog.__init__(self, parent, Qt.FramelessWindowHint)
QDialog.__init__(self, parent)
self.setupUi(self)
self.nerfModel = Model()
self.dispView = View(None, NUM_CHANNEL, DISPLAY_SCALING, VIEWER_REFRESH_RATE, \
CHANNEL_COLOR)
self.dispView.show()
self.data = []
self.isLogData = False
self.connect(self.dispView.timer, SIGNAL("timeout()"), self.onCheckMoney)
# self.connect(self, SIGNAL("initRT"), self.on_horizontalSlider_sliderMoved)
# self.emit(SIGNAL("initRT"), 1)
self.on_horizontalSlider_valueChanged(1)
# self.connect(self.doubleSpinBox_0, SIGNAL("editingFinished()"), self.onNewWire00In)
# self.connect(self.doubleSpinBox_0, SIGNAL("valueChanged(double)"), self.onNewWire00In)
#
# self.connect(self.doubleSpinBox_1, SIGNAL("editingFinished()"), self.onNewWire01In)
# self.connect(self.doubleSpinBox_1, SIGNAL("valueChanged(double)"), self.onNewWire01In)
self.connect(self.doubleSpinBox_2, SIGNAL("editingFinished()"), self.onNewWireIn2)
self.connect(self.doubleSpinBox_2, SIGNAL("valueChanged(double)"), self.onNewWireIn2)
# self.connect(self.doubleSpinBox_3, SIGNAL("editingFinished()"), self.onNewWire03In)
# self.connect(self.doubleSpinBox_3, SIGNAL("valueChanged(double)"), self.onNewWire03In)
#
self.connect(self.doubleSpinBox_4, SIGNAL("editingFinished()"), self.onNewWireIn4)
self.connect(self.doubleSpinBox_4, SIGNAL("valueChanged(double)"), self.onNewWireIn4)
self.connect(self.doubleSpinBox_5, SIGNAL("editingFinished()"), self.onNewWireIn5)
self.connect(self.doubleSpinBox_5, SIGNAL("valueChanged(double)"), self.onNewWireIn5)
# self.connect(self.doubleSpinBox_6, SIGNAL("editingFinished()"), self.onNewWire06In)
# self.connect(self.doubleSpinBox_6, SIGNAL("valueChanged(double)"), self.onNewWire06In)
#
# self.connect(self.doubleSpinBox_7, SIGNAL("editingFinished()"), self.onNewWire07In)
# self.connect(self.doubleSpinBox_7, SIGNAL("valueChanged(double)"), self.onNewWire07In)
#
# self.connect(self.doubleSpinBox_8, SIGNAL("editingFinished()"), self.onNewWire08In)
# self.connect(self.doubleSpinBox_8, SIGNAL("valueChanged(double)"), self.onNewWire08In)
#
# self.connect(self.doubleSpinBox_9, SIGNAL("editingFinished()"), self.onNewWire09In)
# self.connect(self.doubleSpinBox_9, SIGNAL("valueChanged(double)"), self.onNewWire09In)
self.connect(self.doubleSpinBox_14, SIGNAL("editingFinished()"), self.onNewWireIn14)
self.connect(self.doubleSpinBox_14, SIGNAL("valueChanged(double)"), self.onNewWireIn14)
self.connect(self.doubleSpinBox_15, SIGNAL("editingFinished()"), self.onNewWireIn15)
self.connect(self.doubleSpinBox_15, SIGNAL("valueChanged(double)"), self.onNewWireIn15)
def onCheckMoney(self):
"""
This method is the handler for "WANT MONEY" messages,
"""
newData = [0.0 for ix in range(NUM_CHANNEL)]
for i in xrange(NUM_CHANNEL):
#newVal[i] = self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i])
newData[i] = max(-65535, min(65535, self.nerfModel.ReadFPGA(DATA_OUT_ADDR[i], CH_TYPE[i])))
# if i == 0:
# print newData[i]
self.dispView.newData(newData)
if (self.isLogData):
self.data.append(newData)
def onClkRate(self, value):
newHalfCnt = 200 * (10 **6) / SAMPLING_RATE / NUM_NEURON / value / 2 / 4
self.nerfModel.SendPara(newVal = newHalfCnt, trigEvent = DATA_EVT_CLKRATE)
# def onNewWireIn(self, evt):
# newWireIn = eval('self.doubleSpinBox_'+str(evt)+u'.value()')
# self.nerfModel.SendPara(newVal = newWireIn, trigEvent = evt)
def onNewWireIn2(self):
newWireIn = eval('self.doubleSpinBox_'+str(2)+u'.value()')
self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 2)
def onNewWireIn4(self):
newWireIn = self.doubleSpinBox_4.value()
print newWireIn,
self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 4)
def onNewWireIn5(self):
newWireIn = self.doubleSpinBox_5.value()
self.nerfModel.SendPara(newVal = newWireIn, trigEvent = 5)
#.........这里部分代码省略.........