本文整理汇总了Python中expeyes.eyesj.open函数的典型用法代码示例。如果您正苦于以下问题:Python open函数的具体用法?Python open怎么用?Python open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了open函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
"""
Constructor: creates an instance of MyWindow
"""
#########################################
# Necessary actions, which must be done #
# for any project #
#########################################
# first, calling the ancestor's creator
QtGui.QMainWindow.__init__(self, parent)
# get the User Interface from the module UI_p1
self.ui=Ui_MainWindow()
# initialize the user interface
self.ui.setupUi(self)
#########################################
# Custom actions, which can be written #
# in other ways for other projects. #
#########################################
# aliases for some parts of the user interface
self.plotWidget = self.ui.qwtPlot
self.measureButton = self.ui.measureButton
self.closeButton = self.ui.closeButton
# connect methods to buttons' click signals
self.measureButton.clicked.connect(self.measure)
self.closeButton.clicked.connect(self.close)
# initialize an empty curve for the plot widget
self.curve = QwtPlotCurve()
self.curve.attach(self.plotWidget)
# initialize the driver for expEYES Junior
self.p = ej.open()
return
示例2: __init__
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
# connect methods to buttons' click signals
self.ui.wakeUpButton.clicked.connect(self.wakeUp)
self.ui.stopButton.clicked.connect(self.stop)
self.ui.closeButton.clicked.connect(self.close)
self.ui.saveButton.clicked.connect(self.save)
self.ui.immediateButton.clicked.connect(self.immediate)
self.ui.finalButton.clicked.connect(self.final)
self.ui.fitButton.clicked.connect(self.fit)
self.ui.action_Save_Ctrl_S.triggered.connect(self.save)
self.ui.action_Quit_Ctrl_Q.triggered.connect(self.close)
self.ui.actionManual.triggered.connect(self.manual)
self.ui.actionAbout.triggered.connect(self.about)
# initialize an empty curve for the plot widget
self.curve = QwtPlotCurve()
self.curve.attach(self.ui.qwtPlot)
# expEYESdetection and initialization
try:
self.p = ej.open()
assert(self.p.fd)
self.setWindowTitle("expEYES Junior found on port {}".format(
self.p.fd.port
))
except:
self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
self.wakeUpButton.setEnabled(False)
# custom properties
self.isImmediate=True
return
示例3: run_expt
def run_expt(expt):
global p
if expt == '': return
p.fd.close() # Free the device from this program, the child will open it
cmd = sys.executable + ' ' + eyeplot.abs_path() + expt+'.py'
os.system(cmd)
msg(_('Finished "')+expt+'.py"')
p = eyes.open() # Establish hardware communication again, for the parent
p.disable_actions()
示例4: __init__
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
# connect methods to buttons' click signals
self.ui.wakeUpButton.clicked.connect(self.wakeUp)
self.ui.stopButton.clicked.connect(self.stop)
self.ui.closeButton.clicked.connect(self.close)
self.ui.saveButton.clicked.connect(self.save)
self.ui.immediateButton.clicked.connect(self.immediate)
self.ui.finalButton.clicked.connect(self.final)
self.ui.fitButton.clicked.connect(self.fit)
self.ui.action_Save_Ctrl_S.triggered.connect(self.save)
self.ui.action_Quit_Ctrl_Q.triggered.connect(self.close)
self.ui.actionManual.triggered.connect(self.manual)
self.ui.actionAbout.triggered.connect(self.about)
self.ui.durationEdit.textChanged.connect(self.durationChanged)
# create a timer
self.stopTime=time.time()
self.timer=QtCore.QTimer()
# connect the timer to the "tick" callback method
self.timer.timeout.connect(self.tick)
# 20 times per second
self.timer.start(50)
# initialize an empty curve for the plot widget
self.curve = QwtPlotCurve()
self.curve0 = QwtPlotCurve()
self.fitCurve1 = QwtPlotCurve()
self.fitCurve2 = QwtPlotCurve()
self.fitCurve3 = QwtPlotCurve()
self.curve.attach(self.ui.qwtPlot)
self.curve0.attach(self.ui.qwtPlot)
self.fitCurve1.attach(self.ui.qwtPlot)
self.fitCurve2.attach(self.ui.qwtPlot)
self.fitCurve3.attach(self.ui.qwtPlot)
# adjust the axis scales based on duration = 15 s
self.durationChanged(15, ampl=5)
# set the maxvalue for the threshold rate (in V/s)
self.maxthreshold=150/15 # = 150/duration
# expEYESdetection and initialization
try:
self.p = ej.open()
assert(self.p.fd)
self.setWindowTitle("expEYES Junior found on port {}".format(
self.p.fd.port
))
except:
self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
self.ui.wakeUpButton.setEnabled(False)
# custom properties
self.isImmediate=True
return
示例5: __init__
def __init__(self, parent=None):
"""
Constructor: creates an instance of MyWindow
"""
#########################################
# Necessary actions, which must be done #
# for any project #
#########################################
# first, calling the ancestor's creator
QtGui.QMainWindow.__init__(self, parent)
# get the User Interface from the module UI_p1
self.ui=Ui_MainWindow()
# initialize the user interface
self.ui.setupUi(self)
#########################################
# Custom actions, which can be written #
# in other ways for other projects. #
#########################################
# aliases for some parts of the user interface
self.plotWidget = self.ui.qwtPlot
self.measureButton = self.ui.measureButton
self.closeButton = self.ui.closeButton
# connect methods to buttons' click signals
self.measureButton.clicked.connect(self.measure)
self.closeButton.clicked.connect(self.close)
# initialize 4 empty curves for the plot widget
self.curves=[]
colors=[
QtGui.QColor("#000000"), #black
QtGui.QColor("#ff0000"), #red
QtGui.QColor("#0000ff"), #blue
QtGui.QColor("#00cc00"), #dark green
]
for i in range(4):
c=QwtPlotCurve()
c.setPen(colors[i])
self.curves.append(c)
c.attach(self.plotWidget)
# initialize the driver for expEYES Junior
# prevent an error if the box is not detected
try:
self.p = ej.open()
assert(self.p.fd)
self.setWindowTitle("expEYES Junior found on port {}".format(
self.p.fd.port
))
except:
self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
self.measureButton.setEnabled(False)
return
示例6: clear
def clear(self):
if self.running == True:
return
self.nt = [ [], [] ]
g.delete_lines()
self.msg(_('Cleared Data and Trace'))
def msg(self,s, col = 'blue'):
msgwin.config(text=s, fg=col)
def quit(self):
p.set_state(10,0)
sys.exit()
p = eyes.open()
p.disable_actions()
root = Tk()
Canvas(root, width = WIDTH, height = 5).pack(side=TOP)
g = eyeplot.graph(root, width=WIDTH, height=HEIGHT, bip=False)
pt = LM35()
cf = Frame(root, width = WIDTH, height = 10)
cf.pack(side=TOP, fill = BOTH, expand = 1)
b3 = Label(cf, text = _('Read Every'))
b3.pack(side = LEFT, anchor = SW)
TGAP = StringVar()
Dur =Entry(cf, width=5, bg = 'white', textvariable = TGAP)
示例7: clear
def clear():
global history, trial, running
if running == True:
return
g.delete_lines()
history = []
trial = 0
def quit():
ph.set_sqr1(0)
sys.exit()
ph = eyes.open()
root = Tk()
Canvas(root, width=WIDTH, height=5).pack(side=TOP) # Some space at the top
g = eyeplot.graph(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp
g.setWorld(fmin, 0, fmax, 5.0, _("Freq"), _("Amp"))
cf = Frame(root, width=WIDTH, height=10)
cf.pack(side=TOP, fill=BOTH, expand=1)
b1 = Button(cf, text=_("START"), command=start)
b1.pack(side=LEFT, anchor=N)
b3 = Button(cf, text=_("SAVE to"), command=save)
b3.pack(side=LEFT, anchor=N)
filename = StringVar()
e1 = Entry(cf, width=15, bg="white", textvariable=filename)
filename.set("freq-response.dat")
示例8: print
from __future__ import print_function
'''
Connect pickup coil to A1 and Fit the sine wave for getting frequency.
From frequency of rotation of anemometer wind speed can be calculated
'''
import gettext
gettext.bindtextdomain("expeyes")
gettext.textdomain('expeyes')
_ = gettext.gettext
import expeyes.eyesj as ej
import expeyes.eyemath as em
from pylab import plot, show
p = ej.open()
t,v= p.capture(1,400,100)
try:
vfit, par = em.fit_sine(t,v)
print (par[1]) # second parameter is frequency
print((t,v))
plot(t, vfit)
show()
except:
print("No alternative signal, please make another try.")