예제 #1
0
libFBCAGen.useImages=1 #generate gifs? 
for n in range(0,len(sMs)):
    libFBCAGen.generateFBCA(sMs[n],d,CAMapInit,str(n)) #Generate the final L_g
libFBCAGen.finalImage=0 #generate final level map?
libFBCAGen.useImages=0 #generate gifs? 


# Then lets generate their morphs
for n in range(0,len(sMs)-1): #Incase we have multiple matrices we want to morph between
    for m in range(n+1,len(sMs)):
        behaviours=[]
        fPs=[]
        quantifer = f"fMorph ({n},{m}) - {quantiferRead}"
        l=0
        for x in numpy.arange(0,1+1e-8,float(1/morphRes)): #In this loop we generate all the L_gs for the morph
            sMCur = libFBCAGen.genMorphSM(sMs[n],sMs[m],x) #gets score matrix for this point in the morph
            fPs.append(fPrint())
            fPs[len(fPs)-1].fP = libFBCAGen.genFingerPrint(sMCur) #gets the FP
            fPs[len(fPs)-1].lambd = x #Remembers the lambda used
            fPs[len(fPs)-1].xSpot = l #Remembers the column of pixels we are
            l+=1
        print(f"FPed morph ({n},{m})")
        # compares fingerprints
        ignoreList=[]
        for idx,fpCur in enumerate(fPs): #Sorts each L_g into behaviour groups
            temp=[] #This will hold all the similar L_gs
            ignore=0 
            for val in ignoreList: #Makes sure I shouldnt ignore it 
                if val == idx:
                    ignore=1            
            if ignore == 0: #If were NOT supposed to ignore it 
예제 #2
0
d = os.getcwd() + "/"
curSide = ["Left", "Right", "Middle"]
CAMapInit = []
CAMapInit = libFBCAGen.initCA(CAMapInit)
borderLambdas = []

## MAIN ##
# Generates the inital L_g containers
lGLeft = lGContainer(0, sM1,
                     libFBCAGen.generateFBCA(sM1, d, CAMapInit, curSide[0]),
                     curSide[0])
lGRight = lGContainer(1, sM2,
                      libFBCAGen.generateFBCA(sM2, d, CAMapInit, curSide[1]),
                      curSide[1])
lGMid = lGContainer(
    0.5, libFBCAGen.genMorphSM(sM1, sM2, 0.5),
    libFBCAGen.generateFBCA(libFBCAGen.genMorphSM(sM1, sM2, 0.5), d, CAMapInit,
                            curSide[2]), curSide[2])

direction = 0
lastDifferentLambda = 0
##Goes left to right
for n in range(0, len(sMs)):  # because we may have many
    if n % 2 == 0:
        while (libFBCAGen.compareLs(lGRight, lGLeft) == 0):
            if (libFBCAGen.compareLs(lGLeft, lGMid) == 1):
                ##Get lambdas Left -> Mid  and new Mid
                lGLeft = lGContainer(lGMid.lambd,
                                     libFBCAGen.copyList(lGMid.sM),
                                     libFBCAGen.copyOver(lGMid.lG), curSide[0])
                lGMid.lambd = getMid(lGLeft.lambd, lGRight.lambd)
예제 #3
0
libFBCAGen.CALength = 20  #Length of the generated image (for min use 5)
libFBCAGen.CAWidth = 20  #Width of the generated image (for min use 4)
libFBCAGen.useImages = 1  #checks if you want images This is annoying
libFBCAGen.numOfGens = 20  #number of generations
libFBCAGen.numOfStates = 2  #number of states (good until 10)
smallDelta = 1e-6
CAMapInit = []
borderLambdas = []
CAMapInit = libFBCAGen.initCA(CAMapInit)

##START
edgeRecord = open("morphEdges", "r")
#loops through files
for line in edgeRecord:
    splits = []
    sM1 = []
    sM2 = []
    lambdas = []
    levelMap = []
    splits = line.split("sMs")
    lambdas = convTextListToList(splits[0])
    sM1 = convTextListToList(splits[1])
    sM2 = convTextListToList(splits[2])
    for lamb in lambdas:
        sMCur = libFBCAGen.genMorphSM(sM1, sM2, lamb + smallDelta)
        levelMap = libFBCAGen.generateFBCA(sMCur, d, CAMapInit,
                                           str(lamb + smallDelta))
        sMCur = libFBCAGen.genMorphSM(sM1, sM2, lamb - smallDelta)
        levelMap = libFBCAGen.generateFBCA(sMCur, d, CAMapInit,
                                           str(lamb - smallDelta))
d = os.getcwd() + "/"
#defintions for FBCA generation
libFBCAGen.CALength = 20  #Length of the generated image (for min use 5)
libFBCAGen.CAWidth = 20  #Width of the generated image (for min use 4)
libFBCAGen.useImages = 1  #checks if you want images This is annoying
libFBCAGen.numOfGens = 20  #number of generations
libFBCAGen.numOfStates = 2  #number of states (good until 10)
CAMapInit = []
borderLambdas = []
CAMapInit = libFBCAGen.initCA(CAMapInit)

##START
morphRecord = open("morphPortrait record Two at 1000 rand(4)", "r")
#loops through files
sM1 = []
sM2 = []
lambdas = []
levelMap = []
splits = []
for idx, line in enumerate(morphRecord):
    if idx == 0:
        splits = line.split("sMs")
        sM1 = convTextListToList(splits[1])
        sM2 = convTextListToList(splits[2])
    else:
        splits = line.split(" ")
        lambdas.append(float(splits[len(splits) - 2]))
for lamb in lambdas:
    sMCur = libFBCAGen.genMorphSM(sM1, sM2, lamb)
    levelMap = libFBCAGen.generateFBCA(sMCur, d, CAMapInit, str(lamb))