Commits

Richard Gerkin  committed b8ac61a

Merged

  • Participants
  • Parent commits 801f3f8

Comments (0)

Files changed (22)

File .DS_Store

Binary file removed.
+# use glob syntax.
+syntax: glob
+
+*.elc
+*.pyc
+*~
+.DS_Store

File USBDIO.txt

-##Examples using ctypes to communicate with ACCES I/O products
-##Examples below are tested with USB-IIRO-16 and USB-IDIO-16 modules,
-##but can be modified to work with other USB modules using the ACCES AIOUSB driver
-##Chris Allen 2012
-
-import time
-from ctypes import *
-
-
-###############################################################################
-##This determines the device address/addresses
-def GET_DEVICES():
-    DEVICES=windll.AIOUSB.VBGetDevices()
-    print DEVICES
-    BIT=0
-    while 1 << BIT <= DEVICES:
-        STATE=(DEVICES & (1 << BIT)) >> BIT
-        if STATE==1:
-            print "Device present at address ", BIT
-        else:
-            pass
-        BIT += 1
-
-        
-###############################################################################
-##Initialise the USB IO Module and ensure all outputs are off
-def INITIALIZE():
-    global DEVICE
-    ##Set this value to our device ID- usually 0 if only one device is connected
-    DEVICE=0
-
-    resetall=c_long(65535)
-
-    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(resetall))
-    IO_ERROR(DIO)
-
-
-def IO_ERROR(value):
-    VALUE=value
-    if VALUE==0:
-        print "SUCCESS"
-        pass
-    else:
-        print "ERROR, DEVICE NOT FOUND. ERROR:",VALUE
-###############################################################################
-##GET THE IO STATUS FROM THE DEVICE using ReadAll
-def GET_IO_STATUS():
-
-    readback=c_long(0)
-    
-    DIO=windll.AIOUSB.VBDIO_ReadAll(DEVICE, pointer(readback))
-    IO_ERROR(DIO)
-    
-    ##OUTPUTS
-    ##NOTE: For some reason the outputs seem inverted-
-    ##for example an output returns 1 when the output is off, but 0 when the output is on
-    ##Likewise when you wish to turn an output on- 0 is on, 1 is off
-    OUT_0=(readback.value>>0)&1
-    OUT_1=(readback.value>>1)&1
-    OUT_2=(readback.value>>2)&1
-    OUT_3=(readback.value>>3)&1
-    OUT_4=(readback.value>>4)&1
-    OUT_5=(readback.value>>5)&1
-    OUT_6=(readback.value>>6)&1
-    OUT_7=(readback.value>>7)&1
-    OUT_8=(readback.value>>8)&1
-    OUT_9=(readback.value>>9)&1
-    OUT_10=(readback.value>>10)&1
-    OUT_11=(readback.value>>11)&1
-    OUT_12=(readback.value>>12)&1
-    OUT_13=(readback.value>>13)&1
-    OUT_14=(readback.value>>14)&1
-    OUT_15=(readback.value>>15)&1
-    ##print the value of out outputs
-    print "OUTPUTS: \t", OUT_0, OUT_1, OUT_2, OUT_3, OUT_4, OUT_5, OUT_6,\
-        OUT_7, OUT_8, OUT_9, OUT_10, OUT_11, OUT_12, OUT_13, OUT_14, OUT_15
-    ##INPUTS
-    IN_0=(readback.value>>16)&1
-    IN_1=(readback.value>>17)&1
-    IN_2=(readback.value>>18)&1
-    IN_3=(readback.value>>19)&1
-    IN_4=(readback.value>>20)&1
-    IN_5=(readback.value>>21)&1
-    IN_6=(readback.value>>22)&1
-    IN_7=(readback.value>>23)&1
-    IN_8=(readback.value>>24)&1
-    IN_9=(readback.value>>25)&1
-    IN_10=(readback.value>>26)&1
-    IN_11=(readback.value>>27)&1
-    IN_12=(readback.value>>28)&1
-    IN_13=(readback.value>>29)&1
-    IN_14=(readback.value>>30)&1
-    IN_15=(readback.value>>31)&1
-    ##print the value of our inputs
-    print "INPUTS: \t", IN_0, IN_1, IN_2, IN_3, IN_4, IN_5, IN_6,\
-        IN_7, IN_8 , IN_9, IN_10, IN_11, IN_12, IN_13, IN_14, IN_15
-
-
-###############################################################################
-##SETUP VARIABLES FOR OUTPUTS
-OUT0=0
-OUT1=1
-OUT2=2
-OUT3=3
-OUT4=4
-OUT5=5
-OUT6=6
-OUT7=7
-OUT8=8
-OUT9=9
-OUT10=10
-OUT11=11
-OUT12=12
-OUT13=13
-OUT14=14
-OUT15=15
-
-ON=0##Note to turn an output ON, the value must be 0
-OFF=1##Note to turn an output OFF, the value must be 1
-
-##Turns OUT_0 on for 5 seconds, then turns it off again using DIO_Write1
-def TOGGLE_OUT_0():
-    GET_IO_STATUS()
-    print "Lets turn OUT_0 ON for 5 seconds"
-    time.sleep(1)
-
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, ON)
-    IO_ERROR(DIO)
-    print "Now check to see if it did indeed turn on..."
-    GET_IO_STATUS()
-    time.sleep(5)
-
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, OFF)
-    IO_ERROR(DIO)
-
-    print "Now lets check the IO Status to see that OUT_0 is off..."
-    GET_IO_STATUS()
-    
-
-###############################################################################
-##Uses DIO_WriteAll to toggle all outputs on in sequence then switch them all off
-def TOGGLE_OUTPUTS_ON():
-    for i in xrange(0, 17):
-        thisbit=65535<<i
-        print "thisbit: ", thisbit
-        outputs=c_short(thisbit)
-        DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
-        IO_ERROR(DIO)
-        GET_IO_STATUS()
-        time.sleep(1)
-    print "Switch all outputs off again..."
-    outputs=c_short(65535)
-    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
-    GET_IO_STATUS()
-
-    
-##############################################################################
-##Uses arguments to select the output and state to switch
-##for example SWITCH_OUTPUT(OUT1, ON) will turn output 1 on
-def SWITCH_OUTPUT(output, state):
-    OUT = output
-    STATUS = state
-    if STATUS==0:
-        TSTATE="ON"
-    else:
-        TSTATE="OFF"
-    print "Turning OUT_",OUT , TSTATE
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT, STATUS)
-    IO_ERROR(DIO)
-    
-  
-

File kernelUI.ui

