for f in fileList[1:]: f = fileList[0]+'/'+f aviProps = va.getAVIinfo(f) if nfile==1: startFrame = va.time2frame(int(times[0]), aviProps) else: startFrame = va.time2frame(0, aviProps) if nfile==len(fileList[1:]): endFrame = va.time2frame(int(times[1]), aviProps) if endFrame>aviProps[6]: endFrame=aviProps[6] else: endFrame = aviProps[6] if mode=='local': framesPerCpu = np.ceil(float(endFrame-startFrame)) secPerCpu = va.frame2time(framesPerCpu, aviProps) else: framesPerCpu = np.ceil(float(endFrame-startFrame)/cpus) secPerCpu = va.frame2time(framesPerCpu, aviProps) #if secPerCpu < minCpuTime: # secPerCpu = minCpuTime # cpus = int(np.ceil((endFrame-startFrame)/float(va.time2frame(secPerCpu, aviProps)))) #print 'corrected cpus =', cpus if mode=='local': os.system('export SGE_TASK_ID=1') script = 'job.sh '+f+' '+activeDir+'/ '+str(startFrame)+' '+str(nfile)+' '+str(secPerCpu) else: #filename saveDir startFrame nfile ncall secPerCpu #script = 'qsub -t 1-'+str(cpus)+' -l node_type=m620+ -N job_1 -o /dev/null -e /dev/null job.sh '+f+' '+activeDir+'/ '+str(startFrame)+' '+str(nfile)+' '+str(secPerCpu) script = 'qsub -t 1-'+str(cpus)+' -N job_1 -o /dev/null -e /dev/null job.sh '+f+' '+activeDir+'/ '+str(startFrame)+' '+str(nfile)+' '+str(secPerCpu)
for f in fileList[1:]: f = fileList[0] + '/' + f aviProps = va.getAVIinfo(f) if nfile == 1: startFrame = va.time2frame(int(times[0]), aviProps) else: startFrame = va.time2frame(0, aviProps) if nfile == len(fileList[1:]): endFrame = va.time2frame(int(times[1]), aviProps) if endFrame > aviProps[6]: endFrame = aviProps[6] else: endFrame = aviProps[6] if mode == 'local': framesPerCpu = np.ceil(float(endFrame - startFrame)) secPerCpu = va.frame2time(framesPerCpu, aviProps) else: framesPerCpu = np.ceil(float(endFrame - startFrame) / cpus) secPerCpu = va.frame2time(framesPerCpu, aviProps) #if secPerCpu < minCpuTime: # secPerCpu = minCpuTime # cpus = int(np.ceil((endFrame-startFrame)/float(va.time2frame(secPerCpu, aviProps)))) #print 'corrected cpus =', cpus if mode == 'local': os.system('export SGE_TASK_ID=1') script = 'job.sh ' + f + ' ' + activeDir + '/ ' + str( startFrame) + ' ' + str(nfile) + ' ' + str(secPerCpu) else: #filename saveDir startFrame nfile ncall secPerCpu #script = 'qsub -t 1-'+str(cpus)+' -l node_type=m620+ -N job_1 -o /dev/null -e /dev/null job.sh '+f+' '+activeDir+'/ '+str(startFrame)+' '+str(nfile)+' '+str(secPerCpu)
nfile = '0' + nfile if len(ncall) == 1: ncall = '00' + ncall elif len(ncall) == 2: ncall = '0' + ncall secPerCpu = float(sys.argv[6]) nestThreshold = 10 aviProps = va.getAVIinfo(fname) print fname, aviProps fileName = va.getFileName(fname) trackFname = saveDir + 'file' + str(nfile) + '_' + ncall + '.txt' aviFname = saveDir + 'file' + str(nfile) + '_' + ncall + '.avi' bgSubFname = saveDir + 'file' + str(nfile) + '_' + ncall tStart = va.frame2time(startFrame, aviProps) + (int(ncall) - 1) * secPerCpu tEnd = tStart + secPerCpu print tStart, tEnd while True: try: print(saveDir + "bg.npy") bg = np.load(saveDir + "bg.npy") print("Background file loaded") except IOError: print("Cannot find background file ") break try: pmts = np.load(saveDir + "pmts.npy") print("Parameters file loaded") except IOError:
nfile='0'+nfile if len(ncall)==1: ncall='00'+ncall elif len(ncall)==2: ncall='0'+ncall secPerCpu = float(sys.argv[6]) nestThreshold = 10 aviProps = va.getAVIinfo(fname) print fname, aviProps fileName = va.getFileName(fname) trackFname = saveDir + 'file' + str(nfile) + '_' + ncall + '.txt' aviFname = saveDir + 'file' + str(nfile) + '_' + ncall + '.avi' bgSubFname = saveDir + 'file' + str(nfile) + '_' + ncall tStart = va.frame2time(startFrame, aviProps) + (int(ncall)-1)*secPerCpu tEnd = tStart + secPerCpu print tStart, tEnd while True: try: print(saveDir+"bg.npy") bg = np.load(saveDir + "bg.npy") print("Background file loaded") except IOError: print("Cannot find background file ") break try: pmts = np.load(saveDir + "pmts.npy") print("Parameters file loaded") except IOError: