From 4f8c98854c8f507ae1b1b7e1b0875d1efbad0c2a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Sat, 23 Jul 2011 21:28:52 +0800 Subject: add main to estimate.py --- estimate.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) mode change 100644 => 100755 estimate.py (limited to 'estimate.py') diff --git a/estimate.py b/estimate.py old mode 100644 new mode 100755 index 6ba0471..3ca48db --- a/estimate.py +++ b/estimate.py @@ -59,7 +59,10 @@ def walkThroughModels(path): for onefile in files: filepath = os.path.join(root, onefile) if onefile.endswith(config.getModelPostfix()): + subpath = os.path.relpath(filepath, path) + print("Processing " + subpath) handleOneModel(filepath) + print("Processed " + subpath) elif onefile.endswith(config.getStatusPostfix()): pass elif onefile.endswith(config.getIndexPostfix()): @@ -134,4 +137,20 @@ def sortModels(indexname, sortedindexname): utils.store_status(sortedindexfilestatuspath, sortedindexfilestatus) if __name__ == '__main__': - pass + parser = ArgumentParser(description='Estimate model candidates.') + parser.add_argument('--modeldir', action='store', \ + help='model directory', \ + default=config.getModelDir()) + + args = parser.parse_args() + print(args) + print("estimating") + walkThroughModels(args.modeldir) + print("gathering") + indexname = os.path.join(args.modeldir, config.getEstimateIndex()) + gatherModels(args.modeldir, indexname) + print("sorting") + sortedindexname = os.path.join(args.modeldir, \ + config.getSortedEstimateIndex()) + sortModels(indexname, sortedindexname) + print("done") -- cgit