z = numpy.zeros(4, dtype='float64') ctr3 = numpy.ones(4, dtype='float64') / 3. endmembers = [] lineendpairs = [] #iterate over 4 end members and draw a line from there to center of opposing face, e.g. (0,.33,.33,.33) for i in range(4): a = copy.copy(z) a[i] = 1. b = copy.copy(ctr3) b[i] = 0. q.line(a, b, fmt='b-') q.scatter([b], c='b', s=15) endmembers += [a] lineendpairs += [[a, b]] #convert the end members and pairs of endpts to cartesian xyz_lineendpairs = [numpy.array(q.toCart(ls)).T for ls in lineendpairs] xyz_endmembers = numpy.array(q.toCart(endmembers)).T #choose the composition of a phase and draw the trivial phase field lines phcomp = numpy.array([.1, .3, .2, .4]) q.scatter([phcomp], c='r', s=20) for i in range(4): a = copy.copy(z) a[i] = 1. q.line(a, phcomp, fmt='r-') # iterate over all 4 phase field triangular boundaries (triangle defined by 3 points, the phase p0 and 2 end members p1,p2) and all 4 composition lines. find intersections p0 = numpy.array(q.toCart([phcomp])).T[0] xyz_intr_dlist = [] for countends, (p1, p2) in enumerate(itertools.combinations(xyz_endmembers, 2)):
import pylab, numpy from myquaternaryutility import QuaternaryPlot q=QuaternaryPlot(111) #t=numpy.linspace(0,1.,5) #comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.] #comps=numpy.float32(comps) t=numpy.linspace(0,1.,30) comps=[[a,b,1.-a-b-(2.*a**2+b),2.*a**2+b] for a in t for b in t[:10] if a+b+(2.*a**2+b)<=1.] comps=numpy.float32(comps) x, y, z=q.toCart(comps) q.scatter(comps,c=comps[:,3]) #q.ax.scatter(x, y, z, c=z) q.plotabcprojection(comps, c=(.4, .4, .4)) q.label(ha='center', va='center', fontsize=16) q.set_projection(azim=-17, elev=-6) pylab.show()
import pylab, numpy from myquaternaryutility import QuaternaryPlot q = QuaternaryPlot(111) #t=numpy.linspace(0,1.,5) #comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.] #comps=numpy.float32(comps) t = numpy.linspace(0, 1., 30) comps = [[a, b, 1. - a - b - (2. * a**2 + b), 2. * a**2 + b] for a in t for b in t[:10] if a + b + (2. * a**2 + b) <= 1.] comps = numpy.float32(comps) x, y, z = q.toCart(comps) q.scatter(comps, c=comps[:, 3]) #q.ax.scatter(x, y, z, c=z) q.plotabcprojection(comps, c=(.4, .4, .4)) q.label(ha='center', va='center', fontsize=16) q.set_projection(azim=-17, elev=-6) pylab.show()
z=numpy.zeros(4, dtype='float64') ctr3=numpy.ones(4, dtype='float64')/3. endmembers=[] lineendpairs=[] #iterate over 4 end members and draw a line from there to center of opposing face, e.g. (0,.33,.33,.33) for i in range(4): a=copy.copy(z) a[i]=1. b=copy.copy(ctr3) b[i]=0. q.line(a, b, fmt='b-') q.scatter([b], c='b', s=15) endmembers+=[a] lineendpairs+=[[a, b]] #convert the end members and pairs of endpts to cartesian xyz_lineendpairs=[numpy.array(q.toCart(ls)).T for ls in lineendpairs] xyz_endmembers=numpy.array(q.toCart(endmembers)).T #choose the composition of a phase and draw the trivial phase field lines phcomp=numpy.array([.1, .3, .2, .4]) q.scatter([phcomp], c='r', s=20) for i in range(4): a=copy.copy(z) a[i]=1. q.line(a, phcomp, fmt='r-') # iterate over all 4 phase field triangular boundaries (triangle defined by 3 points, the phase p0 and 2 end members p1,p2) and all 4 composition lines. find intersections p0=numpy.array(q.toCart([phcomp])).T[0] xyz_intr_dlist=[] for countends, (p1, p2) in enumerate(itertools.combinations(xyz_endmembers, 2)): for countlines, (l0, l1) in enumerate(xyz_lineendpairs):