-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>800</width>
-    <height>600</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>MainWindow</string>
-  </property>
-  <property name="statusTip">
-   <string>z</string>
-  </property>
-  <property name="whatsThis">
-   <string>z</string>
-  </property>
-  <widget class="QWidget" name="centralwidget">
-   <widget class="QRadioButton" name="rbHeadIn">
-    <property name="geometry">
-     <rect>
-      <x>30</x>
-      <y>90</y>
-      <width>82</width>
-      <height>17</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Head In Sim</string>
-    </property>
-   </widget>
-   <widget class="QRadioButton" name="rbLick">
-    <property name="geometry">
-     <rect>
-      <x>30</x>
-      <y>110</y>
-      <width>82</width>
-      <height>17</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Lick Sim</string>
-    </property>
-   </widget>
-   <widget class="QPushButton" name="btnStartSession">
-    <property name="geometry">
-     <rect>
-      <x>30</x>
-      <y>20</y>
-      <width>75</width>
-      <height>23</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Start Session</string>
-    </property>
-   </widget>
-   <widget class="QPushButton" name="btnStartIti">
-    <property name="geometry">
-     <rect>
-      <x>30</x>
-      <y>50</y>
-      <width>75</width>
-      <height>23</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>Start ITI</string>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lbReinfCnt">
-    <property name="geometry">
-     <rect>
-      <x>180</x>
-      <y>20</y>
-      <width>191</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblHeadIn">
-    <property name="geometry">
-     <rect>
-      <x>180</x>
-      <y>50</y>
-      <width>191</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblLickinTrialCnt">
-    <property name="geometry">
-     <rect>
-      <x>180</x>
-      <y>80</y>
-      <width>191</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblEct1">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>400</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblEct2">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>430</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblEct3">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>460</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblEct4">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>490</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblEct5">
-    <property name="geometry">
-     <rect>
-      <x>10</x>
-      <y>520</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::Panel</enum>
-    </property>
-   </widget>
-   <widget class="QLCDNumber" name="lcdRespCnt">
-    <property name="geometry">
-     <rect>
-      <x>20</x>
-      <y>160</y>
-      <width>64</width>
-      <height>23</height>
-     </rect>
-    </property>
-   </widget>
-   <widget class="QLCDNumber" name="lcdTimeCnt">
-    <property name="geometry">
-     <rect>
-      <x>730</x>
-      <y>10</y>
-      <width>64</width>
-      <height>23</height>
-     </rect>
-    </property>
-   </widget>
-   <widget class="QwtTextLabel" name="lblTimeLabel">
-    <property name="geometry">
-     <rect>
-      <x>620</x>
-      <y>10</y>
-      <width>100</width>
-      <height>20</height>
-     </rect>
-    </property>
-    <property name="contextMenuPolicy">
-     <enum>Qt::NoContextMenu</enum>
-    </property>
-    <property name="accessibleName">
-     <string/>
-    </property>
-    <property name="accessibleDescription">
-     <string/>
-    </property>
-    <property name="frameShape">
-     <enum>QFrame::NoFrame</enum>
-    </property>
-   </widget>
-   <widget class="QLCDNumber" name="lcdItiTime">
-    <property name="geometry">
-     <rect>
-      <x>20</x>
-      <y>190</y>
-      <width>64</width>
-      <height>23</height>
-     </rect>
-    </property>
-   </widget>
-  </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>800</width>
-     <height>21</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>QwtTextLabel</class>
-   <extends>QFrame</extends>
-   <header>qwt_text_label.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

File microCont.py

-# -*- coding: utf-8 -*-
-"""
-Created on Mon Jul 01 16:59:51 2013
-
-@author: admin
-"""
-
-##Examples using ctypes to communicate with ACCES I/O products
-##Examples below are tested with USB-IIRO-16 and USB-IDIO-16 modules,
-##but can be modified to work with other USB modules using the ACCES AIOUSB driver
-##Chris Allen 2012
-
-import time
-from ctypes import *
-
-
-###############################################################################
-##This determines the device address/addresses
-def GET_DEVICES():
-    DEVICES=windll.AIOUSB.VBGetDevices()
-    print DEVICES
-    BIT=0
-    while 1 << BIT <= DEVICES:
-        STATE=(DEVICES & (1 << BIT)) >> BIT
-        if STATE==1:
-            print "Device present at address ", BIT
-        else:
-            pass
-        BIT += 1
-
-        
-###############################################################################
-##Initialise the USB IO Module and ensure all outputs are off
-def INITIALIZE():
-    global DEVICE
-    ##Set this value to our device ID- usually 0 if only one device is connected
-    DEVICE=0
-
-    resetall=c_long(65535)
-
-    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(resetall))
-    IO_ERROR(DIO)
-
-
-def IO_ERROR(value):
-    VALUE=value
-    if VALUE==0:
-        print "SUCCESS"
-        pass
-    else:
-        print "ERROR, DEVICE NOT FOUND. ERROR:",VALUE
-###############################################################################
-##GET THE IO STATUS FROM THE DEVICE using ReadAll
-def GET_IO_STATUS():
-
-    readback=c_long(0)
-    
-    DIO=windll.AIOUSB.VBDIO_ReadAll(DEVICE, pointer(readback))
-    IO_ERROR(DIO)
-    
-    ##OUTPUTS
-    ##NOTE: For some reason the outputs seem inverted-
-    ##for example an output returns 1 when the output is off, but 0 when the output is on
-    ##Likewise when you wish to turn an output on- 0 is on, 1 is off
-    OUT_0=(readback.value>>0)&1
-    OUT_1=(readback.value>>1)&1
-    OUT_2=(readback.value>>2)&1
-    OUT_3=(readback.value>>3)&1
-    OUT_4=(readback.value>>4)&1
-    OUT_5=(readback.value>>5)&1
-    OUT_6=(readback.value>>6)&1
-    OUT_7=(readback.value>>7)&1
-    OUT_8=(readback.value>>8)&1
-    OUT_9=(readback.value>>9)&1
-    OUT_10=(readback.value>>10)&1
-    OUT_11=(readback.value>>11)&1
-    OUT_12=(readback.value>>12)&1
-    OUT_13=(readback.value>>13)&1
-    OUT_14=(readback.value>>14)&1
-    OUT_15=(readback.value>>15)&1
-    ##print the value of out outputs
-    print "OUTPUTS: \t", OUT_0, OUT_1, OUT_2, OUT_3, OUT_4, OUT_5, OUT_6,\
-        OUT_7, OUT_8, OUT_9, OUT_10, OUT_11, OUT_12, OUT_13, OUT_14, OUT_15
-    ##INPUTS
-    IN_0=(readback.value>>16)&1
-    IN_1=(readback.value>>17)&1
-    IN_2=(readback.value>>18)&1
-    IN_3=(readback.value>>19)&1
-    IN_4=(readback.value>>20)&1
-    IN_5=(readback.value>>21)&1
-    IN_6=(readback.value>>22)&1
-    IN_7=(readback.value>>23)&1
-    IN_8=(readback.value>>24)&1
-    IN_9=(readback.value>>25)&1
-    IN_10=(readback.value>>26)&1
-    IN_11=(readback.value>>27)&1
-    IN_12=(readback.value>>28)&1
-    IN_13=(readback.value>>29)&1
-    IN_14=(readback.value>>30)&1
-    IN_15=(readback.value>>31)&1
-    ##print the value of our inputs
-    print "INPUTS: \t", IN_0, IN_1, IN_2, IN_3, IN_4, IN_5, IN_6,\
-        IN_7, IN_8 , IN_9, IN_10, IN_11, IN_12, IN_13, IN_14, IN_15
-
-
-###############################################################################
-##SETUP VARIABLES FOR OUTPUTS
-OUT0=0
-OUT1=1
-OUT2=2
-OUT3=3
-OUT4=4
-OUT5=5
-OUT6=6
-OUT7=7
-OUT8=8
-OUT9=9
-OUT10=10
-OUT11=11
-OUT12=12
-OUT13=13
-OUT14=14
-OUT15=15
-
-ON=0##Note to turn an output ON, the value must be 0
-OFF=1##Note to turn an output OFF, the value must be 1
-
-##Turns OUT_0 on for 5 seconds, then turns it off again using DIO_Write1
-def TOGGLE_OUT_0():
-    GET_IO_STATUS()
-    print "Lets turn OUT_0 ON for 5 seconds"
-    time.sleep(1)
-
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, ON)
-    IO_ERROR(DIO)
-    print "Now check to see if it did indeed turn on..."
-    GET_IO_STATUS()
-    time.sleep(5)
-
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, OFF)
-    IO_ERROR(DIO)
-
-    print "Now lets check the IO Status to see that OUT_0 is off..."
-    GET_IO_STATUS()
-    
-
-###############################################################################
-##Uses DIO_WriteAll to toggle all outputs on in sequence then switch them all off
-def TOGGLE_OUTPUTS_ON():
-    for i in xrange(0, 17):
-        thisbit=65535<<i
-        print "thisbit: ", thisbit
-        outputs=c_short(thisbit)
-        DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
-        IO_ERROR(DIO)
-        GET_IO_STATUS()
-        time.sleep(1)
-    print "Switch all outputs off again..."
-    outputs=c_short(65535)
-    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
-    GET_IO_STATUS()
-
-    
-##############################################################################
-##Uses arguments to select the output and state to switch
-##for example SWITCH_OUTPUT(OUT1, ON) will turn output 1 on
-def SWITCH_OUTPUT(output, state):
-    OUT = output
-    STATUS = state
-    if STATUS==0:
-        TSTATE="ON"
-    else:
-        TSTATE="OFF"
-    print "Turning OUT_",OUT , TSTATE
-    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT, STATUS)
-    IO_ERROR(DIO)
-    
-  
-

