countergpib = 1 multigpib = 6 vrange = 1 vresolution = 0.0001 # Setting up frequency counter counter = AgilentCounter(gpib=countergpib) if counter == None: exit counter.reset() counter.setupFast() counter.write(":FUNC 'FREQ 1'") counter.setupGating(0.1) # Setting up multimeter Agilent - 34401 multi = AgilentMultimeter(gpib=multigpib) if multi == None: exit multi.reset() # Resistance measurement - 2 Wire multi.write("CONF:RESISTANCE") multi.write("RESISTANCE:NPLC 0.2") multi.write("TRIG:SOUR IMM") # Need to do one reading to set up Wait-For-Trigger state! multi.ask("READ?") # Setting up output file datafile = "beatohm_%s.log" % (strftime("%y%m%d_%H%M%S")) out = file(datafile, "a") out.write("#Time(UnixTime) BeatFrequency(Hz) Voltage(V)\n")
multigpib = None vrange = 1 vresolution = 0.0001 gatetime = 0.1 # in seconds # Setting up frequency counter counter = AgilentCounter(gpib = countergpib) if (counter == None): exit counter.reset() counter.setupFast() counter.write(":FUNC 'FREQ 1'") counter.setupGating(gatetime) # Setting up multimeter multi = AgilentMultimeter(gpib = multigpib) if multigpib else None if multi: multi.reset() # 5-1/2 digits fast multi.write("CONF:VOLT:DC %d" %(vrange)) multi.write("VOLT:DC:NPLC 0.2") multi.write("TRIG:SOUR IMM") # Need to do one reading to set up Wait-For-Trigger state! multi.ask("READ?") # Setting up output file datafile = "freqlog_%s.log" %(strftime("%y%m%d_%H%M%S")) out = file(datafile, 'a') header = ["#Time(UnixTime)"] if counter:
from numpy import savetxt, array from agilentmultimeter import AgilentMultimeter import logging logger = logging.getLogger('serialmulti') hdlr = logging.FileHandler("templog_voltage_%s.log" %(strftime("%y%m%d_%H%M%S"))) formatter = logging.Formatter('%(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.INFO) # Config settings multigpib = 6 # Setting up multimeter Agilent - 34401 multi = AgilentMultimeter(gpib = multigpib) if (multi == None): exit multi.reset() # Resistance measurement - 2 Wire multi.write("CONF:VOLTAGE") multi.write("VOLTAGE:RESOLUTION MAX") multi.write("VOLTAGE:NPLC 10") multi.write("TRIG:SOUR IMM") # Need to do one reading to set up Wait-For-Trigger state! multi.ask("READ?") # Setting up output file logger.info("#Time(UnixTime) Voltage(V)") # Do logging until stopped by Ctrl-C