return found, missing def parseOptions(): usage = "usage: %prog [options] <input.xml> <image_directory> <found.xml> [<missing.xml>]\nReads a sigset and removes any entries that cannot be associated with an image." parser = optparse.OptionParser(usage) #parser.add_option("-v", "--verbose", # action="store_true", dest="verbose", # help="Turn on more verbose output.") (options, args) = parser.parse_args() if len(args) not in [3, 4]: parser.error( "This program requires at least three arguments: an input sigest, an image directory, and an output sigset." ) return options, args if __name__ == '__main__': options, args = parseOptions() sigset = pv.parseSigSet(args[0]) imdir = args[1] found, missing = locateFiles(sigset, imdir) pv.saveSigset(found, args[2]) if len(args) >= 4: pv.saveSigset(missing, args[3])
if __name__ == '__main__': # Parse command line arguments options,args = parseOptions() # Compute the set of recordings and subjects in A both = [] both_rec = set() for arg in args[:-1]: # Read sigsets sigset = pv.parseSigSet(arg) # Compute union for row in sigset: rec_id = row[1][0]['name'] if rec_id in both_rec: continue both.append(row) both_rec.add(rec_id) pv.saveSigset(both, args[-1])
def parseOptions(): usage = "usage: %prog [options] <input.xml> <image_directory> <found.xml> [<missing.xml>]\nReads a sigset and removes any entries that cannot be associated with an image." parser = optparse.OptionParser(usage) #parser.add_option("-v", "--verbose", # action="store_true", dest="verbose", # help="Turn on more verbose output.") (options, args) = parser.parse_args() if len(args) not in [3,4]: parser.error("This program requires at least three arguments: an input sigest, an image directory, and an output sigset.") return options, args if __name__ == '__main__': options,args = parseOptions() sigset = pv.parseSigSet(args[0]) imdir = args[1] found,missing = locateFiles(sigset,imdir) pv.saveSigset(found, args[2]) if len(args) >= 4: pv.saveSigset(missing, args[3])
# action="store_true", dest="verbose", # help="Turn on more verbose output.") (options, args) = parser.parse_args() if len(args) < 3: parser.error("This program requires two sigset arguments.") return options, args if __name__ == '__main__': # Parse command line arguments options, args = parseOptions() # Compute the set of recordings and subjects in A both = [] both_rec = set() for arg in args[:-1]: # Read sigsets sigset = pv.parseSigSet(arg) # Compute union for row in sigset: rec_id = row[1][0]['name'] if rec_id in both_rec: continue both.append(row) both_rec.add(rec_id) pv.saveSigset(both, args[-1])