if (libFBCAGen.compareFPs(fpCur.fP,fpNew.fP) == 1): #If similar, add to the list temp.append(fpNew) ignoreList.append(idx2) #In the future, ignore the similar one temp.append(fpCur) #Add this one too ignoreList.append(idx) #ignore this one in the future behaviours.append(temp) #Add this behaviour class to the behaviours list print(f"Sorted FPs for ({n},{m})") #Makes it easier on the eyes morphRecord=open(f"{quantifer}","w") # Records the behaviours in a file morphRecord.write(f"All behaviours in morph of sMs{sMs[n]}sMs{sMs[m]} \n") morphRecord.write(f"Behaviours go from black -> red -> orange -> yellow -> white \n") for behaviour in behaviours: morphRecord.write(f"Iso-behavioural grain similar to sM with lambda = {behaviour[0].lambd} \n") for behaviour in behaviours: if (libFBCAGen.useImages == 1): myEyes=str(round(behaviour[0].lambd,5)) libFBCAGen.genIm(behaviour[0].fPrint,libFBCAGen.numOfGens,d,f"{quantifer} {myEyes}") print(f"Generating Image for ({n},{m})") #Probably should comment this below imageColourStep=(255*3)/(len(behaviours)) im= Image.new('RGB', ((morphRes+1),imageHeight), 1) for idx,behaviour in enumerate(behaviours): colourVal=int(idx*imageColourStep) if (colourVal-255<0): r = colourVal g=0 b=0 else: r=255 colourVal-=255 if (colourVal-255<0): g = colourVal
float(protoScoreMatrix[5][0:(len(protoScoreMatrix[5]) - 1)])) scoreMatrix.append( float(protoScoreMatrix[6][0:(len(protoScoreMatrix[6]) - 1)])) scoreMatrix.append( float(protoScoreMatrix[7][0:(len(protoScoreMatrix[7]) - 2)])) #Ex: ['12.592848008753737', '-12.192848008754211', '-7.0071519912456495', '6.6071519912461225'] #Generate the FBCA CAMap = [] CAMap = libFBCAGen.copyOver(CAMapInit) gif = [] for n in range(numOfGens): if (useImages == 1): gif.append( libFBCAGen.genIm(CAMap, n, d, behaviourNum[1][:-1])) CAMap = libFBCAGen.updateMap(CAMap, scoreMatrix) if (useImages == 1): gif.append( libFBCAGen.genIm(CAMap, n, d, behaviourNum[1][:-1])) print("Finished " + str(behaviourNum[1][:-1])) if (useImages == 1): gif[0].save(d + str(behaviourNum[1][:-1]) + '.gif', save_all=True, append_images=gif[1:], optimize=False, duration=100, loop=0) print("Finished " + str(fileName))
import FBCAConsts import libFBCAGen exFBCA = FBCAConsts.Fbca() exFBCA.levelMap = libFBCAGen.initCA(exFBCA) libFBCAGen.genIm(exFBCA, quantifer="/genIm")
import FBCAConsts import libFBCAGen exFBCA = FBCAConsts.Fbca() exFBCA.scoreMatrix = [0,0.5,0.2,0.6] exFBCA.levelMap = libFBCAGen.initCA(exFBCA) totalNumOfGens = 5 for n in range(totalNumOfGens): libFBCAGen.genIm(exFBCA,gen = n, quantifer = "/updateMap") exFBCA.levelMap = libFBCAGen.updateMap(exFBCA)