Example #1
0
def test_LabJackInstrument():
    u3=LabJackInstrument()
    print u3.write.__doc__
    print dir(u3)
##    for command in u3.commands:
##        print command
    print 'It has address %s'%u3.address
    print "it's serial # is %s"%u3.serial
    print "it's handle is %s"%u3.handle
    voltage=0
    print " Seting DAC1 to %s Volts"%voltage
    u3.set_value('DAC1',voltage)
    print "DAC1 Voltage is %s"%u3.get_value('DAC1')
    ON_OFF=0
    print " Seting FIO4 to %s"%ON_OFF
    u3.set_value('FIO4',ON_OFF)
    print u3.get_value('FIO4')
    print u3.configuration
    print u3.channel_names
    print u3.channel_numbers
    try:
        print u3.channel_name('1')
        print u3.channel_name(1)
        print u3.channel_name('AIN1')
        print u3.channel_name('DB15 1')
    except LabJackInstrumentError:
        print 'Caught an Error'
Example #2
0
def test_LabJackInstrument():
    u3 = LabJackInstrument()
    print u3.write.__doc__
    print dir(u3)
    ##    for command in u3.commands:
    ##        print command
    print 'It has address %s' % u3.address
    print "it's serial # is %s" % u3.serial
    print "it's handle is %s" % u3.handle
    voltage = 0
    print " Seting DAC1 to %s Volts" % voltage
    u3.set_value('DAC1', voltage)
    print "DAC1 Voltage is %s" % u3.get_value('DAC1')
    ON_OFF = 0
    print " Seting FIO4 to %s" % ON_OFF
    u3.set_value('FIO4', ON_OFF)
    print u3.get_value('FIO4')
    print u3.configuration
    print u3.channel_names
    print u3.channel_numbers
    try:
        print u3.channel_name('1')
        print u3.channel_name(1)
        print u3.channel_name('AIN1')
        print u3.channel_name('DB15 1')
    except LabJackInstrumentError:
        print 'Caught an Error'
Example #3
0
def test_labjack_fast():
    # This seems to indicate that the response time is 15 ms
    # I am not sure why it is so slow.--> Just a clock resolution thing
    # If you use time.clock() it is better, the resolution is a OS dependent thing
    # Reading from the labjack appears to take ~4ms (250HZ)
    u3=LabJackInstrument()
    for i in range(250):
        y=u3.get_value('AIN0')
        t=time.clock()
        #t=time.time()
        #t=datetime.datetime.utcnow().isoformat()
        print y,t
Example #4
0
def test_IV():
    """ a simple IV with a labjack u3 with a spectrum in between"""
    spectrometer=OceanOpticsInstrument('USB2000')
    u3=LabJackInstrument()
    #camera=MightexInstrument()
    from scipy import linspace
    start=0
    stop=1
    num_points=20
    values=linspace(start,stop,num_points).tolist()
    IV=[]
    s=[]
    #images=[]
    for value in values:
        u3.set_value('DAC1',value)
        time.sleep(.1)
        IV.append((u3.get_value('AIN0'),u3.get_value('DAC1')))
        s.append(spectrometer.get_spectrum())
        #images.append(camera.get_frame())
    print IV
    print len(s),len(s[0])
Example #5
0
def test_labjack_fast():
    # This seems to indicate that the response time is 15 ms
    # I am not sure why it is so slow.--> Just a clock resolution thing
    # If you use time.clock() it is better, the resolution is a OS dependent thing
    # Reading from the labjack appears to take ~4ms (250HZ)
    u3 = LabJackInstrument()
    for i in range(250):
        y = u3.get_value('AIN0')
        t = time.clock()
        #t=time.time()
        #t=datetime.datetime.utcnow().isoformat()
        print y, t
Example #6
0
def test_IV():
    """ a simple IV with a labjack u3 with a spectrum in between"""
    spectrometer = OceanOpticsInstrument('USB2000')
    u3 = LabJackInstrument()
    #camera=MightexInstrument()
    from scipy import linspace
    start = 0
    stop = 1
    num_points = 20
    values = linspace(start, stop, num_points).tolist()
    IV = []
    s = []
    #images=[]
    for value in values:
        u3.set_value('DAC1', value)
        time.sleep(.1)
        IV.append((u3.get_value('AIN0'), u3.get_value('DAC1')))
        s.append(spectrometer.get_spectrum())
        #images.append(camera.get_frame())
    print IV
    print len(s), len(s[0])