File olfOutsideEvents_Micro.py

-# -*- coding: utf-8 -*-
-"""
-Created on Sat Jun 29 19:53:54 2013
-
-@author: Dar
-"""
-
-
-import microCont as mc
-
-
-class OutsideEvent: #this should eventually go into another file that's imported
-    '''
-    This is an empty wrapper for controlling the microcontroller.
-    '''
-    def __init__(self):
-        mc.GETDEVICES()
-        mc.INITIALIZE()
-    
-    def lightOn(self):
-        print('light on')
-        
-    def lightOff(self):
-        print('light off')
-        
-    def reinforceOn(self):
-        print('reinforcer on')        
-
-    def reinforceOff(self):
-        print('reinforcer off')     
-
-    def valveOn(self, valveNum):
-        print('valve',str(valveNum), 'on')
-
-    def valveOff(self, valveNum):
-        print('valve',str(valveNum), 'off')
-        
-    def finalValveOn(self):
-        print('FinalValve on')
-    
-    def finalValveOff(self):
-        print('FinalValve off')

File olfSupport.py

-# -*- coding: utf-8 -*-
-"""
-Created on Sat Jun 29 17:45:39 2013
-
-@author: Dar
-"""
-
-import time
-import os
-import olfOutsideEvents
-
-class InternalEvent(object):
-    '''
-    InternalEvent is the parent class of Phase1, Phase3, and other classes 
-    that control experimental continngencies. It contains generic methods for
-    experimental events.
-    
-    '''    
-    
-    def __init__(self):
-        self.bITI = False
-        self.bLickOn = False
-        self.bHeadIn = False
-        self.bReinforcement = False
-        self.reinforcerTime = 0.2
-        self.reinforcerCount = 0
-        self.bContinuePhase = True
-        self.bTrialStart = False
-        self.bTrialFinished = False
-        self.valveState = [0,0,0,0]
-        self.outsideEvent = olfOutsideEvents.OutsideEvent()
-
-        
-    def startIti(self, ItiDuration):        
-        self.ItiDuration = ItiDuration
-        self.ItiTimerRun = RunInternalTimer(ItiDuration)
-        self.bITI = True
-        print('startIti')
-        #Primary.DataFile.writeData('Iti Start')
-                
-    def endIti(self):
-        print('itiEnd')
-        self.bITI = False
-        del self.ItiTimerRun        
-        #Primary.DataFile.writeData('ITI End')
-    
-    def lickOn(self):
-        self.bLickOn= True
-        print('lickOn')
-        
-        
-    def lickOff(self):
-        self.bLickOn = False
-       # print('lickoff')
-
-    def toggleHeadEntry(self):
-        if self.bHeadIn== False:
-           self.headIn()
-        else:
-            self.headOut()
-    
-    def headIn(self):
-        self.bHeadIn = True
-#        self.DataFile.writeData('H In')
-        print 'head in'       
-        
-        
-    def headOut(self):
-        self.bHeadIn = False
-#        self.DataFile.writeData('H Out')
-        print 'head out'
-        
-    def finalValveOn(self):
-        self.bFinalValve = True
-        self.outsideEvent.finalValveOn()
-   
-    def finalValveOff(self):
-        self.bFinalValve = False
-        self.outsideEvent.finalValveOff()
-        
-    def lightOn(self):
-        self.outsideEvent.lightOn()        
-
-    def lightOff(self):
-        self.outsideEvent.lightOff()
-#    
-    def valveOn(self, valveNum):
-        self.outsideEvent.valveOn(valveNum)
-        self.valveState[valveNum - 1] = 1
-
-    def valveOff(self, valveNum):
-        self.outsideEvent.valveOff(valveNum)
-        self.valveState[valveNum - 1] = 0
-
-
-class Reinforcement():
-    '''
-    Reinforcement() controls the timing of the water pump. Instantiting the
-    function sets the duration. Calling the update method will return a boolean
-    indicating whether the pump is now on, or off. Should be used in conjuction
-    with a timer, which calls the update every tic.
-    '''
-    def __init__(self, duration):
-        self.duration = duration
-        self.outsideEvent = olfOutsideEvents.OutsideEvent()
-        self.reinforceOn(self.duration)
-
-    def reinforceOn(self, duration):
-        self.reinfTimerRun = RunInternalTimer(duration)
-        self.outsideEvent.reinforceOn()
-
-        
-    def update(self):
-        if self.reinfTimerRun.countDownComplete:
-            self.outsideEvent.reinforceOff()
-            return False
-        else:
-            return True
-
-
-class RunInternalTimer:
-    '''
-    RunInternalTimer is designed primarily for counting down over a specific
-    duration. Instatiating it will set the current time at the duration, and count
-    down from there. The countDownComplete method returns a boolean that indicates
-    whether the timer has elapsed, or not. This class is heavily used in the 
-    olfaction program.
-    
-    '''
-    def __init__(self, duration = 0):
-        self.startTime = time.time()    
-        self.duration = duration
-    def curTime(self):
-        return time.time()    
-    
-    def timeSince(self):
-        return self.curTime() - self.startTime
-    
-    def countDownTime(self):
-        a = self.duration
-        b = self.timeSince()
-        return a - b
-        
-    def countDownComplete(self):
-        if self.countDownTime() <= 0:
-            return True
-        else:
-            return False       
-
-
-class HeadInIntervalCount():
-    '''
-    Whenever a new trial starts in phase 3 (or similar), this counts the number 
-    of licks over an interval. The interval is divided into bins. If there is
-    a head entry noted in every bin, the update function returns that
-    reinforcement should now be made available. The update function also
-    returns whether the trial is ongoing or finished, and the current status of
-    the trial.
-    '''
-    #counts off an interval, divided into bins of a set duration.
-    # If a response doesn't occur in a bin, the interval ends
-    def __init__(self,intervalLength =1.2, binDuration = 0.2):
-        self.curBin = 0
-        self.intervalLength = intervalLength
-        self.binDuration = binDuration
-        self.binCountTotal = int(self.intervalLength / self.binDuration)
-        self.binList = [0]*self.binCountTotal
-        
-        self.bResp = False
-        self.bContinue = True
-        self.lickDuration = 0
-        self.newBin()
-        self.bReinforcementAvailable = False
-        self.headEntryCount = 0 #simply looks to see if there have been head entries before
-        self.bTrialFinished = False
-        
-       
-    def newBin(self):
-        print('newBin')
-        self.curBin += 1
-        if self.curBin > self.binCountTotal:
-            self.bReinforcementAvailable = True
-            self.endInterval()
-#        del self.binTimer
-        self.binTimer =RunInternalTimer(self.binDuration)
-
-    def endOfBin(self, curBinResp):        
-        if curBinResp > 0:
-            self.newBin()
-        else:
-            self.endInterval()
-        
-    def endInterval(self):
-        self.mouseHeadInDuration = self.binList.count(1) * self.binDuration
-        self.bTrialFinished = True
-        print('end interval')
-           
-    def update(self, bHeadIn):
-        bUpdate = self.addHeadEntryCount(bHeadIn)
-        if bUpdate:
-            if self.bTrialFinished == False:
-                if bHeadIn == True:
-                    self.binList[self.curBin - 1] = 1
-                if self.binTimer.countDownComplete():
-                    curBinResp = int(self.binList[self.curBin-1])
-                    self.endOfBin(curBinResp)
-        return self.bTrialFinished, self.bReinforcementAvailable, self.binList
-        
-    def addHeadEntryCount(self,bHeadIn):
-        if bHeadIn == True:
-            self.headEntryCount += 1
-        if self.headEntryCount > 0:
-            return True
-        else:
-            return False
-            
-
-            
-            
-            
-
-class OutputData():
-    def __init__(self, fileName = 'default',subjectName = 'mouse' ,experimentName = 'experiment',techName = 'anonymous'):
-        self.fileName = str(fileName) + '.txt'
-        startTime = time.asctime(time.localtime(time.time()))
-        
-        if os.path.isfile(self.fileName) == False:
-            self.file = open(self.fileName,'w')
-            self.file.write(startTime)
-            self.file.close()
-        else:
-            self.writeData('new Session')
-            self.writeData(startTime)
-            
-        self.writeData(subjectName)
-        self.writeData(experimentName)
-        self.writeData(techName)        
-
-    def writeData(self, inputText =''):
-        self.file = open(self.fileName, 'a')
-        self.file.write('\n')
-        self.file.write(inputText)
-        self.file.close()

