def relaxedScan3D(xTips, yTips, zTips): ntips = len(zTips) print(" zTips : ", zTips) rTips = np.zeros((ntips, 3)) rs = np.zeros((ntips, 3)) fs = np.zeros((ntips, 3)) rTips[:, 0] = 1.0 rTips[:, 1] = 1.0 rTips[:, 2] = zTips fzs = np.zeros((len(zTips), len(yTips), len(xTips))) for ix, x in enumerate(xTips): print("relax ix:", ix) rTips[:, 0] = x for iy, y in enumerate(yTips): rTips[:, 1] = y itrav = PP.relaxTipStroke(rTips, rs, fs) / float(len(zTips)) fzs[:, iy, ix] = fs[:, 2].copy() return fzs
def relaxedScan3D( xTips, yTips, zTips ): ntips = len(zTips); print " zTips : ",zTips rTips = np.zeros((ntips,3)) rs = np.zeros((ntips,3)) fs = np.zeros((ntips,3)) rTips[:,0] = 1.0 rTips[:,1] = 1.0 rTips[:,2] = zTips fzs = np.zeros(( len(zTips), len(yTips ), len(xTips ) )); for ix,x in enumerate( xTips ): print "relax ix:", ix rTips[:,0] = x for iy,y in enumerate( yTips ): rTips[:,1] = y itrav = PP.relaxTipStroke( rTips, rs, fs ) / float( len(zTips) ) fzs[:,iy,ix] = fs[:,2].copy() return fzs
del FFel ''' plt.figure(figsize=( 5*nslice,5 )); plt.title( ' FF total ' ) for i in range(nslice): plt.subplot( 1, nslice, i+1 ) plt.imshow( FF[i,:,:,2], origin='image', interpolation='nearest' ) ''' print " # ============ Relaxed Scan 3D " for ix,x in enumerate( xTips ): print "relax ix:", ix rTips[:,0] = x for iy,y in enumerate( yTips ): rTips[:,1] = y itrav = PP.relaxTipStroke( rTips, rs, fs ) / float( len(zTips) ) fzs[:,iy,ix] = fs[:,2].copy() #print itrav #if itrav > 100: # print " bad convergence > %i iterations per pixel " % itrav # print " exiting " # break print " # ============ convert Fz -> df " dfs = PP.Fz2df( fzs, dz = dz, k0 = PP.params['kCantilever'], f0=PP.params['f0Cantilever'], n=int(PP.params['Amplitude']/dz) ) print " # ============ Plot Relaxed Scan 3D " #slices = range( PP.params['plotSliceFrom'], PP.params['plotSliceTo'], PP.params['plotSliceBy'] )
del FFel ''' plt.figure(figsize=( 5*nslice,5 )); plt.title( ' FF total ' ) for i in range(nslice): plt.subplot( 1, nslice, i+1 ) plt.imshow( FF[i,:,:,2], origin='image', interpolation='nearest' ) ''' print " # ============ Relaxed Scan 3D " for ix, x in enumerate(xTips): print "relax ix:", ix rTips[:, 0] = x for iy, y in enumerate(yTips): rTips[:, 1] = y itrav = PP.relaxTipStroke(rTips, rs, fs) / float(len(zTips)) fzs[:, iy, ix] = fs[:, 2].copy() #print itrav #if itrav > 100: # print " bad convergence > %i iterations per pixel " % itrav # print " exiting " # break print " # ============ convert Fz -> df " dfs = PP.Fz2df(fzs, dz=dz, k0=PP.params['kCantilever'], f0=PP.params['f0Cantilever'], n=int(PP.params['Amplitude'] / dz))