def plotLikelihoodXY(): fig = plt.figure() ax = fig.gca(projection='3d') # 1024*0.8 y = np.linspace(100, 924.0, 50) x = np.linspace(100, 924.0, 50) # print x x,y = np.meshgrid(x,y) #x,y = 1.268,-3.197 sediment,w = 0, 39 # 0.19*1024.0 # 0.33 # 0.36 curvature = 0 h,sigma = 0.09,0.11 #.2, 0.1 crater = CreaterParams(0,0,sediment,curvature,w,h,sigma) # print x z = [] for j in range(len(y)): arr = [] for i in range(len(x)): # print str(x[0][i])+", "+str(y[j][0]) crater.x = x[0][i] crater.y = y[j][0] err = lnlikefn(crater) if(err== -np.inf): err = -8 #print err arr.append(err) z.append(arr) M = max(max(z)) m = min(min(z)) print m print M z = (np.array(z)+np.abs(m)) # /(M-m) # return #print z # ax.plot_surface(x, y, z, label='parametric curve') surf = ax.plot_surface(x,y,z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False) # ax.set_zlim(-1.01, 7000) ax.zaxis.set_major_locator(LinearLocator(10)) ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) # ax.legend() plt.show() return x,y,z
l[j] = lnlikefn(x,y,r[j]) plt.plot(r,l) plt.show() def getlk(x,y): w = [0.39416023296,0.0,0.685237450906,1.76466037699e-17,0.2] return lnlikefn(x,y,r,w,[tStart,tEnd,sigma,mean,h]) ''' curv_param = Uniform("curv_param",lower=-1,upper=1) h_param = Uniform("h_param",lower=0,upper=50) sigma_param = Uniform("sigma_param",lower=0,upper=1) x,y = 336.1,644 sediment,w = 0, 55.4 # 0.19*1024.0 # 0.33 # 0.36 curvature = 0 h,sigma = 18.89,26.26 #.2, 0.1 crater = CreaterParams(x,y,sediment,curvature,w,h,sigma) def resetCrater(): # x,y = 336.1,644 #sediment,w = 0, 55.4 # 0.19*1024.0 # 0.33 # 0.36 crater.curvature = 0 crater.h,crater.sigma = 40,40.3 #18.89,26.26 #crater.set(x,y,sediment,curvature,w,h,sigma) def lnlikefn(c): # if(-4 < x < 4 and -4 < y < 4 and -4 < w0 < 4 and -4 < w1 < 4 and -4 < w2 < 4 and -4 < w3 < 4 and -4 < w4 < 4 and 1.8 < r < 5.0): #if(-5 < c.x < 5 and -5 < c.y < 5): l = craterRequest.requestLikelihood(c) # print "x: "+str(x)+" y: "+str(y) + "r: "+str(r) + " l: " +str( l) # print c.toString() # print l