File outside_events.py

-# -*- coding: utf-8 -*-
-"""
-Created on Sat Jun 29 19:53:54 2013
-
-@author: Dar
-"""
-
-class OutsideEvent: #this should eventually go into another file that's imported
-    '''
-    This is an empty wrapper for controlling the microcontroller.
-    '''
-    def lightOn(self):
-        print('light on')
-    
-    def lightOff(self):
-        print('light off')
-        
-    def reinforceOn(self):
-        print('reinforcer on')        
-
-    def reinforceOff(self):
-        print('reinforcer off')     
-
-    def valveOn(self, valveNum):
-        print('valve',str(valveNum), 'on')
-
-    def valveOff(self, valveNum):
-        print('valve',str(valveNum), 'off')
-        
-    def finalValveOn(self):
-        print('FinalValve on')
-    
-    def finalValveOff(self):
-        print('FinalValve off')

File outside_events.pyc

Binary file removed.

File outside_events/.DS_Store

Binary file added.

File outside_events/__init__.py

+# -*- coding: utf-8 -*-
+"""
+Created on Sat Jun 29 19:53:54 2013
+
+@author: Dar
+"""
+
+class OutsideEvent: #this should eventually go into another file that's imported
+    '''
+    This is an empty wrapper for controlling the microcontroller.
+    '''
+    def lightOn(self):
+        print('light on')
+    
+    def lightOff(self):
+        print('light off')
+        
+    def reinforceOn(self):
+        print('reinforcer on')        
+
+    def reinforceOff(self):
+        print('reinforcer off')     
+
+    def valveOn(self, valveNum):
+        print('valve',str(valveNum), 'on')
+
+    def valveOff(self, valveNum):
+        print('valve',str(valveNum), 'off')
+        
+    def finalValveOn(self):
+        print('FinalValve on')
+    
+    def finalValveOff(self):
+        print('FinalValve off')

File outside_events/__init__.pyc

Binary file added.

File outside_events/micro/__init__.py

+import microCont as mc
+
+class OutsideEvent: #this should eventually go into another file that's imported
+    '''
+    This is an empty wrapper for controlling the microcontroller.
+    '''
+    def __init__(self):
+        mc.GETDEVICES()
+        mc.INITIALIZE()
+    
+    def lightOn(self):
+        print('light on')
+        
+    def lightOff(self):
+        print('light off')
+        
+    def reinforceOn(self):
+        print('reinforcer on')        
+
+    def reinforceOff(self):
+        print('reinforcer off')     
+
+    def valveOn(self, valveNum):
+        print('valve',str(valveNum), 'on')
+
+    def valveOff(self, valveNum):
+        print('valve',str(valveNum), 'off')
+        
+    def finalValveOn(self):
+        print('FinalValve on')
+    
+    def finalValveOff(self):
+        print('FinalValve off')

File outside_events/micro/microCont.py

