### sends a continuous pulse from core import tellie_server from common import parameters import scope_connections import scopes import utils import sys import time from common import parameters as p port = p._serial_port # set in tellie.cfg usb_conn = scope_connections.VisaUSB() scope = scopes.Tektronix3000(usb_conn) sc = tellie_server.SerialCommand(port) sc.stop() def safe_exit(sc,e): print "Exit safely" print e sc.stop() if __name__=="__main__": #first, read the offsets file fin = file('delays.txt','r') delay_values = {} for line in fin.readlines(): bits = line.split() if len(bits)!=2:
#Fixed parameters delay = 1.0 # 1ms -> kHz cursor_low = -5e-9 #s cursor_high = 23e-9 # s trigger_level = 0.5 # half peak minimum falling_edge = True min_trigger = -0.005 # -5mV smallest allowed trigger #run the initial setup on the scope usb_conn = scope_connections.VisaUSB() scope = scopes.Tektronix3000(usb_conn) scope.set_cursor("x", 1, cursor_low) scope.set_cursor("x", 2, cursor_high) sc = tellie_server.SerialCommand(options.port) # Channel parameters height = p._max_pulse_height fibre_delay = 0 trigger_delay = 0 pulse_number = p._pulse_num delay = 1 channel = options.channel width = options.width timestamp = time.strftime("%y%m%d_%H.%M.%S", time.gmtime()) output_filename = "light/Channel%d_Width%d_%s.dat" % (channel, width, timestamp) output_file = file(output_filename, 'w') output_file.write("#PTIME\tWIDTH\tPIN\tWIDTH\tRISE\tFALL\tAREA\n")
light_cmd,_ = tellie_server.command_pulse_width(light_width) send_command(tellie_serial,light_cmd) time.sleep(p._short_pause) # Check whether these sleeps are required ... ARGH! light_cmd,_ = tellie_server.command_pulse_number(light_num) send_command(tellie_serial,light_cmd) time.sleep(p._short_pause) # Check whether these sleeps are required ... ARGH! send_command(tellie_serial,tellie_server._cmd_fire_series) #one pulse, then stop? sleep 0.1 s just to be sure time.sleep(p._short_pause) print time.time()-start,"SEQUENCE COMPLETE" if __name__=="__main__": parser = optparse.OptionParser() parser.add_option("-d",dest="debug",action="store_true",default=False,help="Debug mode") (options, args) = parser.parse_args() tellie_serial = tellie_server.SerialCommand() # create a logging object logger = tellie_logger.TellieLogger.get_instance() logger.set_debug_mode(options.debug) # select the dark pulse rates delay = 1./rate # setup the board settings used for all pulsing print "ANYTHING?",tellie_serial.read_buffer() tellie_serial.select_channel(channel) tellie_serial.set_pulse_height(height) tellie_serial.set_pulse_delay(delay) try: start = time.time() for i in range(light_shots):
def start(): global sc sc = tellie_server.SerialCommand(serial_port)