示例#1
0
 def altoptm(l,df,zs):
     m= numpy.array([l[0],l[1]])
     V= numpy.array([[l[2],l[4]],[l[4],l[3]]])
     a= numpy.array([l[5],l[6]])
     return numpy.sum((multiskewnormal(zs,m,V,a)-df)**2.)
示例#2
0
 V11= 0.2**2./2.
 a0= 0.
 a1= 3.
 l= optimize.fmin(optm,[m0,m1,V00,V11,V01,a0,a1],(vs,))
 #g= optimize.fmin(gaussoptm,[m0,m1,V00,V11,V01],(vs,))
 altdf= grid.df.flatten()
 altdf/= numpy.sum(altdf)*(grid.vRgrid[1]-grid.vRgrid[0])\
     *(grid.vTgrid[1]-grid.vTgrid[0])
 h= optimize.fmin(altoptm,[m0,m1,V00,V11,V01,a0,a1],(altdf,vzs,))
 m= numpy.array([l[0],l[1]])
 V= numpy.array([[l[2],l[4]],[l[4],l[3]]])
 a= numpy.array([l[5],l[6]])
 ma= numpy.array([h[0],h[1]])
 Va= numpy.array([[h[2],h[4]],[h[4],h[3]]])
 aa= numpy.array([h[5],h[6]])
 X= multiskewnormal(zs,m,V,a)
 X= numpy.reshape(X,(len(xs),len(ys)))
 #Also cumulative for contouring
 sortindx= numpy.argsort(X.flatten())[::-1]
 cumul= numpy.cumsum(numpy.sort(X.flatten())[::-1])/numpy.sum(X.flatten())
 cntrThis= numpy.zeros(numpy.prod(X.shape))
 cntrThis[sortindx]= cumul
 cntrThis= numpy.reshape(cntrThis,X.shape)
 Z= multiskewnormal(zs,ma,Va,aa)
 Z= numpy.reshape(Z,(len(xs),len(ys)))
 #Also cumulative for contouring
 sortindxa= numpy.argsort(Z.flatten())[::-1]
 cumula= numpy.cumsum(numpy.sort(Z.flatten())[::-1])/numpy.sum(Z.flatten())
 cntrThisa= numpy.zeros(numpy.prod(Z.shape))
 cntrThisa[sortindxa]= cumula
 cntrThisa= numpy.reshape(cntrThisa,Z.shape)