#!/apps/python/PRO/bin/python import sys, getopt, os opts, args = getopt.getopt(sys.argv[1:],"v:V:p:P:") loc = 'ver2' paddle = 18 for opt,arg in opts: if opt in ("-V","-v"): loc = arg if opt in ("-P","-p"): paddle = int(arg) files = [] for f in os.listdir(loc): if f.endswith(".dat"): files.append(f) files.sort() rate1 = [] rate2 = [] drate1 = [] drate2 = [] RUN = [] for f in files: r = f[21:27] RUN.append(int(r)) fnam = loc+'/'+f inf = open(fnam,'r') line = inf.readline() lis = line.split() #print lis[0] notfound = 1 while (notfound): line = inf.readline() lis = line.split() pad = int(lis[0]) if pad == paddle: rate1.append(float(lis[1])) rate2.append(float(lis[3])) drate1.append(float(lis[2])) drate2.append(float(lis[4])) notfound = 0 of = open('rate.dat','w') for k in range(0,len(RUN)): if str(rate1[k]) != 'nan' and str(rate2[k]) != 'nan' : str1 = str(RUN[k])+' '+str(rate1[k])+' '+str(drate1[k])+' '+str(rate2[k])+' '+str(drate2[k])+'\n' of.write(str1) of.close()