########################################### scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) # shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) # scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length - 50, half_length + 50) scope.lock() scope.begin() # Acquires the pre-amble! # Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) sweep.check_dir("10Hz/low_intensity") saveDir = sweep.check_dir("10Hz/low_intensity/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_IPWlow_%s.dat" % (saveDir, channel, timestamp) # results = utils.PickleFile(output_filename, 1) output_file = file(output_filename, "w") output_file.write( "#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n" ) # Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None loopStart = time.time()
scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length-50, half_length+50) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M",time.gmtime()) sweep.check_dir('./April_20/low_intensity') saveDir = sweep.check_dir("./April_20/low_intensity/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_IPWlow_%s.dat" % (saveDir,channel,timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename,'w') output_file.write("#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n") #Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None loopStart = time.time() if tmpResults!=None: #set a best guess for the trigger and the scale
scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length - 80, half_length + 20) scope.set_edge_trigger(-0.5 * y_div_units, scope_chan, falling=True) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) saveDir = sweep.check_dir("10Hz/broad_sweep/Box_%02d/" % (box)) sweep.check_dir("%sraw_data/" % saveDir) output_filename = "%s/Chan%02d_IPWbroad_%s.dat" % (saveDir, channel, timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename, 'w') output_file.write( "#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n" ) #Start scanning! #widths = range(0,9000,step) widths = range(0, 10000, step) tmpResults = None
scope.set_active_channel(1) scope.set_active_channel(4) scope.set_data_mode(half_length-1500, half_length+900) scope.set_edge_trigger(trigger_level, 4 , falling=False) # Rising edge trigger y_offset = [-2.5*y_div_units[0],1.0] for i in range(len(scope_channels)): scope.set_channel_y(scope_channels[i], y_div_units[i], pos=2.5) scope.set_display_y(scope_channels[i], y_div_units[i], offset=y_offset[i]) scope.set_channel_termination(scope_channels[i], termination[i]) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M",time.gmtime()) sweep.check_dir('./timingCalibration') saveDir = sweep.check_dir("./timingCalibration/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_timing_%s.dat" % (saveDir,channel,timestamp) image_filename = "%s/Chan%02d_timing_%s.png" % (saveDir,channel,timestamp) jitterVals = [] jitterErrs = [] output_file = file(output_filename,'w') output_file.write("Width Jitter Error\n") #Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None loopStart = time.time() if tmpResults!=None:
x_offset = +2*x_div_units # offset in x (2 divisions to the left) record_length = 100e3 # trace is 1e3 samples long half_length = record_length / 2 # For selecting region about trigger point ########################################### scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length-50, half_length+50) scope.lock() scope.begin() # Acquires the pre-amble! #File system stuff saveDir = sweep.check_dir("data/scope_data_%1.2fV/" % float(options.voltage)) sweep.check_dir("%sraw_data/" % saveDir) output_filename = "%s/Chan%02d_%1.2fV.dat" % (saveDir,channel,float(options.voltage)) output_file = file(output_filename,'w') output_file.write("#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\t\ FALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n") flag, tmpResults, min_volt = 0, None, None run_start = time.time() for width in widths: loop_start = time.time() if tmpResults!=None: #set a best guess for the trigger and the scale #using the last sweeps value min_volt = float(tmpResults["peak"])
scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length-80, half_length+20) scope.set_edge_trigger(-0.5*y_div_units, scope_chan, falling=True) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M",time.gmtime()) saveDir = sweep.check_dir("10Hz/broad_sweep/Box_%02d/" % (box)) sweep.check_dir("%sraw_data/" % saveDir) output_filename = "%s/Chan%02d_IPWbroad_%s.dat" % (saveDir,channel,timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename,'w') output_file.write("#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n") #Start scanning! #widths = range(0,9000,step) widths = range(0,10000,step) tmpResults = None t_start = time.time() for width in widths: min_volt = None
########################################### scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length - 50, half_length + 50) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) sweep.check_dir('./April_20/low_intensity') saveDir = sweep.check_dir("./April_20/low_intensity/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_IPWlow_%s.dat" % (saveDir, channel, timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename, 'w') output_file.write( "#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n" ) #Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None
scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length - 80, half_length + 20) scope.set_edge_trigger(-0.5 * y_div_units, scope_chan, falling=True) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) saveDir = sweep.check_dir("./April_19/broad_sweep/") saveDir = sweep.check_dir("./April_19/broad_sweep/Box_%02d/" % (box)) sweep.check_dir("%sraw_data/" % saveDir) output_filename = "%s/Chan%02d_IPWbroad_%s.dat" % (saveDir, channel, timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename, 'w') output_file.write( "#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n" ) #Start scanning! #widths = range(0,9000,step) widths = range(0, 10000, step) tmpResults = None
scope.set_edge_trigger(trigger_level, 4, falling=False) # Rising edge trigger y_offset = [-2.5 * y_div_units[0], 1.0] for i in range(len(scope_channels)): scope.set_channel_y(scope_channels[i], y_div_units[i], pos=2.5) scope.set_display_y(scope_channels[i], y_div_units[i], offset=y_offset[i]) scope.set_channel_termination(scope_channels[i], termination[i]) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) sweep.check_dir('./timingCalibration') saveDir = sweep.check_dir("./timingCalibration/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_timing_%s.dat" % (saveDir, channel, timestamp) image_filename = "%s/Chan%02d_timing_%s.png" % (saveDir, channel, timestamp) jitterVals = [] jitterErrs = [] output_file = file(output_filename, 'w') output_file.write("Width Jitter Error\n") #Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None
########################################### scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length - 50, half_length + 50) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M", time.gmtime()) sweep.check_dir('10Hz/low_intensity') saveDir = sweep.check_dir("10Hz/low_intensity/Box_%02d/" % (box)) output_filename = "%s/Chan%02d_IPWlow_%s.dat" % (saveDir, channel, timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename, 'w') output_file.write( "#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n" ) #Start scanning! tmpResults = None t_start = time.time() for width in widths: min_volt = None
scope.unlock() scope.set_horizontal_scale(x_div_units) scope.set_horizontal_delay(x_offset) #shift to the left 2 units scope.set_channel_y(scope_chan, y_div_units, pos=2.5) #scope.set_display_y(scope_chan, y_div_units, offset=y_offset) scope.set_channel_termination(scope_chan, termination) scope.set_single_acquisition() # Single signal acquisition mode scope.set_record_length(record_length) scope.set_data_mode(half_length-80, half_length+20) scope.set_edge_trigger(-0.5*y_div_units, scope_chan, falling=True) scope.lock() scope.begin() # Acquires the pre-amble! #Create a new, timestamped, summary file timestamp = time.strftime("%y%m%d_%H.%M",time.gmtime()) saveDir = sweep.check_dir("./April_19/broad_sweep/") saveDir = sweep.check_dir("./April_19/broad_sweep/Box_%02d/" % (box)) sweep.check_dir("%sraw_data/" % saveDir) output_filename = "%s/Chan%02d_IPWbroad_%s.dat" % (saveDir,channel,timestamp) #results = utils.PickleFile(output_filename, 1) output_file = file(output_filename,'w') output_file.write("#PWIDTH\tPWIDTH Error\tPIN\tPIN Error\tWIDTH\tWIDTH Error\tRISE\tRISE Error\tFALL\tFALL Error\tAREA\tAREA Error\tMinimum\tMinimum Error\n") #Start scanning! #widths = range(0,9000,step) widths = range(0,10000,step) tmpResults = None t_start = time.time() for width in widths: