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
# print str(curvature[i]) +"\t"+ str(val) # plt.figure(2) print "Plotting" plt.plot(curvature,y,color=color,label = attr) print attr+"-->"+str( minVal) print "index -->"+str( index) return index,minVal resetCrater() X = [336.1,889.1,534.8] Y = [644,662,187.3] R = [55.4,33.8,40.4] for i in range(len(X)): plt.figure(i*2+3) print "\n\ncrater x "+str(X[i])+" y: "+str(Y[i]) crater.x,crater.y,crater.w = X[i],Y[i],R[i] resetCrater() iCur,v = minimizeError("curvature",-10,10,'r') iSigma,v = minimizeError("sigma",-10,100,'g') iH,v = minimizeError("h",-10,100,'b') plt.legend(bbox_to_anchor=(0.8, 1), loc=2, borderaxespad=0.) crater.curvature,crater.sigma,crater.h=iCur,iSigma,iH x,y = craterRequest.getProfile(crater) plt.figure(i*2+4) plt.plot(x,y) plt.show() def plotLikelihoodXY(): fig = plt.figure()