コード例 #1
0
def getRadialOrthoradialDict(cell,targetid, large = False):
	primordiafacelist= sf.getSeparatePrimordiaBoundaryFaceList(cell, targetid, large=large)
	orthoradialDict = {}
	radialDict = {}
	targetface = sf.getFace(cell,targetid)
	targetcentroid = np.array([targetface.getXCentralised(), targetface.getYCentralised(),targetface.getZCentralised()])
	############################################################
	for listiter in range(len(primordiafacelist)):
		facelist = primordiafacelist[listiter]
		########################################################
		for count in range(len(facelist)):
			face = facelist[count]
			#nextface = facelist[(count+1)%len(facelist)]
			normal = face.getNormal()
			normalvec = np.array([qd.doublearray_getitem(normal,0),
							qd.doublearray_getitem(normal,1),
							qd.doublearray_getitem(normal,2)])
			########################################################
			facecentroid = np.array([face.getXCentralised(), face.getYCentralised(),face.getZCentralised()])
			#Calculating direction Vector to primordia centroid
			direcvec = np.subtract(targetcentroid,facecentroid)
			direcvec = direcvec/np.linalg.norm(direcvec)
			#Radial Vec to on-plane unitvector
			radialvec = direcvec - normalvec*(np.dot(direcvec,normalvec))
			radialvec = radialvec/np.linalg.norm(radialvec)
			########################################################
			crossvec = np.cross(radialvec,normalvec)
			crossvec = crossvec/np.linalg.norm(crossvec)
			orthoradialDict[face.getID()] = crossvec
			radialDict[face.getID()]= radialvec
	return radialDict,orthoradialDict
コード例 #2
0
def getPrimordiaHeight(cell, targetid):
	###################################################################
	def addMeanVertex(vertex,meanx,meany,meanz):
		meanx += vertex.getXcoordinate()
		meany += vertex.getYcoordinate()
		meanz += vertex.getZcoordinate()
		return meanx,meany,meanz
	########################################################################
	# Getting the primordial boundary
	########################################################################
	facetarget = sf.getFace(cell, targetid)
	##########################################
	# Vertex on primordial boundary
	##########################################
	vertexList = sf.getPrimordiaBoundaryVertexList(cell, targetid)
	vertexNum = len(vertexList)
	####################################################
	# Calculation of primordial height starts here
	# This is for smaller primordia
	####################################################
	meanx = 0.
	meany = 0.
	meanz = 0.
	for vert in vertexList:#while edge.Dest().getID() != targetedge.Dest().getID():
		meanx,meany,meanz = addMeanVertex(vert,meanx,meany,meanz)
	######################################
	targetx = facetarget.getXCentralised()
	targety = facetarget.getYCentralised()
	targetz = facetarget.getZCentralised()
	meanx /= vertexNum
	meany /= vertexNum
	meanz /= vertexNum
	height = np.sqrt((meanx-targetx)**2+(meany-targety)**2+(meanz-targetz)**2)
	######################################
	return height
コード例 #3
0
def getGrowthRatio(numOfLayer, targetid, endStep, startStep=1, stepsize=5):
    if not os.path.isfile("qdObject_step=001.obj"):
        return [0., 0., 0., 0., 0., 0., 0., 0., 0.]
    cell = sf.loadCellFromFile(1)
    ########################################################################
    meanprimordiaArray = []
    meanrestArray = []
    timeArray = []
    ########################################################################
    fitlen = 50
    finalstep = startStep + stepsize * fitlen
    for step in range(startStep, finalstep, stepsize):
        ########################################################################
        if not os.path.isfile(
                "qdObject_step=%03d.obj" % step):  #check if file exists
            break
        cell = sf.loadCellFromFile(step)
        ################################################
        primordiafacelist = sf.getPrimordiaFaces(cell, targetid, large=False)
        primordiaarea = 0.
        for face in primordiafacelist:
            primordiaarea += face.getAreaOfFace()
        ################################################
        tissueSurfaceArea = sf.getSurfaceArea(cell)
        ################################################
        primordialface = sf.getFace(cell, targetid)
        restoftissuearea = tissueSurfaceArea - primordiaarea
        ################################################
        numOfPrimordialcell = len(primordiafacelist)
        numOfrestofcell = cell.countFaces() - 1 - numOfPrimordialcell
        ################################################
        meanprimordiafacearea = primordiaarea / numOfPrimordialcell
        meanrestoftissuefacearea = restoftissuearea / (numOfrestofcell)
        ################################################
        meanprimordiaArray.append(meanprimordiafacearea)
        meanrestArray.append(meanrestoftissuefacearea)
        timeArray.append(step - 1)
        ################################################
    logfastarea = np.log(meanprimordiaArray)
    logslowarea = np.log(meanrestArray)
    ################################################
    fastareafit, m = sop.curve_fit(
        fitLinFunc,
        timeArray[:fitlen],
        logfastarea[:fitlen],
        bounds=([-np.inf,
                 logfastarea[0] - 0.000001], [+np.inf, logfastarea[0]]))
    slowareafit, m = sop.curve_fit(
        fitLinFunc,
        timeArray[:fitlen],
        logslowarea[:fitlen],
        bounds=([-np.inf,
                 logslowarea[0] - 0.000001], [+np.inf, logslowarea[0]]))
    ################################################
    return fastareafit[0] / slowareafit[0]
コード例 #4
0
def plotFeedbackCorrection(targetid, targetsurfacearea,endStep = 2000, 
	startStep=1,stepsize= 20,maxarea = None, areastep = 10,resetids = False,
	saveName = None):
	import numpy as np
	import matplotlib.pyplot as plt
	import os
	########################################################################
	# faceidarray for Primordia
	if not os.path.isfile("qdObject_step=001.obj"):
		return [0.,0.,0.,0.,0.,0.,0.,0.,0.]
	########################################################################
	# getting the time step for computation
	########################################################################
	step,tissueSurfaceArea = sf.getTimeStep(targetsurfacearea, endStep, startStep, stepsize = stepsize,resetids = resetids)
	#######################################################################
	# Starting the Calculation
	#######################################################################
	cell = sf.loadCellFromFile(step,resetids = resetids)#loading cell
	#######################################################################
	targetface = sf.getFace(cell, targetid)#getting top priomrdial face
	cell.calculateStressStrain()#calculating stress and strain
	cell.setRadialOrthoradialVector(targetface)#setting the rad/orthorad vectors
	#######################################################################
	# calculating the rad/orthorad Component of Correction terms
	#######################################################################
	cell.setRadialOrthoradialFeedbackCorrection()
	cell.setRadialOrthoradialStress()
	cell.setPrincipalDeformationVector()
	cell.setPrincipalDeformationFeedbackCorrection()
	#######################################################################
	# Plotting
	#######################################################################
	sf.plotRadialOrthoradialFeedbackCorrectionSurface(cell, numOfLayer,
		azim = -60, elev = 60,
		name =saveName+"_feedbackcorrection_radialOrthoradial")
	sf.plotTracePrincipalDeformationFeedbackCorrectionSurface(cell,numOfLayer,
		azim = -60, elev = 60,
		name =saveName+"_feedbackcorrection_trace")
	sf.plotPrincipalDeformationFeedbackCorrectionSurface(cell, numOfLayer,
		azim = -60, elev = 60,
		name =saveName+"_feedbackcorrection_principalDeformation")
	sf.plotStressSurface(cell, numOfLayer,
		azim = -60, elev = 60,
		name =saveName+"_stressSurface_principal")

	return
コード例 #5
0
def calculatePrimiordiaHeight(cell,targetid,large = False):
	# getting the vertexlist of primiordia boundary
	vertexlist = sf.getPrimordiaBoundaryVertexList(cell,targetid)#, large = large)
	vertexNum = len(vertexlist)
	meanx, meany, meanz = 0.,0.,0.
	for vertex in vertexlist:
		meanx += vertex.getXcoordinate()
		meany += vertex.getYcoordinate()
		meanz += vertex.getZcoordinate()
	meanx /= vertexNum
	meany /= vertexNum
	meanz /= vertexNum
	##########################################################################
	facetarget = sf.getFace(cell,targetid)
	#####################################
	targetx = facetarget.getXCentralised()
	targety = facetarget.getYCentralised()
	targetz = facetarget.getZCentralised()
	#####################################
	height = np.sqrt((meanx-targetx)**2+(meany-targety)**2+(meanz-targetz)**2)
	#####################################
	return height
コード例 #6
0
def plotGrowthDirection(cell, diffmatrix, plotdiff,step,targetface, azim = -60, elev = 30, saveDirectory = None):
	# Iterating over Face
	# getting neighbourhood of fast groing cell
	######### Color Map ####################################
	import matplotlib.colors as colors
	import matplotlib.cm as cmx
	jet = cm = plt.get_cmap('viridis') 
	maxvalue = 1.#np.pi/2
	minvalue = 0.#-1.*np.pi
	cNorm  = colors.Normalize(vmin=minvalue, vmax=maxvalue)
	scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)
	########################################################
	faceidarray = getNeighbourFaces(cell,targetface)
	primordialface = sf.getFace(cell,targetface)
	px = primordialface.getXCentralised()
	py = primordialface.getYCentralised()
	pz = primordialface.getZCentralised()
	plotdiff.scatter(px,py,pz,marker='*', c= 'm',s = 30)
	faces = qd.CellFaceIterator(cell)
	face = faces.next()
	while face != None:
		if face.getID() == 1: 
			face = faces.next()
			continue
		faceid = face.getID()
		if faceid in faceidarray:
			c = 'g'
			lw = 3
			zoomfactor = 1
		else:
			c = 'k'
			lw = 1.5
			zoomfactor = 1
		#######################################################
		# Calculation of eigen vecs 
		#######################################################
		facediffmatrix = diffmatrix[face.getID()]
		#########################################
		#Getting points to plot ellipse
		ellipsepoints = getMatrixDifferenceEllipsePoints(cell,face.getID(),facediffmatrix,primordialfaceid = targetface,zoomfactor = zoomfactor)
		###############################
		eigvec, eigval, u = np.linalg.svd(facediffmatrix)
		eigval = np.divide(eigval,np.max(eigval))
		eigval = 10*eigval
		#######################################################
		# Getting the unit matrix for transformation
		#######################################################
		unitx = face.getUnitx()
		unity = face.getUnity()
		unitz = face.getUnitz()
		transformMatrix = np.transpose(np.matrix(
							[[qd.doublearray_getitem(unitx,0),qd.doublearray_getitem(unitx,1),qd.doublearray_getitem(unitx,2)],
							 [qd.doublearray_getitem(unity,0),qd.doublearray_getitem(unity,1),qd.doublearray_getitem(unity,2)],
							 [qd.doublearray_getitem(unitz,0),qd.doublearray_getitem(unitz,1),qd.doublearray_getitem(unitz,2)]]))
		#################################
		#print "#################################"
		#print eigvec
		eigvec = np.matrix(np.vstack((eigvec.T, [0,0])))
		#print eigvec
		eigvec = np.matmul(transformMatrix,eigvec).T
		#print eigvec
		#print transformMatrix
		#################################
		# Now plotting the eigenvecs
		#################################
		xmean = face.getXCentralised()
		ymean = face.getYCentralised()
		zmean = face.getZCentralised()
		plotdiff.scatter(xmean,ymean,zmean,marker='*', c= 'b',s = 30)
		################################################################################################
		# Plotting the angle between the radial and primary direction
		################################################################################################
		################################################################################################
		# Getting the angle for between radial and primary growth direction
		################################################################################################
		#print px, py, pz
		############################################################
		radialvec = np.array([px-xmean,py-ymean,pz-zmean])
		try:
			radialvec /= np.linalg.norm(radialvec)
		except RuntimeWarning:
			print px, py, pz
			print xmean, ymean, zmean
			radialvec = np.array([0.,0.,0.])
		primaryvec = np.array([eigvec[0,0],eigvec[0,1],eigvec[0,2]])
		primaryvec /= np.linalg.norm(primaryvec)
		############################################################
		# angle : here it means dot product
		############################################################
		angle= np.abs(np.dot(radialvec,primaryvec))
		#print px, py, pz, xmean, ymean, zmean, "radialvec ", radialvec
		#print "="*20
		#print faceid, angle
		color = scalarMap.to_rgba(angle)
		#print eigvec, eigvec.shape, eigvec[0],eigval
		xlist = []
		ylist = []
		zlist = []
		edges = qd.FaceEdgeIterator(face)
		edge = edges.next()
		while edge != None:
			####grabbing the origin of edge####
			#centralised coordiante
			vertex = edge.Org()
			#print vertex.getID()
			xCoord1 = vertex.getXcoordinate()
			yCoord1 = vertex.getYcoordinate()
			zCoord1 = vertex.getZcoordinate()
			xlist.append(xCoord1)
			ylist.append(yCoord1)
			zlist.append(zCoord1)
			edge = edges.next()
		xlist.append(xlist[0])
		ylist.append(ylist[0])
		zlist.append(zlist[0])
		plotdiff.text(xmean,ymean,zmean, "%.2f"%angle)
		verts = [zip(xlist, ylist,zlist)]
		#plotdiff.text(xmean, ymean, zmean, "%.2f"%(angle))
		#verts = [zip(np.array(ellipsepoints[0])[0],np.array(ellipsepoints[1])[0], np.array(ellipsepoints[2])[0])]
		pc = Poly3DCollection(verts,alpha = .7,linewidths=1, facecolor = color,zorder = 10)
		pc.set_edgecolor(color)
		plotdiff.add_collection3d(pc)
		############################################################
		# For now just plotting Principal direction of Growth
		############################################################
		"""plotdiff.quiver(xmean,ymean,zmean,
													radialvec[0],radialvec[1],radialvec[2],
							color='b',length = 1,pivot='tail',zorder=-1)"""
		if eigval[0]> eigval[1]:
									colorvec1 = 'r'
									vec1 = plotdiff.quiver(xmean,ymean,zmean,
												eigvec[0,0],eigvec[0,1],eigvec[0,2],
												color=colorvec1,length = 1,pivot='tail',zorder=-1)
									#colorvec2 = 'b'
		else:
									colorvec2 = 'r'	
									vec2 =plotdiff.quiver(xmean,ymean,zmean,
												eigvec[1,0],eigvec[1,1],eigvec[1,2],
												color=colorvec2,length = 1,pivot='tail',zorder=-1)
		############################################################
		# Plotting face
		############################################################
		xlist = []
		ylist = []
		zlist = []
		edges = qd.FaceEdgeIterator(face)
		edge = edges.next()
		while edge != None:
			####grabbing the origin of edge####
			#centralised coordiante
			vertex = edge.Org()
			#print vertex.getID()
			xCoord1 = vertex.getXcoordinate()
			yCoord1 = vertex.getYcoordinate()
			zCoord1 = vertex.getZcoordinate()
			xlist.append(xCoord1)
			ylist.append(yCoord1)
			zlist.append(zCoord1)
			edge = edges.next()
		xlist.append(xlist[0])
		ylist.append(ylist[0])
		zlist.append(zlist[0])
		if faceid in faceidarray:
			line, = plotdiff.plot(xlist,ylist,zlist,c=c,lw = lw)
		else:
			plotdiff.plot(xlist,ylist,zlist,c=c,lw = lw)
		face = faces.next()
	plotdiff.view_init(azim = azim, elev= elev)
	
	#plotdiff.legend((vec1,vec2,line),("major direction","minor direction","Fast Growing"),bbox_to_anchor=(0.87, 0.95))
	########################################################################
	plt.savefig(saveDirectory+r"/principalGrowth_step=%03d.png"%(step),transparent=True)
	del plotdiff.collections[:]
	plotdiff.lines = []
	return plotdiff
