def test5(showme=1, findallmatches=1): domaingraph, domaincells, morseset, vertexmap, outedges, walldomains, varsaffectedatwall, varnames, threshnames = ( tc.test5() ) extendedmorsegraph, extendedmorsecells = pp.makeExtendedMorseSetDomainGraph( vertexmap, morseset, domaingraph, domaincells ) newoutedges, wallthresh, newwalldomains, booleanoutedges = pp.makeWallGraphFromDomainGraph( len(vertexmap), extendedmorsegraph, extendedmorsecells ) newvarsaffectedatwall = pp.varsAtWalls(threshnames, newwalldomains, wallthresh, varnames) wallinfo = makeWallInfo(newoutedges, newwalldomains, newvarsaffectedatwall) wallinfo = pp.truncateExtendedWallGraph(booleanoutedges, newoutedges, wallinfo) patternnames, patternmaxmin, originalpatterns = fp.parsePatterns() patterns = pp.translatePatterns(varnames, patternnames, patternmaxmin, cyclic=1) match = matchPattern(patterns[0][0], wallinfo, cyclic=1, findallmatches=findallmatches) if showme and findallmatches: print set(match) == set([(6, 0, 3, 4, 5, 10, 9, 8, 6), (7, 1, 0, 3, 4, 5, 10, 9, 7), (7, 2, 4, 5, 10, 9, 7)]) if showme and not findallmatches: print match[0] in [(6, 0, 3, 4, 5, 10, 9, 8, 6), (7, 1, 0, 3, 4, 5, 10, 9, 7), (7, 2, 4, 5, 10, 9, 7)] match = matchPattern(patterns[1][0], wallinfo, cyclic=1, findallmatches=findallmatches) if showme: print "None" in match
def test5(): domaingraph,domaincells,morseset,vertexmap,outedges,walldomains,varsaffectedatwall,varnames,threshnames=tc.test5() patternnames,patternmaxmin,originalpatterns=fp.parsePatterns() patterns=translatePatterns(varnames,patternnames,patternmaxmin,cyclic=1) print patterns==[[['mdd','umd','uum','Muu','dMu','ddM','mdd']],[['mdd','umd','Mud','dum','dMu','ddM','mdd']]]
def test5(): domaingraph, domaincells, morseset, vertexmap, outedges, walldomains, varsaffectedatwall, varnames, threshnames = tc.test5( ) extendedmorsegraph, extendedmorsecells = pp.makeExtendedMorseSetDomainGraph( vertexmap, morseset, domaingraph, domaincells) newoutedges, wallthresh, newwalldomains, booleanoutedges = pp.makeWallGraphFromDomainGraph( len(vertexmap), extendedmorsegraph, extendedmorsecells) print newwalldomains == walldomains + [(0.5, 2, 0.5), (1, 2.5, 0.5), (0.5, 2.5, 1), (1.5, 0.5, 1), (1, 0.5, 1.5), (1.5, 1, 1.5), (1.5, 1.5, 1), (1, 1.5, 1.5), (1.5, 2, 1.5)] print newoutedges == outedges + [(1, 2), (5, ), (9, ), (3, ), (6, ), (17, 18, 19), (4, ), (7, 8), (10, )] newvarsaffectedatwall = pp.varsAtWalls(threshnames, newwalldomains, wallthresh, varnames) print newvarsaffectedatwall[:11] == varsaffectedatwall wallinfo = wl.makeWallInfo(newoutedges, newwalldomains, newvarsaffectedatwall) wallinfo = pp.truncateExtendedWallGraph(booleanoutedges, newoutedges, wallinfo) print set(wallinfo.keys()) == set([(0, 3), (1, 0), (2, 4), (3, 4), (4, 5), (5, 10), (6, 0), (7, 1), (7, 2), (8, 6), (9, 7), (9, 8), (10, 9)]) print wallinfo[(0, 3)] == [(4, ('uud', ))] print wallinfo[(1, 0)] == [(3, ('umd', ))] print wallinfo[(2, 4)] == [(5, ('uum', ))] print wallinfo[(3, 4)] == [(5, ('uum', ))] print wallinfo[(4, 5)] == [(10, ('Muu', ))] print wallinfo[(5, 10)] == [(9, ('dMu', ))] print wallinfo[(6, 0)] == [(3, ('umd', ))] print wallinfo[(7, 1)] == [(0, ('udd', ))] print wallinfo[(7, 2)] == [(4, ('umd', ))] print wallinfo[(8, 6)] == [(0, ('mdd', ))] print set(wallinfo[(9, 7)]) == set([(1, ('mdd', )), (2, ('mdd', ))]) print set(wallinfo[(10, 9)]) == set([(7, ('ddM', )), (8, ('ddM', ))])
def test5(): domaingraph, domaincells, morseset, vertexmap, outedges, walldomains, varsaffectedatwall, varnames, threshnames = tc.test5( ) patternnames, patternmaxmin, originalpatterns = fp.parsePatterns() patterns = translatePatterns(varnames, patternnames, patternmaxmin, cyclic=1) print patterns == [[['mdd', 'umd', 'uum', 'Muu', 'dMu', 'ddM', 'mdd']], [['mdd', 'umd', 'Mud', 'dum', 'dMu', 'ddM', 'mdd']]]
def test5(): domaingraph,domaincells,morseset,vertexmap,outedges,walldomains,varsaffectedatwall,varnames,threshnames=tc.test5() extendedmorsegraph,extendedmorsecells=pp.makeExtendedMorseSetDomainGraph(vertexmap,morseset,domaingraph,domaincells) newoutedges,wallthresh,newwalldomains,booleanoutedges=pp.makeWallGraphFromDomainGraph(len(vertexmap),extendedmorsegraph, extendedmorsecells) print newwalldomains==walldomains+[(0.5,2,0.5),(1,2.5,0.5),(0.5,2.5,1),(1.5,0.5,1),(1,0.5,1.5),(1.5,1,1.5),(1.5,1.5,1),(1,1.5,1.5),(1.5,2,1.5)] print newoutedges==outedges+[(1, 2), (5,), (9,), (3,), (6,), (17, 18, 19), (4,), (7, 8), (10,)] newvarsaffectedatwall=pp.varsAtWalls(threshnames,newwalldomains,wallthresh,varnames) print newvarsaffectedatwall[:11]==varsaffectedatwall wallinfo = wl.makeWallInfo(newoutedges,newwalldomains,newvarsaffectedatwall) wallinfo = pp.truncateExtendedWallGraph(booleanoutedges,newoutedges,wallinfo) print set(wallinfo.keys())==set([(0,3),(1,0),(2,4),(3,4),(4,5),(5,10),(6,0),(7,1),(7,2),(8,6),(9,7),(9,8),(10,9)]) print wallinfo[(0,3)]==[(4,('uud',))] print wallinfo[(1,0)]==[(3,('umd',))] print wallinfo[(2,4)]==[(5,('uum',))] print wallinfo[(3,4)]==[(5,('uum',))] print wallinfo[(4,5)]==[(10,('Muu',))] print wallinfo[(5,10)]==[(9,('dMu',))] print wallinfo[(6,0)]==[(3,('umd',))] print wallinfo[(7,1)]==[(0,('udd',))] print wallinfo[(7,2)]==[(4,('umd',))] print wallinfo[(8,6)]==[(0,('mdd',))] print set(wallinfo[(9,7)])==set([(1,('mdd',)),(2,('mdd',))]) print set(wallinfo[(10,9)])==set([(7,('ddM',)),(8,('ddM',))])
def test5(showme=1, findallmatches=1): domaingraph, domaincells, morseset, vertexmap, outedges, walldomains, varsaffectedatwall, varnames, threshnames = tc.test5( ) extendedmorsegraph, extendedmorsecells = pp.makeExtendedMorseSetDomainGraph( vertexmap, morseset, domaingraph, domaincells) newoutedges, wallthresh, newwalldomains, booleanoutedges = pp.makeWallGraphFromDomainGraph( len(vertexmap), extendedmorsegraph, extendedmorsecells) newvarsaffectedatwall = pp.varsAtWalls(threshnames, newwalldomains, wallthresh, varnames) wallinfo = makeWallInfo(newoutedges, newwalldomains, newvarsaffectedatwall) wallinfo = pp.truncateExtendedWallGraph(booleanoutedges, newoutedges, wallinfo) patternnames, patternmaxmin, originalpatterns = fp.parsePatterns() patterns = pp.translatePatterns(varnames, patternnames, patternmaxmin, cyclic=1) match = matchPattern(patterns[0][0], wallinfo, cyclic=1, findallmatches=findallmatches) if showme and findallmatches: print set(match) == set([(6, 0, 3, 4, 5, 10, 9, 8, 6), (7, 1, 0, 3, 4, 5, 10, 9, 7), (7, 2, 4, 5, 10, 9, 7)]) if showme and not findallmatches: print match[0] in [(6, 0, 3, 4, 5, 10, 9, 8, 6), (7, 1, 0, 3, 4, 5, 10, 9, 7), (7, 2, 4, 5, 10, 9, 7)] match = matchPattern(patterns[1][0], wallinfo, cyclic=1, findallmatches=findallmatches) if showme: print 'None' in match