+# -*- coding: utf-8 -*-
+"""
+Created on Mon Jul 01 16:59:51 2013
+
+@author: admin
+"""
+
+##Examples using ctypes to communicate with ACCES I/O products
+##Examples below are tested with USB-IIRO-16 and USB-IDIO-16 modules,
+##but can be modified to work with other USB modules using the ACCES AIOUSB driver
+##Chris Allen 2012
+
+import time
+from ctypes import *
+
+
+###############################################################################
+##This determines the device address/addresses
+def GET_DEVICES():
+    DEVICES=windll.AIOUSB.VBGetDevices()
+    print DEVICES
+    BIT=0
+    while 1 << BIT <= DEVICES:
+        STATE=(DEVICES & (1 << BIT)) >> BIT
+        if STATE==1:
+            print "Device present at address ", BIT
+        else:
+            pass
+        BIT += 1
+
+        
+###############################################################################
+##Initialise the USB IO Module and ensure all outputs are off
+def INITIALIZE():
+    global DEVICE
+    ##Set this value to our device ID- usually 0 if only one device is connected
+    DEVICE=0
+
+    resetall=c_long(65535)
+
+    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(resetall))
+    IO_ERROR(DIO)
+
+
+def IO_ERROR(value):
+    VALUE=value
+    if VALUE==0:
+        print "SUCCESS"
+        pass
+    else:
+        print "ERROR, DEVICE NOT FOUND. ERROR:",VALUE
+###############################################################################
+##GET THE IO STATUS FROM THE DEVICE using ReadAll
+def GET_IO_STATUS():
+
+    readback=c_long(0)
+    
+    DIO=windll.AIOUSB.VBDIO_ReadAll(DEVICE, pointer(readback))
+    IO_ERROR(DIO)
+    
+    ##OUTPUTS
+    ##NOTE: For some reason the outputs seem inverted-
+    ##for example an output returns 1 when the output is off, but 0 when the output is on
+    ##Likewise when you wish to turn an output on- 0 is on, 1 is off
+    OUT_0=(readback.value>>0)&1
+    OUT_1=(readback.value>>1)&1
+    OUT_2=(readback.value>>2)&1
+    OUT_3=(readback.value>>3)&1
+    OUT_4=(readback.value>>4)&1
+    OUT_5=(readback.value>>5)&1
+    OUT_6=(readback.value>>6)&1
+    OUT_7=(readback.value>>7)&1
+    OUT_8=(readback.value>>8)&1
+    OUT_9=(readback.value>>9)&1
+    OUT_10=(readback.value>>10)&1
+    OUT_11=(readback.value>>11)&1
+    OUT_12=(readback.value>>12)&1
+    OUT_13=(readback.value>>13)&1
+    OUT_14=(readback.value>>14)&1
+    OUT_15=(readback.value>>15)&1
+    ##print the value of out outputs
+    print "OUTPUTS: \t", OUT_0, OUT_1, OUT_2, OUT_3, OUT_4, OUT_5, OUT_6,\
+        OUT_7, OUT_8, OUT_9, OUT_10, OUT_11, OUT_12, OUT_13, OUT_14, OUT_15
+    ##INPUTS
+    IN_0=(readback.value>>16)&1
+    IN_1=(readback.value>>17)&1
+    IN_2=(readback.value>>18)&1
+    IN_3=(readback.value>>19)&1
+    IN_4=(readback.value>>20)&1
+    IN_5=(readback.value>>21)&1
+    IN_6=(readback.value>>22)&1
+    IN_7=(readback.value>>23)&1
+    IN_8=(readback.value>>24)&1
+    IN_9=(readback.value>>25)&1
+    IN_10=(readback.value>>26)&1
+    IN_11=(readback.value>>27)&1
+    IN_12=(readback.value>>28)&1
+    IN_13=(readback.value>>29)&1
+    IN_14=(readback.value>>30)&1
+    IN_15=(readback.value>>31)&1
+    ##print the value of our inputs
+    print "INPUTS: \t", IN_0, IN_1, IN_2, IN_3, IN_4, IN_5, IN_6,\
+        IN_7, IN_8 , IN_9, IN_10, IN_11, IN_12, IN_13, IN_14, IN_15
+
+
+###############################################################################
+##SETUP VARIABLES FOR OUTPUTS
+OUT0=0
+OUT1=1
+OUT2=2
+OUT3=3
+OUT4=4
+OUT5=5
+OUT6=6
+OUT7=7
+OUT8=8
+OUT9=9
+OUT10=10
+OUT11=11
+OUT12=12
+OUT13=13
+OUT14=14
+OUT15=15
+
+ON=0##Note to turn an output ON, the value must be 0
+OFF=1##Note to turn an output OFF, the value must be 1
+
+##Turns OUT_0 on for 5 seconds, then turns it off again using DIO_Write1
+def TOGGLE_OUT_0():
+    GET_IO_STATUS()
+    print "Lets turn OUT_0 ON for 5 seconds"
+    time.sleep(1)
+
+    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, ON)
+    IO_ERROR(DIO)
+    print "Now check to see if it did indeed turn on..."
+    GET_IO_STATUS()
+    time.sleep(5)
+
+    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT0, OFF)
+    IO_ERROR(DIO)
+
+    print "Now lets check the IO Status to see that OUT_0 is off..."
+    GET_IO_STATUS()
+    
+
+###############################################################################
+##Uses DIO_WriteAll to toggle all outputs on in sequence then switch them all off
+def TOGGLE_OUTPUTS_ON():
+    for i in xrange(0, 17):
+        thisbit=65535<<i
+        print "thisbit: ", thisbit
+        outputs=c_short(thisbit)
+        DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
+        IO_ERROR(DIO)
+        GET_IO_STATUS()
+        time.sleep(1)
+    print "Switch all outputs off again..."
+    outputs=c_short(65535)
+    DIO=windll.AIOUSB.VBDIO_WriteAll(DEVICE, pointer(outputs))
+    GET_IO_STATUS()
+
+    
+##############################################################################
+##Uses arguments to select the output and state to switch
+##for example SWITCH_OUTPUT(OUT1, ON) will turn output 1 on
+def SWITCH_OUTPUT(output, state):
+    OUT = output
+    STATUS = state
+    if STATUS==0:
+        TSTATE="ON"
+    else:
+        TSTATE="OFF"
+    print "Turning OUT_",OUT , TSTATE
+    DIO=windll.AIOUSB.VBDIO_Write1(DEVICE, OUT, STATUS)
+    IO_ERROR(DIO)
+    
+  
+

File pyKernelUI.py

-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'kernelUI.ui'
-#
-# Created: Mon Jun 24 15:44:10 2013
-#      by: PyQt4 UI code generator 4.9.6
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-try:
-    _fromUtf8 = QtCore.QString.fromUtf8
-except AttributeError:
-    def _fromUtf8(s):
-        return s
-
-try:
-    _encoding = QtGui.QApplication.UnicodeUTF8
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig, _encoding)
-except AttributeError:
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig)
-
-class Ui_MainWindow(object):
-    def setupUi(self, MainWindow):
-        MainWindow.setObjectName(_fromUtf8("MainWindow"))
-        MainWindow.resize(800, 600)
-        self.centralwidget = QtGui.QWidget(MainWindow)
-        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
-        self.rbHeadIn = QtGui.QRadioButton(self.centralwidget)
-        self.rbHeadIn.setGeometry(QtCore.QRect(30, 90, 82, 17))
-        self.rbHeadIn.setObjectName(_fromUtf8("rbHeadIn"))
-        self.rbLick = QtGui.QRadioButton(self.centralwidget)
-        self.rbLick.setGeometry(QtCore.QRect(30, 110, 82, 17))
-        self.rbLick.setObjectName(_fromUtf8("rbLick"))
-        self.btnStartSession = QtGui.QPushButton(self.centralwidget)
-        self.btnStartSession.setGeometry(QtCore.QRect(30, 20, 75, 23))
-        self.btnStartSession.setObjectName(_fromUtf8("btnStartSession"))
-        self.btnStartIti = QtGui.QPushButton(self.centralwidget)
-        self.btnStartIti.setGeometry(QtCore.QRect(30, 50, 75, 23))
-        self.btnStartIti.setObjectName(_fromUtf8("btnStartIti"))
-        self.lbReinfCnt = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lbReinfCnt.setGeometry(QtCore.QRect(180, 20, 191, 20))
-        self.lbReinfCnt.setFrameShape(QtGui.QFrame.Panel)
-        self.lbReinfCnt.setObjectName(_fromUtf8("lbReinfCnt"))
-        self.lblHeadIn = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblHeadIn.setGeometry(QtCore.QRect(180, 50, 191, 20))
-        self.lblHeadIn.setFrameShape(QtGui.QFrame.Panel)
-        self.lblHeadIn.setObjectName(_fromUtf8("lblHeadIn"))
-        self.lblLickinTrialCnt = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblLickinTrialCnt.setGeometry(QtCore.QRect(180, 80, 191, 20))
-        self.lblLickinTrialCnt.setFrameShape(QtGui.QFrame.Panel)
-        self.lblLickinTrialCnt.setObjectName(_fromUtf8("lblLickinTrialCnt"))
-        self.lblEct1 = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblEct1.setGeometry(QtCore.QRect(10, 400, 100, 20))
-        self.lblEct1.setFrameShape(QtGui.QFrame.Panel)
-        self.lblEct1.setObjectName(_fromUtf8("lblEct1"))
-        self.lblEct2 = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblEct2.setGeometry(QtCore.QRect(10, 430, 100, 20))
-        self.lblEct2.setFrameShape(QtGui.QFrame.Panel)
-        self.lblEct2.setObjectName(_fromUtf8("lblEct2"))
-        self.lblEct3 = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblEct3.setGeometry(QtCore.QRect(10, 460, 100, 20))
-        self.lblEct3.setFrameShape(QtGui.QFrame.Panel)
-        self.lblEct3.setObjectName(_fromUtf8("lblEct3"))
-        self.lblEct4 = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblEct4.setGeometry(QtCore.QRect(10, 490, 100, 20))
-        self.lblEct4.setFrameShape(QtGui.QFrame.Panel)
-        self.lblEct4.setObjectName(_fromUtf8("lblEct4"))
-        self.lblEct5 = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblEct5.setGeometry(QtCore.QRect(10, 520, 100, 20))
-        self.lblEct5.setFrameShape(QtGui.QFrame.Panel)
-        self.lblEct5.setObjectName(_fromUtf8("lblEct5"))
-        self.lcdRespCnt = QtGui.QLCDNumber(self.centralwidget)
-        self.lcdRespCnt.setGeometry(QtCore.QRect(20, 160, 64, 23))
-        self.lcdRespCnt.setObjectName(_fromUtf8("lcdRespCnt"))
-        self.lcdTimeCnt = QtGui.QLCDNumber(self.centralwidget)
-        self.lcdTimeCnt.setGeometry(QtCore.QRect(730, 10, 64, 23))
-        self.lcdTimeCnt.setObjectName(_fromUtf8("lcdTimeCnt"))
-        self.lblTimeLabel = Qwt5.QwtTextLabel(self.centralwidget)
-        self.lblTimeLabel.setGeometry(QtCore.QRect(620, 10, 100, 20))
-        self.lblTimeLabel.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
-        self.lblTimeLabel.setAccessibleName(_fromUtf8(""))
-        self.lblTimeLabel.setAccessibleDescription(_fromUtf8(""))
-        self.lblTimeLabel.setFrameShape(QtGui.QFrame.NoFrame)
-        self.lblTimeLabel.setObjectName(_fromUtf8("lblTimeLabel"))
-        self.lcdItiTime = QtGui.QLCDNumber(self.centralwidget)
-        self.lcdItiTime.setGeometry(QtCore.QRect(20, 190, 64, 23))
-        self.lcdItiTime.setObjectName(_fromUtf8("lcdItiTime"))
-        MainWindow.setCentralWidget(self.centralwidget)
-        self.menubar = QtGui.QMenuBar(MainWindow)
-        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
-        self.menubar.setObjectName(_fromUtf8("menubar"))
-        MainWindow.setMenuBar(self.menubar)
-        self.statusbar = QtGui.QStatusBar(MainWindow)
-        self.statusbar.setObjectName(_fromUtf8("statusbar"))
-        MainWindow.setStatusBar(self.statusbar)
-
-        self.retranslateUi(MainWindow)
-        QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
-    def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
-        MainWindow.setStatusTip(_translate("MainWindow", "z", None))
-        MainWindow.setWhatsThis(_translate("MainWindow", "z", None))
-        self.rbHeadIn.setText(_translate("MainWindow", "Head In Sim", None))
-        self.rbLick.setText(_translate("MainWindow", "Lick Sim", None))
-        self.btnStartSession.setText(_translate("MainWindow", "Start Session", None))
-        self.btnStartIti.setText(_translate("MainWindow", "Start ITI", None))
-
-from PyQt4 import Qwt5
-
-if __name__ == "__main__":
-    import sys
-    app = QtGui.QApplication(sys.argv)
-    MainWindow = QtGui.QMainWindow()
-    ui = Ui_MainWindow()
-    ui.setupUi(MainWindow)
-    MainWindow.show()
-    sys.exit(app.exec_())
-