コード例 #7
0
def getGrowthRateStress(numOfLayer,
                        endStep,
                        eta,
                        startStep=0,
                        stepsize=1,
                        maxarea=None,
                        areastep=20,
                        startarea=None,
                        endarea=850,
                        resetids=False):
    import numpy as np
    import matplotlib.pyplot as plt
    import os
    ########################################################################
    # faceidarray for Primordia
    if not os.path.isfile("qdObject_step=001.obj"):
        return [0., 0., 0., 0., 0., 0., 0., 0., 0.]
    cell = sf.loadCellFromFile(1)
    initialTissueSurfaceArea = sf.getSurfaceArea(cell)
    #######################################################################
    topFaceID = 3 * numOfLayer * (
        numOfLayer - 1) + 2  #the id of cell at the top of the dome
    #######################################################################
    # Starting the Calculation
    ######################################################################
    #######################################################################
    laststep = 1
    plotargs = {
        "markersize": 10,
        "capsize": 10,
        "elinewidth": 3,
        "markeredgewidth": 2
    }
    #######################################################################
    heightArray = []
    tissueSurfaceAreaArray = []
    tissueSurfaceAreaArray2 = []
    timeArray = []
    timeArray2 = []
    dhdAArray = []
    volumeArray = []
    radiusMeanArray = []
    radiusVarArray = []
    topdistance = []
    ################################################################
    absStressDict = {}
    stressRadialDict = {}
    stressOrthoradialDict = {}
    growthRateDict = {}
    tipDistanceDict = {}
    dictArray = [
        absStressDict, stressRadialDict, stressOrthoradialDict, growthRateDict,
        tipDistanceDict
    ]
    ###################################################
    if not startarea:  #no startarea given
        startarea = int(initialTissueSurfaceArea)
    ###################################################
    listsurfacearea = np.linspace(startarea, endarea, 15)
    for steparea in listsurfacearea:
        step, tissueSurfaceArea = getTimeStep(steparea,
                                              endStep,
                                              laststep,
                                              stepsize=10)
        step2, tissueSurfaceArea2 = getTimeStep(steparea + areastep,
                                                endStep,
                                                step,
                                                stepsize=10)
        if step == step2: break
        ########################################################################
        if not (os.path.isfile("qdObject_step=%03d.obj" % step)
                or os.path.isfile(
                    "qdObject_step=%03d.obj" % step2)):  #check if file exists
            break
        cell = sf.loadCellFromFile(step, resetids=resetids)
        cell2 = sf.loadCellFromFile(step2, resetids=resetids)
        ################################################
        topFace = sf.getFace(cell2, topFaceID)
        ################################################
        cell2.calculateStressStrain()
        cell2.setRadialOrthoradialVector(topFace)
        cell2.setRadialOrthoradialStress()
        ################################################
        dTissueSurfaceArea = tissueSurfaceArea2 - tissueSurfaceArea
        ################################################
        #computing the cell growth rate
        ################################################
        faces = qd.CellFaceIterator(cell2)
        face2 = faces.next()
        while face2 != None:
            faceid = face2.getID()
            face1 = sf.getFace(cell, faceid)
            ############################################
            if face1 == None:
                absstress = np.abs(face2.getStressEigenValue1()) + np.abs(
                    face2.getStressEigenValue2())
                stressRadial = face2.getRadialStress()
                stressOrthoradial = face2.getOrthoradialStress()
                tipdistance = getFaceDistance(face2, topFace)
                growthrate = np.nan
                ############################################
                addToDict(face2, dictArray, [
                    absstress, stressRadial, stressOrthoradial, growthrate,
                    tipdistance
                ])
                ############################################
                face2 = faces.next()
                continue
            ############################################
            facearea1 = face1.getAreaOfFace()
            facearea2 = face2.getAreaOfFace()
            ############################################
            # checking if face2 has recently divided
            # if face divided recently, facearea is
            # divided in near half
            ############################################
            if (facearea2 - facearea1) < -0.3 * facearea1:
                # if this is true, then face1 has
                # seen drastic area decrease
                # which would mean cell division
                growthrate = np.nan
            else:
                ############################################
                #if no recent division
                ############################################
                dfacearea = facearea2 - facearea1
                growthrate = dfacearea / (facearea1 * dTissueSurfaceArea)
            ############################################
            absstress = np.abs(face2.getStressEigenValue1()) + np.abs(
                face2.getStressEigenValue2())
            stressRadial = face2.getRadialStress()
            stressOrthoradial = face2.getOrthoradialStress()
            tipdistance = getFaceDistance(face2, topFace)
            ############################################
            addToDict(face2, dictArray, [
                absstress, stressRadial, stressOrthoradial, growthrate,
                tipdistance
            ])
            ############################################
            face2 = faces.next()
            ############################################
        ################################################
        height = getTissueHeight(cell)
        heightArray.append(height)
        timeArray.append(step)
        timeArray2.append(step2)
        tissueSurfaceAreaArray.append(tissueSurfaceArea)
        tissueSurfaceAreaArray2.append(tissueSurfaceArea2)
        ########################################################################
        print step2, tissueSurfaceArea, height
    ########################################################################
    return [
        tissueSurfaceAreaArray, tissueSurfaceAreaArray2, heightArray,
        timeArray, timeArray2, dictArray
    ]
