Home | Trees | Indices | Help |
---|
|
1 # PyVision License 2 # 3 # Copyright (c) 2006-2008 David S. Bolme 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 10 # 1. Redistributions of source code must retain the above copyright 11 # notice, this list of conditions and the following disclaimer. 12 # 13 # 2. Redistributions in binary form must reproduce the above copyright 14 # notice, this list of conditions and the following disclaimer in the 15 # documentation and/or other materials provided with the distribution. 16 # 17 # 3. Neither name of copyright holders nor the names of its contributors 18 # may be used to endorse or promote products derived from this software 19 # without specific prior written permission. 20 # 21 # 22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 26 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 ''' 34 Created on May 10, 2011 35 36 @author: bolme 37 38 Compute the union of two sigsets. 39 ''' 40 import pyvision as pv 41 import optparse 42 #import csv 43 #import os.path 44 4547 usage = "usage: %prog [options] <SIGSET_A.xml> <SIGSET_B.xml> <union.xml>\nReads in two sigsets and computes the union as output." 48 49 parser = optparse.OptionParser(usage) 50 #parser.add_option("-v", "--verbose", 51 # action="store_true", dest="verbose", 52 # help="Turn on more verbose output.") 53 (options, args) = parser.parse_args() 54 55 if len(args) < 3: 56 parser.error("This program requires two sigset arguments.") 57 58 return options, args59 60 61 62 if __name__ == '__main__': 63 # Parse command line arguments 64 options,args = parseOptions() 65 66 67 # Compute the set of recordings and subjects in A 68 both = [] 69 both_rec = set() 70 for arg in args[:-1]: 71 # Read sigsets 72 sigset = pv.parseSigSet(arg) 73 74 # Compute union 75 for row in sigset: 76 rec_id = row[1][0]['name'] 77 if rec_id in both_rec: 78 continue 79 both.append(row) 80 both_rec.add(rec_id) 81 82 pv.saveSigset(both, args[-1]) 83
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Apr 21 14:32:03 2015 | http://epydoc.sourceforge.net |