def main(argv): # parse input arguments parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', help="the input YAML configuration file") parser.add_argument('-s', '--serial', help="run in serial mode", action="store_true") args = parser.parse_args() batchStart = time.time() Logger.logPrint("Starting batchprocess: "+args.input) Logger.logPrint("Start time:"+timeStr(batchStart)) # load WormVideo to YAML configuration file with open(args.input, 'r') as f: wvs = wtc.loadWormVideos(f) # run analysis on regions if args.serial: for wv in wvs: wv.processRegions() else: wtp.batchProcessVideos(wvs) batchStop = time.time() Logger.logPrint("Start time:"+timeStr(batchStart)) Logger.logPrint("End time :"+timeStr(batchStop)) Logger.logPrint("Total time:"+timeStr(batchStop-batchStart)) return 'Success'
def main(argv): # parse input arguments parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', nargs='*', help="the input pickled WormVideo object(s)") args = parser.parse_args() if 'input' in args: inputFiles = parser.input if len(inputFiles) == 1: # check whether a directory was passed path, name = os.path.split(inputFiles) if name is None: inputFiles = possibleWormVideoFiles(path) else: # grab all .dat files from folder inputFiles = possibleWormVideoFiles() wormVideos = [] for inputFile in inputFiles: print 'Loading ' + inputFile # load WormVideo object try: with open(parser.input, 'rb') as f: wormVideos.append(cPickle.load(f)) except IOError as e: s = "I/O error({0}) while unpickling WormVideo: {1}" print s.format(e.errno, e.strerror) raise except Exception as e: # can't do anything, just report error and exit gracefully print('Failed to open or unpickle WormVideo object.' + ' Received error: ' + sys.exc_info()[0]) # run analysis on all worm videos wtp.batchProcessVideos(wormVideos) return 'Success'
def main(argv): # parse input arguments parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', nargs='*', help="the input pickled WormVideo object(s)") args = parser.parse_args() if 'input' in args: inputFiles = parser.input if len(inputFiles) == 1: # check whether a directory was passed path, name = os.path.split(inputFiles) if name is None: inputFiles = possibleWormVideoFiles(path) else: # grab all .dat files from folder inputFiles = possibleWormVideoFiles() wormVideos = [] for inputFile in inputFiles: print 'Loading ' + inputFile # load WormVideo object try: with open(parser.input, 'rb') as f: wormVideos.append(cPickle.load(f)) except IOError as e: s = "I/O error({0}) while unpickling WormVideo: {1}" print s.format(e.errno, e.strerror) raise except Exception as e: # can't do anything, just report error and exit gracefully print ('Failed to open or unpickle WormVideo object.' + ' Received error: ' + sys.exc_info()[0]) # run analysis on all worm videos wtp.batchProcessVideos(wormVideos) return 'Success'