def createBasinPointsPlane(self,p,v): import matplotlib.pyplot as plt self.planes =CurveFit.Planes() pointCnt = 200 self.xp = np.empty(pointCnt) self.yp = np.empty(pointCnt) self.zp = np.empty(pointCnt) for i in range(pointCnt): self.xp[i] = np.random.random_integers(0,self.xlen) self.yp[i] = np.random.random_integers(0,self.ylen) self.zp[i] = self.planes.depth(p,v,self.xp[i],self.yp[i]) self.cf = CurveFit.curveFit(self.xp, self.yp, self.zp, self.res) self.tck = self.cf.fitSurface() self.cf.createRegGrid()
def createBasinManual(self): self.createBasinPoints() # x = [294.0, 141.0, 252.0, 426.0, 178.0, 19.0, 499.0, 63.0, 321.0, 162.0] # y = [422.0, 408.0, 146.0, 264.0, 430.0, 19.0, 431.0, 284.0, 63.0, 56.0] # z = [3.81, 6.43, 6.00, 6.97, 4.4, 2.49, 0.1, 2.31, 4.98, 0] x = [29.40, 14.10, 25.20, 42.60, 17.80, 1.90, 49.90, 6.30, 32.10, 16.20] y = [42.20, 40.80, 14.60, 26.40, 43.00, 1.90, 43.10, 28.40, 6.30, 5.60] z = [3.81, 6.43, 6.00, 6.97, 4.4, 2.49, 0.1, 2.31, 4.98, 0] #fig3 = plt.figure() #ax = fig3.add_subplot(111, projection='3d') #ax.scatter(x[:],y[:],z[:], c='r', marker='.') for i in range(self.xtrapoints): # print i, self.xp[i+self.xlen*2], self.yp[i+self.xlen*2], self.zp[i+self.xlen*2] self.xp[i+self.xlen*2] = x[i] self.yp[i+self.xlen*2] = y[i] self.zp[i+self.xlen*2] = z[i] # print i, self.xp[i+self.xlen*2], self.yp[i+self.xlen*2], self.zp[i+self.xlen*2] self.cf = CurveFit.curveFit(self.xp, self.yp, self.zp, self.res) self.tck = self.cf.fitSurface() self.cf.createRegGrid() self.cf.clamp(self.minz,self.maxz)
def createBasin(self, flat = False, manPoints = [], edgePoints = 10): self.createBasinPoints(flat, manPoints, edgePoints) self.cf = CurveFit.curveFit(self.xp, self.yp, self.zp, self.res) self.tck = self.cf.fitSurface() self.cf.createRegGrid() self.cf.clamp(self.minz,self.maxz)