File qt/conversiondirections.txt

-at command prompt
-<<<<<<< local
-pyuic4 gui.ui > gui.py=======
-pyuic4 pyolfaction.ui > pyolfaction.py>>>>>>> other

File qt/kernelUI.ui

+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="statusTip">
+   <string>z</string>
+  </property>
+  <property name="whatsThis">
+   <string>z</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QRadioButton" name="rbHeadIn">
+    <property name="geometry">
+     <rect>
+      <x>30</x>
+      <y>90</y>
+      <width>82</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Head In Sim</string>
+    </property>
+   </widget>
+   <widget class="QRadioButton" name="rbLick">
+    <property name="geometry">
+     <rect>
+      <x>30</x>
+      <y>110</y>
+      <width>82</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Lick Sim</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="btnStartSession">
+    <property name="geometry">
+     <rect>
+      <x>30</x>
+      <y>20</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Start Session</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="btnStartIti">
+    <property name="geometry">
+     <rect>
+      <x>30</x>
+      <y>50</y>
+      <width>75</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Start ITI</string>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lbReinfCnt">
+    <property name="geometry">
+     <rect>
+      <x>180</x>
+      <y>20</y>
+      <width>191</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblHeadIn">
+    <property name="geometry">
+     <rect>
+      <x>180</x>
+      <y>50</y>
+      <width>191</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblLickinTrialCnt">
+    <property name="geometry">
+     <rect>
+      <x>180</x>
+      <y>80</y>
+      <width>191</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblEct1">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>400</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblEct2">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>430</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblEct3">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>460</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblEct4">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>490</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblEct5">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>520</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Panel</enum>
+    </property>
+   </widget>
+   <widget class="QLCDNumber" name="lcdRespCnt">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>160</y>
+      <width>64</width>
+      <height>23</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLCDNumber" name="lcdTimeCnt">
+    <property name="geometry">
+     <rect>
+      <x>730</x>
+      <y>10</y>
+      <width>64</width>
+      <height>23</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QwtTextLabel" name="lblTimeLabel">
+    <property name="geometry">
+     <rect>
+      <x>620</x>
+      <y>10</y>
+      <width>100</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="contextMenuPolicy">
+     <enum>Qt::NoContextMenu</enum>
+    </property>
+    <property name="accessibleName">
+     <string/>
+    </property>
+    <property name="accessibleDescription">
+     <string/>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::NoFrame</enum>
+    </property>
+   </widget>
+   <widget class="QLCDNumber" name="lcdItiTime">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>190</y>
+      <width>64</width>
+      <height>23</height>
+     </rect>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QwtTextLabel</class>
+   <extends>QFrame</extends>
+   <header>qwt_text_label.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

File qt/pyKernelUI.py