コード例 #8
0
def plotMeanStressGrowth(numOfLayer, targetid,endStep,eta, 
	meanstress, meandilation,
	color,startStep=0,stepsize= 1,largerCondition =True ,maxarea = None, areastep = 20,
	startarea = None,
	endarea = 850,resetids = True):
	import numpy as np
	import matplotlib.pyplot as plt
	import os
	########################################################################
	# faceidarray for Primordia
	if not os.path.isfile("qdObject_step=001.obj"):
		return [0.,0.,0.,0.,0.,0.,0.,0.,0.]
	cell = sf.loadCellFromFile(1,resetids=resetids)
	initialTissueSurfaceArea = sf.getSurfaceArea(cell)
	#######################################################################
	# Starting the Calculation
	#######################################################################
	#######################################################################
	laststep = 1
	plotargs = {"markersize": 10, "capsize": 10,"elinewidth":3,"markeredgewidth":2}
	#######################################################################
	orthoradialStressArray = []
	radialStressArray = []
	radialGrowthArray = []
	orthoradialGrowthArray = []
	meanstressEigenvalue1Array = []
	meanstressEigenvalue2Array = []
	meangrowthEigenvalue1Array = []
	meangrowthEigenvalue2Array = []
	meangaussianCurvatureArray = []
	###################################################
	# save standard deviations of the stress and growth
	###################################################
	radialStressSDArray = []
	orthoradialStressSDArray = []
	radialGrowthSDArray = []
	orthoradialGrowthSDArray = []
	meanstressEigenvalue1SDArray = []
	meanstressEigenvalue2SDArray = []
	meangrowthEigenvalue1SDArray = []
	meangrowthEigenvalue2SDArray = []
	###################################################
	tissueSurfaceAreaArray = []
	primordiaAreaArray = []
	boundaryAreaArray = []
	heightArray = []
	###################################################
	if not startarea:#no startarea given
		startarea = int(initialTissueSurfaceArea)
	###################################################
	listsurfacearea = np.linspace(startarea,endarea,10)
	#print listsurfacearea
	#for steparea in range(startarea, endarea, int(areastep)):
	for steparea in listsurfacearea:
		step,tissueSurfaceArea = sf.getTimeStep(steparea, endStep, laststep, stepsize = 10,resetids = resetids)
		########################################################################
		step2,tissueSurfaceArea2 = sf.getTimeStep(steparea+areastep, endStep, step, stepsize = 10,resetids = resetids)
		########################################################################
		if not os.path.isfile("qdObject_step=%03d.obj"%step):#check if file exists
			break
		cell = sf.loadCellFromFile(step,resetids=resetids)
		cell2 = sf.loadCellFromFile(step2,resetids=resetids)
		################################################
		cell.calculateStressStrain()
		################################################
		primordialface = sf.getFace(cell, targetid)
		################################################
		cell.setRadialOrthoradialVector(primordialface)
		cell.setRadialOrthoradialStress()
		################################################
		sf.calculateDilation(cell,cell2)
		########################################################################
		#  Starting the Calculation of mean growth and mean stress on boundary
		########################################################################
		# mean stress
		########################################################################
		faceList = sf.getPrimordiaBoundaryFaceList(cell,targetid,large= large)
		primordiafacelist  = sf.getPrimordiaFaces(cell, targetid, large = False)
		primordiaarea = 0.
		for face in primordiafacelist:
			primordiaarea += face.getAreaOfFace()
		######################################################
		#radialDict, orthoradialDict = getRadialOrthoradialDict(cell,targetid,large = large)
		######################################################
		radialStress = []
		orthoradialStress = []
		radialGrowth = []
		orthoradialGrowth = []
		stressEigenvalue1Array = []
		stressEigenvalue2Array = []
		growthEigenvalue1Array = []
		growthEigenvalue2Array = []
		gaussianCurvatureArray = []
		dTissueSurfaceArea = tissueSurfaceArea2-tissueSurfaceArea
		boundaryarea = 0.
		for face in faceList:
			boundaryarea += face.getAreaOfFace()
			#######################################################
			radstress, orthstress,stresseigenvalue1, stresseigenvalue2  = getRadialOrthoradialStress(face)
			radGrowth, orthGrowth, growtheigenvalue1, growtheigenvalue2 = getRadialOrthoradialGrowth(face)
			#######################################################
			radialStress.append(radstress)
			orthoradialStress.append(orthstress)
			radialGrowth.append(radGrowth)
			orthoradialGrowth.append(orthGrowth)
			stressEigenvalue1Array.append(stresseigenvalue1)
			stressEigenvalue2Array.append(stresseigenvalue2)
			growthEigenvalue1Array.append(growtheigenvalue1)
			growthEigenvalue2Array.append(growtheigenvalue2)
			gaussianCurvatureArray.append(sf.getFaceWeightedGaussianCurvature(face))
		######################################################
		radialStressArray.append(np.mean(radialStress))
		orthoradialStressArray.append(np.mean(orthoradialStress))
		radialGrowthArray.append(np.mean(radialGrowth))
		orthoradialGrowthArray.append(np.mean(orthoradialGrowth))
		tissueSurfaceAreaArray.append(tissueSurfaceArea)
		primordiaAreaArray.append(primordiaarea)
		boundaryAreaArray.append(boundaryarea)
		######################################################
		height = getPrimordiaHeight(cell,targetid)
		heightArray.append(height)
		######################################################
		meanstressEigenvalue1Array.append(np.mean(stressEigenvalue1Array))
		meanstressEigenvalue2Array.append(np.mean(stressEigenvalue2Array))
		meangrowthEigenvalue1Array.append(np.mean(growthEigenvalue1Array))
		meangrowthEigenvalue2Array.append(np.mean(growthEigenvalue2Array))
		meangaussianCurvatureArray.append(np.mean(gaussianCurvatureArray))
		#######################################################
		# calculating the standard deviation
		#######################################################
		meanstressEigenvalue1SDArray.append(np.std(stressEigenvalue1Array))
		meanstressEigenvalue2SDArray.append(np.std(stressEigenvalue2Array))
		meangrowthEigenvalue1SDArray.append(np.std(growthEigenvalue1Array))
		meangrowthEigenvalue2SDArray.append(np.std(growthEigenvalue2Array))
		radialStressSDArray.append(np.std(radialStress))
		orthoradialStressSDArray.append(np.std(orthoradialStress))
		radialGrowthSDArray.append(np.std(radialGrowth))
		orthoradialGrowthSDArray.append(np.std(orthoradialGrowth))
		#meanstress.errorbar(tissueSurfaceArea, np.mean(radialStress),
		#    yerr = np.std(radialStress)/float(len(radialStress)),fmt='o',label = r":$\sigma_{r}$",c=color,**plotargs)
		#meanstress.errorbar(tissueSurfaceArea, np.mean(orthoradialStress),
		#    yerr = np.std(orthoradialStress)/float(len(orthoradialStress)),fmt='<',label = r":$\sigma_{o}$",c=color,**plotargs)
		########################################################################
		# mean dilation
		########################################################################
		#meandilation.errorbar(tissueSurfaceArea, np.mean(radialGrowth),
		#    yerr = np.std(radialGrowth)/float(len(radialGrowth)),fmt='o',label = r":$g_{r}$",c=color,**plotargs)
		#meandilation.errorbar(tissueSurfaceArea, np.mean(orthoradialGrowth),
		#    yerr = np.std(orthoradialGrowth)/float(len(orthoradialGrowth)),fmt='<',label = r":$g_{o}$",c=color,**plotargs)
		########################################################################
		laststep = step
		########################################################################
		print tissueSurfaceArea, tissueSurfaceArea2,dTissueSurfaceArea, step , step2
		########################################################################
	return [tissueSurfaceAreaArray, radialStressArray, orthoradialStressArray,
			radialGrowthArray, orthoradialGrowthArray,
			primordiaAreaArray,
			heightArray,
			meanstressEigenvalue1Array, meanstressEigenvalue2Array,
			meangrowthEigenvalue1Array, meangrowthEigenvalue2Array, boundaryAreaArray,
			radialStressSDArray, orthoradialStressSDArray, 
			radialGrowthSDArray, orthoradialGrowthSDArray,
			meanstressEigenvalue1SDArray, meanstressEigenvalue2SDArray,
			meangrowthEigenvalue1SDArray, meangrowthEigenvalue2SDArray,
			meangaussianCurvatureArray
			]
def getPrimordiaBoundaryVertexList(cell, targetface, large=False):
    ########################################################
    """
    Get a list of all vertices arround a primordia
    targetid : center of primordia
    large : if true, large primordia is calculated for (2 layers)
            if false, small primordia (1 layer)
    """
    face = sf.getFace(cell, targetface)
    edge = face.getEdge()
    vertexList = []
    ########################################################
    # tracing the primordial boundary
    ########################################################
    if large:
        #########################################################
        # Larger Proimordia
        #########################################################
        for _ in range(2):
            edge = edge.Rprev()
        #####################
        for _ in range(3):
            edge = edge.Lnext()
        ####################################################
        # listing Primordia vertex starts here
        ####################################################
        for _ in range(6):
            edge = edge.Rprev()
            vertexList.append(edge.Dest())
            #####################
            for _ in range(2):
                edge = edge.Lnext()
                vertexList.append(edge.Dest())
            #####################
            edge = edge.Rprev()
            vertexList.append(edge.Dest())
            #####################
            edge = edge.Lnext()
            vertexList.append(edge.Dest())
    else:
        #########################################################
        # Smaller Proimordia
        #########################################################
        for _ in range(1):
            edge = edge.Rprev()
        ###############################################################
        # listing Primordia vertex starts here
        ###############################################################
        for _ in range(3):
            edge = edge.Lnext()
            vertexList.append(edge.Dest())
        #####################
        for _ in range(5):
            edge = edge.Rprev()
            vertexList.append(edge.Dest())
            ####################
            edge = edge.Lnext()
            vertexList.append(edge.Dest())
            ####################
            edge = edge.Lnext()
            vertexList.append(edge.Dest())
            ####################
    return vertexList
def plotMinGaussianCurvaturePrimodiaHeight(numOfLayer, targetid,endStep,eta, 
    mincurvatureplot, heightplot,ax3,ax4,ax5,ax6,ax7,
    color,startStep=0,stepsize= 1,largerCondition = False,maxarea = None,resetids = True):
    import numpy as np
    import matplotlib.pyplot as plt
    import os
    ########################################################################
    # faceidarray for Primordia
    if not os.path.isfile("qdObject_step=000.obj"):
        return [0.,0.,0.,0.,0.,0.,0.,0.,0.]
    cell = sf.loadCellFromFile(0,resetids = resetids)
    faceList = sf.getPrimordiaFaces(cell,targetid, large = largerCondition)
    faceidarray = [xface.getID() for xface in faceList]
    primordialFaceNum  = len(faceList)
    slowFaceNum = cell.countFaces()-primordialFaceNum- 1.
    #print largerCondition, faceidarray
    #######################################################################
    # Checking if the files exists if not going to step down
    #######################################################################
    meanGaussianCurvature = []
    primodialheight = []
    primodialAreaArray = []
    tissueSurfaceAreaArray = []
    surfaceAreaRatio = []
    sphericityArray = []
    tissueVolumeArray = []
    timestep = []
    ######################################################
    # Gathering face area
    ######################################################
    m0determinantArray = []
    slowarray = []
    fastarray = []
    #######################################################################
    # Starting the Calculation
    #######################################################################
    #####################################
    #Getting initial area of primodial
    #####################################
    if not os.path.isfile("qdObject_step=001.obj"):
        return [0.,0.,0.,0.,0.,0.,0.,0.,0.]
    cell = sf.loadCellFromFile(1,resetids = resetids)
    #################################
    # face area data
    #################################
    tfmdet, slowfacearea, fastfacearea,areaPrimodia = getFaceAreaData(cell,faceidarray)
    ##################################################################
    areaInitialPrimodia = areaPrimodia
    #######################################################################
    for step in range(startStep,endStep+1,stepsize):
        if not os.path.isfile("qdObject_step=%03d.obj"%step):#check if file exists
            break
        cell = sf.loadCellFromFile(step,resetids = resetids)
        #################################
        # face area data
        #################################
        tfmdet, slowfacearea, fastfacearea,areaPrimodia = getFaceAreaData(cell,faceidarray)
        m0determinantArray.append(tfmdet)
        ################################################################################
        # saving the mean area 
        ################################################################################
        slowarray.append(slowfacearea/slowFaceNum)
        fastarray.append(fastfacearea/primordialFaceNum)
        ########################################################################
        #  Starting the Calcuation of Primordial Height & Curvature            #
        ########################################################################
        gaussianCurvature = []
        meanpointx = []
        meanpointy = []
        meanpointz = []
        tissueSurfaceArea = sf.getSurfaceArea(cell)
        tissueVolume = cell.getCartesianVolume()
        sphericity = (np.pi**(1./3.)*(2.**(1./2.)*3*tissueVolume)**(2./3.))/(tissueSurfaceArea)
        ########################################################################
        # Getting the primordial boundary
        ########################################################################
        facetarget = sf.getFace(cell, targetid)
        ##########################################
        # Vertex on primordial boundary
        ##########################################
        vertexList = getPrimordiaBoundaryVertexList(cell, targetface=targetid,large = largerCondition)
        vertexNum = len(vertexList)
        ####################################################
        # Calculation of primordial height starts here
        # This is for smaller primordia
        ####################################################
        meanx = 0.
        meany = 0.
        meanz = 0.
        for vert in vertexList:#while edge.Dest().getID() != targetedge.Dest().getID():
            meanx,meany,meanz = addMeanVertex(vert,meanx,meany,meanz)
            gaussianCurvature.append(vert.getGaussianCurvature())
        ######################################
        targetx = facetarget.getXCentralised()
        targety = facetarget.getYCentralised()
        targetz = facetarget.getZCentralised()
        meanx /= vertexNum
        meany /= vertexNum
        meanz /= vertexNum
        height = np.sqrt((meanx-targetx)**2+(meany-targety)**2+(meanz-targetz)**2)
        ##########################################################################
        primodialheight.append(height)
        tissueSurfaceAreaArray.append(tissueSurfaceArea)
        primodialAreaArray.append(areaPrimodia)
        surfaceAreaRatio.append((areaPrimodia/(tissueSurfaceArea)))
        sphericityArray.append(sphericity)
        meanGaussianCurvature.append(np.mean(np.array(gaussianCurvature)))
        tissueVolumeArray.append(tissueVolume)
        timestep.append(step-1.)
    #################################################################################
    #                         Plotting 
    #################################################################################
    # calculating the plotlen
    if maxarea:
        plotlen = ppf.getPlotlenMaxArea(tissueSurfaceAreaArray,maxarea)
        #print timestep, primodialheight, meanGaussianCurvature
        # Min Gaussian curvature
        #print timestep
        mincurvatureplot.plot(tissueSurfaceAreaArray[:plotlen],meanGaussianCurvature[:plotlen],c=color,lw = 1.5)
        ###################################
        # Height of Primodia
        heightplot.plot(tissueSurfaceAreaArray[:plotlen], primodialheight[:plotlen], c=color,lw = 1.5)
        ###################################
        # primordial area vs surface area
        ax3.plot(tissueSurfaceAreaArray[:plotlen], primodialAreaArray[:plotlen], c = color, lw = 1.5)
        ###################################
        # surface area vs time
        ax4.plot(timestep[:plotlen],tissueSurfaceAreaArray[:plotlen], c = color, lw = 1.5)
    #print timestep, primodialheight, meanGaussianCurvature
    # Min Gaussian curvature
    #print timestep
    mincurvatureplot.plot(tissueSurfaceAreaArray,meanGaussianCurvature,c=color,lw = 1.5)
    ###################################
    # Height of Primodia
    heightplot.plot(tissueSurfaceAreaArray, primodialheight, c=color,lw = 1.5)
    ###################################
    # primordial area vs surface area
    ax3.plot(tissueSurfaceAreaArray, primodialAreaArray, c = color, lw = 1.5)
    ###################################
    # surface area vs time
    ax4.plot(timestep,tissueSurfaceAreaArray, c = color, lw = 1.5)
    ########################################################
    #ax3.plot(primodialAreaArray,meanGaussianCurvature,c=color,lw =1.5)
    #ax4.plot(primodialAreaArray,primodialheight,c=color,lw = 1.5)
    ########################################################
    #ax5.plot(surfaceAreaRatio,meanGaussianCurvature,c=color,lw =1.5)
    #ax6.plot(surfaceAreaRatio,primodialheight,c=color,lw = 1.5)
    ########################################################
    #ax7.plot(timestep, sphericityArray,c=color,lw = 1.5)
    return [primodialheight, meanGaussianCurvature,primodialAreaArray,
    tissueSurfaceAreaArray,tissueVolumeArray, 
    sphericityArray,m0determinantArray,
     fastarray, slowarray,timestep]
コード例 #11
0
def plotPrincipalStress(numOfLayer,
                        targetid,
                        endStep,
                        eta,
                        meanstressplot,
                        color,
                        startStep=0,
                        stepsize=1,
                        largerCondition=True,
                        maxarea=None,
                        areastep=20,
                        startarea=None,
                        endarea=850):
    import numpy as np
    import matplotlib.pyplot as plt
    import os
    ########################################################################
    # faceidarray for Primordia
    if not os.path.isfile("qdObject_step=001.obj"):
        return [0., 0., 0., 0., 0., 0., 0., 0., 0.]
    cell = sf.loadCellFromFile(1)
    initialTissueSurfaceArea = sf.getSurfaceArea(cell)
    #######################################################################
    # Starting the Calculation
    #######################################################################
    laststep = 1
    plotargs = {
        "markersize": 10,
        "capsize": 10,
        "elinewidth": 3,
        "markeredgewidth": 2
    }
    #######################################################################
    tissueSurfaceAreaArray = []
    meanstressEigenvalue1Array = []
    meanstressEigenvalue2Array = []
    heightArray = []
    primordialAreaArray = []
    radialStressArray = []
    orthoradialStressArray = []
    if not startarea:  #no startarea given
        startarea = int(initialTissueSurfaceArea)
    for steparea in range(startarea, endarea, int(areastep)):
        step, tissueSurfaceArea = getTimeStep(steparea,
                                              endStep,
                                              laststep,
                                              stepsize=10)
        ########################################################################
        if not os.path.isfile(
                "qdObject_step=%03d.obj" % step):  #check if file exists
            break
        cell = sf.loadCellFromFile(step)
        ################################################
        cell.calculateStressStrain()
        ################################################
        primordialface = sf.getFace(cell, targetid)
        ################################################
        cell.setRadialOrthoradialVector(primordialface)
        cell.setRadialOrthoradialStress()
        ################################################
        ########################################################################
        #  Starting the Calculation of mean growth and mean stress on boundary
        ########################################################################
        # mean stress
        ########################################################################
        faceList = sf.getPrimordiaBoundaryFaceList(cell, targetid, large=large)
        height = getPrimordiaHeight(cell, targetid)
        ###############################################
        primordiafacelist = sf.getPrimordiaFaces(cell, targetid, large=False)
        primordiaarea = 0.
        for face in primordiafacelist:
            primordiaarea += face.getAreaOfFace()
        ######################################################
        #radialDict, orthoradialDict = getRadialOrthoradialDict(cell,targetid,large = large)
        ######################################################
        stressEigenvalue1Array = []
        stressEigenvalue2Array = []
        radialStress = []
        orthoradialStress = []
        for face in faceList:
            radstress = face.getRadialStress()
            orthstress = face.getOrthoradialStress()
            stresseigenvalue1 = face.getStressEigenValue1()
            stresseigenvalue2 = face.getStressEigenValue2()
            radialStress.append(radstress)
            orthoradialStress.append(orthstress)
            #######################################################
            stressEigenvalue1Array.append(stresseigenvalue1)
            stressEigenvalue2Array.append(stresseigenvalue2)
        ######################################################
        tissueSurfaceAreaArray.append(tissueSurfaceArea)
        heightArray.append(height)
        ######################################################
        meanstressEigenvalue1Array.append(np.mean(stressEigenvalue1Array))
        meanstressEigenvalue2Array.append(np.mean(stressEigenvalue2Array))
        radialStressArray.append(np.mean(radialStress))
        orthoradialStressArray.append(np.mean(orthoradialStress))
        primordialAreaArray.append(primordiaarea)
        ########################################################################
        laststep = step
        ########################################################################
    return [
        tissueSurfaceAreaArray, meanstressEigenvalue1Array,
        meanstressEigenvalue2Array,
        np.add(meanstressEigenvalue1Array, meanstressEigenvalue2Array),
        np.subtract(meanstressEigenvalue2Array,
                    meanstressEigenvalue1Array), heightArray,
        primordialAreaArray, radialStressArray, orthoradialStressArray
    ]
コード例 #12
0
def plotHeightGrowthScatter(numOfLayer,
                            targetid,
                            endStep,
                            eta,
                            stressscatter,
                            growthscatter,
                            stressscatter1,
                            growthscatter1,
                            anisotropyplot,
                            color='r',
                            maxeta=20,
                            startStep=0,
                            stepsize=1,
                            largerCondition=True,
                            maxarea=None,
                            areastep=20,
                            cloud=False,
                            startarea=None,
                            resetids=True,
                            endarea=850):
    import numpy as np
    import matplotlib.pyplot as plt
    import os
    ########################################################################
    # faceidarray for Primordia
    if not os.path.isfile("qdObject_step=001.obj"):
        return [0., 0., 0., 0., 0., 0., 0., 0., 0.]
    cell = sf.loadCellFromFile(1, resetids=resetids)
    initialTissueSurfaceArea = sf.getSurfaceArea(cell)
    #######################################################################
    # Starting the Calculation
    #######################################################################
    laststep = 1
    plotargs = {
        "markersize": 10,
        "capsize": 10,
        "elinewidth": 3,
        "markeredgewidth": 2
    }
    #######################################################################
    orthoradialStressArray = []
    radialStressArray = []
    radialGrowthArray = []
    orthoradialGrowthArray = []
    tissueSurfaceAreaArray = []
    primordiaAreaArray = []
    heightArray = []
    meanstressEigenvalue1Array = []
    meanstressEigenvalue2Array = []

    meangrowthEigenvalue1Array = []
    meangrowthEigenvalue2Array = []
    meanstressdiffarray = []
    areadiffarray = []
    if not startarea:  #no startarea given
        startarea = int(initialTissueSurfaceArea)
    for steparea in range(startarea, endarea, int(areastep)):
        step, tissueSurfaceArea = getTimeStep(steparea,
                                              endStep,
                                              laststep,
                                              stepsize=5,
                                              resetids=resetids)
        ########################################################################
        step2, tissueSurfaceArea2 = getTimeStep(steparea + areastep,
                                                endStep,
                                                step,
                                                stepsize=5,
                                                resetids=resetids)
        ########################################################################
        if not os.path.isfile(
                "qdObject_step=%03d.obj" % step):  #check if file exists
            break
        cell = sf.loadCellFromFile(step, resetids=resetids)
        cell2 = sf.loadCellFromFile(step2, resetids=resetids)
        ################################################
        cell.calculateStressStrain()
        ################################################
        primordialface = sf.getFace(cell, targetid)
        ################################################
        cell.setRadialOrthoradialVector(primordialface)
        cell.setRadialOrthoradialStress()
        ################################################
        sf.calculateDilation(cell, cell2)
        ########################################################################
        #  Starting the Calculation of mean growth and mean stress on boundary
        ########################################################################
        # mean stress
        ########################################################################
        faceList = sf.getPrimordiaBoundaryFaceList(cell, targetid, large=large)
        primordiafacelist = sf.getPrimordiaFaces(cell, targetid, large=False)
        primordiaarea = 0.
        for face in primordiafacelist:
            primordiaarea += face.getAreaOfFace()
        ######################################################
        #radialDict, orthoradialDict = getRadialOrthoradialDict(cell,targetid,large = large)
        ######################################################
        stressEigenvalue1Array = []
        stressEigenvalue2Array = []
        growthEigenvalue1Array = []
        growthEigenvalue2Array = []
        stressdiffarray = []
        growthdiffarray = []
        dTissueSurfaceArea = tissueSurfaceArea2 - tissueSurfaceArea
        height = getPrimordiaHeight(cell, targetid)
        height2 = getPrimordiaHeight(cell2, targetid)
        dhdA = (height2 - height) / dTissueSurfaceArea
        for face in faceList:
            radstress, orthstress, stresseigenvalue1, stresseigenvalue2 = getRadialOrthoradialStress(
                face)
            radGrowth, orthGrowth, growtheigenvalue1, growtheigenvalue2 = getRadialOrthoradialGrowth(
                face)
            stressEigenvalue1Array.append(stresseigenvalue1)
            stressEigenvalue2Array.append(stresseigenvalue2)
            growthEigenvalue1Array.append(growtheigenvalue1)
            growthEigenvalue2Array.append(growtheigenvalue2)
            stressdiffarray.append(stresseigenvalue2 - stresseigenvalue1)
            growthdiffarray.append(growtheigenvalue2 - growtheigenvalue1)
        #######################################################
        # plotting
        #######################################################
        meanstresseigen1 = np.mean(stressEigenvalue1Array)
        meanstresseigen2 = np.mean(stressEigenvalue2Array)
        meangrowtheigenvalue1 = np.mean(growthEigenvalue1Array)
        meangrowtheigenvalue2 = np.mean(growthEigenvalue2Array)

        sigma2 = max(meanstresseigen1, meanstresseigen2)
        sigma1 = min(meanstresseigen1, meanstresseigen2)
        g2 = max(meangrowtheigenvalue1, meangrowtheigenvalue2)
        g1 = min(meangrowtheigenvalue1, meangrowtheigenvalue2)
        #######################################################
        stressscatter.scatter(sigma2 - sigma1,
                              dhdA,
                              c=color,
                              marker='o',
                              alpha=0.7,
                              zorder=maxeta - eta)
        growthscatter.scatter(g2 - g1,
                              dhdA,
                              c=color,
                              marker='o',
                              alpha=0.7,
                              zorder=maxeta - eta)
        #######################################################
        stressscatter1.scatter(np.mean(stressdiffarray),
                               dhdA,
                               c=color,
                               marker='o',
                               alpha=0.7,
                               zorder=maxeta - eta)
        growthscatter1.scatter(np.mean(growthdiffarray),
                               dhdA,
                               c=color,
                               marker='o',
                               alpha=0.7,
                               zorder=maxeta - eta)
        #######################################################
        anisotropyplot.scatter(np.mean(stressdiffarray),
                               dhdA,
                               c=color,
                               marker='o',
                               alpha=0.7,
                               zorder=maxeta - eta)
        meanstressdiffarray.append(np.mean(stressdiffarray))
        areadiffarray.append(dhdA)
        ########################################################################
        laststep = step
        ########################################################################
        print tissueSurfaceArea, tissueSurfaceArea2, dTissueSurfaceArea, step, step2
    ########################################################################
    if cloudCondition:
        points = np.vstack((meanstressdiffarray, areadiffarray)).T
        hull_pts = ConvexHull(points)
        hull_pts = points[hull_pts.vertices]
        hull_pts = np.vstack((hull_pts, hull_pts[0])).T
        interpolatex, interpolatey = interpolatedata(hull_pts)
        anisotropyplot.plot(interpolatex, interpolatey, c=color, ls='--', lw=2)
    ########################################################################
    return [meanstressdiffarray, areadiffarray]
def plotMinGaussianCurvaturePrimodiaHeight(numOfLayer, targetid, endstep,
                                           fastkappa, mincurvatureplot,
                                           heightplot, color):
    import numpy as np
    import matplotlib.pyplot as plt
    ########################################################################
    # Loading the Cell #
    ########################################################################
    #######################################################################
    # Checking if the files exists if not going to step down
    #######################################################################
    meanGaussianCurvature = []
    primodialheight = []
    for step in range(1, endStep + 1):
        if not os.path.isfile(
                "qdObject_step=%03d.obj" % step):  #check if file exists
            break
        cell = sf.loadCellFromFile(step)
        ########################################################################
        #                 Starting the Calcuation of Curvature                 #
        ########################################################################
        gaussianCurvature = []
        meanpointx = []
        meanpointy = []
        meanpointz = []
        ##########
        edge = getEdge(cell, 211, 210)
        edgenext = edge
        ####grabbing the origin of edge####
        vertexDest = edge.Dest()
        meanpointx.append(vertexDest.getXcoordinate())
        meanpointy.append(vertexDest.getYcoordinate())
        meanpointz.append(vertexDest.getZcoordinate())
        # Get the Gaussian Curvature
        gaussianCurvature.append(vertexDest.getGaussianCurvature())
        while True:
            edgenext = edgenext.Rprev()
            vertexDest = edgenext.Dest()
            meanpointx.append(vertexDest.getXcoordinate())
            meanpointy.append(vertexDest.getYcoordinate())
            meanpointz.append(vertexDest.getZcoordinate())
            gaussianCurvature.append(vertexDest.getGaussianCurvature())
            ########################################################
            edgenext = edgenext.Lnext()
            vertexDest = edgenext.Dest()
            meanpointx.append(vertexDest.getXcoordinate())
            meanpointy.append(vertexDest.getYcoordinate())
            meanpointz.append(vertexDest.getZcoordinate())
            gaussianCurvature.append(vertexDest.getGaussianCurvature())
            ########################################################
            edgenext = edgenext.Lnext()
            vertexDest = edgenext.Dest()
            meanpointx.append(vertexDest.getXcoordinate())
            meanpointy.append(vertexDest.getYcoordinate())
            meanpointz.append(vertexDest.getZcoordinate())
            gaussianCurvature.append(vertexDest.getGaussianCurvature())
            ###############################################################
            edgenext = edgenext.Rprev()
            vertexDest = edgenext.Dest()
            meanpointx.append(vertexDest.getXcoordinate())
            meanpointy.append(vertexDest.getYcoordinate())
            meanpointz.append(vertexDest.getZcoordinate())
            gaussianCurvature.append(vertexDest.getGaussianCurvature())
            ########################################################
            edgenext = edgenext.Lnext()
            vertexDest = edgenext.Dest()
            meanpointx.append(vertexDest.getXcoordinate())
            meanpointy.append(vertexDest.getYcoordinate())
            meanpointz.append(vertexDest.getZcoordinate())
            gaussianCurvature.append(vertexDest.getGaussianCurvature())
            #############################################################
            if edgenext.Org().getID() == edge.Org().getID():
                break
        facetarget = sf.getFace(cell, targetid)
        targetx = facetarget.getXCentralised()
        targety = facetarget.getYCentralised()
        targetz = facetarget.getZCentralised()
        meanx = np.mean(meanpointx)
        meany = np.mean(meanpointy)
        meanz = np.mean(meanpointz)
        height = np.sqrt((meanx - targetx)**2 + (meany - targety)**2 +
                         (meanz - targetz)**2)
        ##########################################################################
        primodialheight.append(height)
        meanGaussianCurvature.append(np.mean(np.array(gaussianCurvature)))
    #################################################################################
    #                         Plotting
    #################################################################################
    timestep = range(len(primodialheight))
    #print primodialheight, meanGaussianCurvature
    # Min Gaussian curvature
    mincurvatureplot.plot(timestep, meanGaussianCurvature, c=color, lw=3)
    ###################################
    # Height of Primodia
    heightplot.plot(timestep, primodialheight, c=color, lw=3)
    ########################################################
    return