#This program goes through the .csv scope data and averages all of the pulses together# from string import * Name= raw_input("Enter a file name\n") print Name fin = open(Name+".csv","r") #defines the read file average = open(Name+"avg.csv","w") #defines the write file stats.write("Event \t Min \n") #writes header event = fin.readline() #reads the first row data = event.split(',') #splits and event into an array, to pick out single entry minimum = data[4] #Initializes the variable for the min of the pulse pointcount = 0 #Initializes the count of points within a pulse (500 points/pulse) pulsecount = 0 #Initializes the count of pulses in the file (2505 pulses/file) while True: if pointcount<499: minimum = min(data[4], minimum) pointcount = pointcount +1 event=fin.readline() data=event.split(',') if pointcount==499: pointcount=0 pulsecountasstring=str(pulsecount) minasstring=str(minimum) stats.write(pulsecountasstring + '\t' + minasstring) #at the end of a pulse, the min is readout event=fin.readline() pulsecount=pulsecount+1 data=event.split(',') minimum=data[4] if pulsecount==2505: break print "this may have worked?"