+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'kernelUI.ui'
+#
+# Created: Mon Jun 24 15:44:10 2013
+#      by: PyQt4 UI code generator 4.9.6
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+try:
+    _fromUtf8 = QtCore.QString.fromUtf8
+except AttributeError:
+    def _fromUtf8(s):
+        return s
+
+try:
+    _encoding = QtGui.QApplication.UnicodeUTF8
+    def _translate(context, text, disambig):
+        return QtGui.QApplication.translate(context, text, disambig, _encoding)
+except AttributeError:
+    def _translate(context, text, disambig):
+        return QtGui.QApplication.translate(context, text, disambig)
+
+class Ui_MainWindow(object):
+    def setupUi(self, MainWindow):
+        MainWindow.setObjectName(_fromUtf8("MainWindow"))
+        MainWindow.resize(800, 600)
+        self.centralwidget = QtGui.QWidget(MainWindow)
+        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
+        self.rbHeadIn = QtGui.QRadioButton(self.centralwidget)
+        self.rbHeadIn.setGeometry(QtCore.QRect(30, 90, 82, 17))
+        self.rbHeadIn.setObjectName(_fromUtf8("rbHeadIn"))
+        self.rbLick = QtGui.QRadioButton(self.centralwidget)
+        self.rbLick.setGeometry(QtCore.QRect(30, 110, 82, 17))
+        self.rbLick.setObjectName(_fromUtf8("rbLick"))
+        self.btnStartSession = QtGui.QPushButton(self.centralwidget)
+        self.btnStartSession.setGeometry(QtCore.QRect(30, 20, 75, 23))
+        self.btnStartSession.setObjectName(_fromUtf8("btnStartSession"))
+        self.btnStartIti = QtGui.QPushButton(self.centralwidget)
+        self.btnStartIti.setGeometry(QtCore.QRect(30, 50, 75, 23))
+        self.btnStartIti.setObjectName(_fromUtf8("btnStartIti"))
+        self.lbReinfCnt = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lbReinfCnt.setGeometry(QtCore.QRect(180, 20, 191, 20))
+        self.lbReinfCnt.setFrameShape(QtGui.QFrame.Panel)
+        self.lbReinfCnt.setObjectName(_fromUtf8("lbReinfCnt"))
+        self.lblHeadIn = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblHeadIn.setGeometry(QtCore.QRect(180, 50, 191, 20))
+        self.lblHeadIn.setFrameShape(QtGui.QFrame.Panel)
+        self.lblHeadIn.setObjectName(_fromUtf8("lblHeadIn"))
+        self.lblLickinTrialCnt = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblLickinTrialCnt.setGeometry(QtCore.QRect(180, 80, 191, 20))
+        self.lblLickinTrialCnt.setFrameShape(QtGui.QFrame.Panel)
+        self.lblLickinTrialCnt.setObjectName(_fromUtf8("lblLickinTrialCnt"))
+        self.lblEct1 = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblEct1.setGeometry(QtCore.QRect(10, 400, 100, 20))
+        self.lblEct1.setFrameShape(QtGui.QFrame.Panel)
+        self.lblEct1.setObjectName(_fromUtf8("lblEct1"))
+        self.lblEct2 = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblEct2.setGeometry(QtCore.QRect(10, 430, 100, 20))
+        self.lblEct2.setFrameShape(QtGui.QFrame.Panel)
+        self.lblEct2.setObjectName(_fromUtf8("lblEct2"))
+        self.lblEct3 = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblEct3.setGeometry(QtCore.QRect(10, 460, 100, 20))
+        self.lblEct3.setFrameShape(QtGui.QFrame.Panel)
+        self.lblEct3.setObjectName(_fromUtf8("lblEct3"))
+        self.lblEct4 = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblEct4.setGeometry(QtCore.QRect(10, 490, 100, 20))
+        self.lblEct4.setFrameShape(QtGui.QFrame.Panel)
+        self.lblEct4.setObjectName(_fromUtf8("lblEct4"))
+        self.lblEct5 = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblEct5.setGeometry(QtCore.QRect(10, 520, 100, 20))
+        self.lblEct5.setFrameShape(QtGui.QFrame.Panel)
+        self.lblEct5.setObjectName(_fromUtf8("lblEct5"))
+        self.lcdRespCnt = QtGui.QLCDNumber(self.centralwidget)
+        self.lcdRespCnt.setGeometry(QtCore.QRect(20, 160, 64, 23))
+        self.lcdRespCnt.setObjectName(_fromUtf8("lcdRespCnt"))
+        self.lcdTimeCnt = QtGui.QLCDNumber(self.centralwidget)
+        self.lcdTimeCnt.setGeometry(QtCore.QRect(730, 10, 64, 23))
+        self.lcdTimeCnt.setObjectName(_fromUtf8("lcdTimeCnt"))
+        self.lblTimeLabel = Qwt5.QwtTextLabel(self.centralwidget)
+        self.lblTimeLabel.setGeometry(QtCore.QRect(620, 10, 100, 20))
+        self.lblTimeLabel.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
+        self.lblTimeLabel.setAccessibleName(_fromUtf8(""))
+        self.lblTimeLabel.setAccessibleDescription(_fromUtf8(""))
+        self.lblTimeLabel.setFrameShape(QtGui.QFrame.NoFrame)
+        self.lblTimeLabel.setObjectName(_fromUtf8("lblTimeLabel"))
+        self.lcdItiTime = QtGui.QLCDNumber(self.centralwidget)
+        self.lcdItiTime.setGeometry(QtCore.QRect(20, 190, 64, 23))
+        self.lcdItiTime.setObjectName(_fromUtf8("lcdItiTime"))
+        MainWindow.setCentralWidget(self.centralwidget)
+        self.menubar = QtGui.QMenuBar(MainWindow)
+        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
+        self.menubar.setObjectName(_fromUtf8("menubar"))
+        MainWindow.setMenuBar(self.menubar)
+        self.statusbar = QtGui.QStatusBar(MainWindow)
+        self.statusbar.setObjectName(_fromUtf8("statusbar"))
+        MainWindow.setStatusBar(self.statusbar)
+
+        self.retranslateUi(MainWindow)
+        QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+    def retranslateUi(self, MainWindow):
+        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
+        MainWindow.setStatusTip(_translate("MainWindow", "z", None))
+        MainWindow.setWhatsThis(_translate("MainWindow", "z", None))
+        self.rbHeadIn.setText(_translate("MainWindow", "Head In Sim", None))
+        self.rbLick.setText(_translate("MainWindow", "Lick Sim", None))
+        self.btnStartSession.setText(_translate("MainWindow", "Start Session", None))
+        self.btnStartIti.setText(_translate("MainWindow", "Start ITI", None))
+
+from PyQt4 import Qwt5
+
+if __name__ == "__main__":
+    import sys
+    app = QtGui.QApplication(sys.argv)
+    MainWindow = QtGui.QMainWindow()
+    ui = Ui_MainWindow()
+    ui.setupUi(MainWindow)
+    MainWindow.show()
+    sys.exit(app.exec_())
+

File qt/pyTestUI.py

-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'testUI.ui'
-#
-# Created: Mon Jun 24 13:54:31 2013
-#      by: PyQt4 UI code generator 4.9.6
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-try:
-    _fromUtf8 = QtCore.QString.fromUtf8
-except AttributeError:
-    def _fromUtf8(s):
-        return s
-
-try:
-    _encoding = QtGui.QApplication.UnicodeUTF8
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig, _encoding)
-except AttributeError:
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig)
-
-class Ui_MainWindow(object):
-    def setupUi(self, MainWindow):
-        MainWindow.setObjectName(_fromUtf8("MainWindow"))
-        MainWindow.resize(584, 444)
-        self.centralwidget = QtGui.QWidget(MainWindow)
-        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
-        self.btnStart = QtGui.QPushButton(self.centralwidget)
-        self.btnStart.setGeometry(QtCore.QRect(160, 100, 75, 23))
-        self.btnStart.setObjectName(_fromUtf8("btnStart"))
-        self.lblCnt = QtGui.QLabel(self.centralwidget)
-        self.lblCnt.setGeometry(QtCore.QRect(170, 150, 46, 13))
-        self.lblCnt.setObjectName(_fromUtf8("lblCnt"))
-        self.ScaleWidget = Qwt5.QwtScaleWidget(self.centralwidget)
-        self.ScaleWidget.setGeometry(QtCore.QRect(20, 180, 101, 41))
-        self.ScaleWidget.setObjectName(_fromUtf8("ScaleWidget"))
-        MainWindow.setCentralWidget(self.centralwidget)
-        self.menubar = QtGui.QMenuBar(MainWindow)
-        self.menubar.setGeometry(QtCore.QRect(0, 0, 584, 21))
-        self.menubar.setObjectName(_fromUtf8("menubar"))
-        MainWindow.setMenuBar(self.menubar)
-        self.statusbar = QtGui.QStatusBar(MainWindow)
-        self.statusbar.setObjectName(_fromUtf8("statusbar"))
-        MainWindow.setStatusBar(self.statusbar)
-
-        self.retranslateUi(MainWindow)
-        QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
-    def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
-        self.btnStart.setText(_translate("MainWindow", "PushButton", None))
-        self.lblCnt.setText(_translate("MainWindow", "TextLabel", None))
-
-from PyQt4 import Qwt5

File qt/pyolfaction.py

-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'pyolfaction.ui'
-#
-# Created: Mon Jun 24 13:34:28 2013
-#      by: PyQt4 UI code generator 4.9.6
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-try:
-    _fromUtf8 = QtCore.QString.fromUtf8
-except AttributeError:
-    def _fromUtf8(s):
-        return s
-
-try:
-    _encoding = QtGui.QApplication.UnicodeUTF8
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig, _encoding)
-except AttributeError:
-    def _translate(context, text, disambig):
-        return QtGui.QApplication.translate(context, text, disambig)
-
-class Ui_MainWindow(object):
-    def setupUi(self, MainWindow):
-        MainWindow.setObjectName(_fromUtf8("MainWindow"))
-        MainWindow.resize(640, 480)
-        self.centralwidget = QtGui.QWidget(MainWindow)
-        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
-        self.hits = QtGui.QLCDNumber(self.centralwidget)
-        self.hits.setGeometry(QtCore.QRect(130, 110, 64, 23))
-        self.hits.setProperty("intValue", 50)
-        self.hits.setObjectName(_fromUtf8("hits"))
-        self.misses = QtGui.QLCDNumber(self.centralwidget)
-        self.misses.setGeometry(QtCore.QRect(130, 160, 64, 23))
-        self.misses.setObjectName(_fromUtf8("misses"))
-        self.reinforcementDuration = QtGui.QSlider(self.centralwidget)
-        self.reinforcementDuration.setGeometry(QtCore.QRect(360, 60, 160, 22))
-        self.reinforcementDuration.setOrientation(QtCore.Qt.Horizontal)
-        self.reinforcementDuration.setObjectName(_fromUtf8("reinforcementDuration"))
-        self.tableWidget = QtGui.QTableWidget(self.centralwidget)
-        self.tableWidget.setGeometry(QtCore.QRect(30, 240, 256, 192))
-        self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
-        self.tableWidget.setColumnCount(0)
-        self.tableWidget.setRowCount(0)
-        self.progressBar = QtGui.QProgressBar(self.centralwidget)
-        self.progressBar.setGeometry(QtCore.QRect(360, 150, 118, 23))
-        self.progressBar.setProperty("value", 24)
-        self.progressBar.setObjectName(_fromUtf8("progressBar"))
-        self.pushButton = QtGui.QPushButton(self.centralwidget)
-        self.pushButton.setGeometry(QtCore.QRect(360, 260, 114, 32))
-        self.pushButton.setObjectName(_fromUtf8("pushButton"))
-        self.checkBox = QtGui.QCheckBox(self.centralwidget)
-        self.checkBox.setGeometry(QtCore.QRect(240, 50, 87, 20))
-        self.checkBox.setObjectName(_fromUtf8("checkBox"))
-        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
-        self.tabWidget.setGeometry(QtCore.QRect(430, 10, 120, 80))
-        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
-        self.tab = QtGui.QWidget()
-        self.tab.setObjectName(_fromUtf8("tab"))
-        self.tabWidget.addTab(self.tab, _fromUtf8(""))
-        self.tab_2 = QtGui.QWidget()
-        self.tab_2.setObjectName(_fromUtf8("tab_2"))
-        self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
-        MainWindow.setCentralWidget(self.centralwidget)
-        self.menubar = QtGui.QMenuBar(MainWindow)
-        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 22))
-        self.menubar.setObjectName(_fromUtf8("menubar"))
-        self.menuPyOlfaction = QtGui.QMenu(self.menubar)
-        self.menuPyOlfaction.setObjectName(_fromUtf8("menuPyOlfaction"))
-        self.menuSettings = QtGui.QMenu(self.menubar)
-        self.menuSettings.setObjectName(_fromUtf8("menuSettings"))
-        MainWindow.setMenuBar(self.menubar)
-        self.statusbar = QtGui.QStatusBar(MainWindow)
-        self.statusbar.setObjectName(_fromUtf8("statusbar"))
-        MainWindow.setStatusBar(self.statusbar)
-        self.actionNew = QtGui.QAction(MainWindow)
-        self.actionNew.setObjectName(_fromUtf8("actionNew"))
-        self.actionOpen = QtGui.QAction(MainWindow)
-        self.actionOpen.setObjectName(_fromUtf8("actionOpen"))
-        self.actionSave = QtGui.QAction(MainWindow)
-        self.actionSave.setObjectName(_fromUtf8("actionSave"))
-        self.actionSpecies = QtGui.QAction(MainWindow)
-        self.actionSpecies.setObjectName(_fromUtf8("actionSpecies"))
-        self.menuPyOlfaction.addAction(self.actionNew)
-        self.menuPyOlfaction.addAction(self.actionOpen)
-        self.menuPyOlfaction.addAction(self.actionSave)
-        self.menuSettings.addAction(self.actionSpecies)
-        self.menubar.addAction(self.menuPyOlfaction.menuAction())
-        self.menubar.addAction(self.menuSettings.menuAction())
-
-        self.retranslateUi(MainWindow)
-        self.tabWidget.setCurrentIndex(1)
-        QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
-    def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(_translate("MainWindow", "PyOlfaction", None))
-        self.pushButton.setText(_translate("MainWindow", "PushButton", None))
-        self.checkBox.setText(_translate("MainWindow", "CheckBox", None))
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1", None))
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2", None))
-        self.menuPyOlfaction.setTitle(_translate("MainWindow", "File", None))
-        self.menuSettings.setTitle(_translate("MainWindow", "Settings", None))
-        self.actionNew.setText(_translate("MainWindow", "New", None))
-        self.actionOpen.setText(_translate("MainWindow", "Open", None))
-        self.actionSave.setText(_translate("MainWindow", "Save", None))
-        self.actionSpecies.setText(_translate("MainWindow", "Species", None))
-

File qt/testTimer.py

-# -*- coding: utf-8 -*-
-"""
-Created on Mon Jun 24 13:43:34 2013
-
-@author: Thereom
-"""
-import sys
-from PyQt4 import QtCore, QtGui
-from ui import *
-
-class Primary(QtGui.QMainWindow):
-    def __init__(self):
-        super(Primary, self).__init__()        
-      
-        #MainWindow = QtGui.QMainWindow()
-        ui = Ui_MainWindow()
-        ui.setupUi(self)
-        self.show()
-
-        self.initUI()
-        self.count = 0
-        
-        ui.pushButton.clicked.connect(self.startTimer)
-
-        
-    def initUI(self):
-        self.timer = QtCore.QBasicTimer()
-        
-    
-    def startTimer(self):
-        self.timer.start(100,self)
-    
-    def timerEvent(self,event):
-        self.count += 1
-        print(self.count)
-
-def main():
-    
-    app = QtGui.QApplication(sys.argv)
-    ex = Primary()
-    sys.exit(app.exec_())
-
-
-if __name__ == '__main__':
-    main()

File qt/testUI.ui

-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>584</width>
-    <height>444</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>MainWindow</string>
-  </property>
-  <widget class="QWidget" name="centralwidget">
-   <widget class="QPushButton" name="btnStart">
-    <property name="geometry">
-     <rect>
-      <x>160</x>
-      <y>100</y>
-      <width>75</width>
-      <height>23</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>PushButton</string>
-    </property>
-   </widget>
-   <widget class="QLabel" name="lblCnt">
-    <property name="geometry">
-     <rect>
-      <x>170</x>
-      <y>150</y>
-      <width>46</width>
-      <height>13</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string>TextLabel</string>
-    </property>
-   </widget>
-   <widget class="QwtScaleWidget" name="ScaleWidget">
-    <property name="geometry">
-     <rect>
-      <x>20</x>
-      <y>180</y>
-      <width>101</width>
-      <height>41</height>
-     </rect>
-    </property>
-   </widget>
-  </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>584</width>
-     <height>21</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QStatusBar" name="statusbar"/>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>QwtScaleWidget</class>
-   <extends>QWidget</extends>
-   <header>qwt_scale_widget.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>