示例#1
0
 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
 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
0
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()
 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
0
 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
0
 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.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 signal plot widget
     self.signal = QwtPlotCurve()
     self.signal.attach(self.ui.signalPlot)
     self.ui.signalPlot.setAxisTitle(QwtPlot.xBottom, "t (ms)")
     self.ui.signalPlot.setAxisTitle(QwtPlot.yLeft, "voltage (V)")
     self.ui.signalPlot.setTitle("Signal")
     # and another for the fft plotwidget
     self.fft    = QwtPlotCurve()
     self.fft.attach(self.ui.fftPlot)
     self.ui.fftPlot.setAxisTitle(QwtPlot.xBottom, "f (Hz)")
     self.ui.fftPlot.setAxisTitle(QwtPlot.yLeft, "amplitude")
     self.ui.fftPlot.setTitle("Fourier Transform")
     # 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
            fn = 'motion2.dat'
        p.save([self.tv], fn)
        self.msg(_('Data saved to %s') % fn)

    def clear(self):
        if self.running == True:
            return
        self.tv = [[], []]
        g.delete_lines()
        self.msg(_('Cleared Data and Trace'))

    def msg(self, s, col='blue'):
        msgwin.config(text=s, fg=col)


p = eyes.open()
p.disable_actions()
root = Tk()
Canvas(root, width=WIDTH, height=5).pack(side=TOP)  # Some space at the top
g = eyeplot.graph(root, width=WIDTH, height=HEIGHT,
                  bip=False)  # make plot objects using draw.disp
pen = SRF2()

cf = Frame(root, width=WIDTH, height=10)
cf.pack(side=TOP, fill=BOTH, expand=1)

b3 = Label(cf, text=_('Digitize for'))
b3.pack(side=LEFT, anchor=SW)
DURATION = StringVar()
Dur = Entry(cf, width=5, bg='white', textvariable=DURATION)
DURATION.set('10')
	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)
示例#9
0
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")
示例#10
0
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)
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.")

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.")