@@ -123,7 +123,7 @@ def scan2(self, bias, z, repeat=(1, 1)):
123123 # Returing scan with axes in Angstrom.
124124 return x , y , current
125125
126-
126+
127127 def linescan (self , bias , current , p1 , p2 , npoints = 50 , z0 = None ):
128128 """Constant current line scan.
129129
@@ -225,6 +225,30 @@ def line_sts(self, bias0, bias1, biasstep, p1, p2, npoints=50):
225225 return biases , np .linspace (0 , s , npoints ), current , dIdV
226226
227227
228+ def line_sts_ave (self , bias0 , bias1 , biasstep , npoints = 50 ):
229+
230+ biases = np .arange (bias0 , bias1 + biasstep , biasstep )
231+ current = np .zeros ((npoints , len (biases )))
232+
233+ for b in np .arange (len (biases )):
234+ print (b , biases [b ])
235+ self .read_ldos (biases [b ])
236+ nz = self .ldos .shape [2 ]
237+
238+ for i in range (npoints ):
239+ z = i / (npoints - 1 ) * nz
240+ dz = z - np .floor (z )
241+ z = int (z ) % nz
242+ current [i , b ] = ((1 - dz ) * self .ldos [:, :, z ].mean () +
243+ dz * self .ldos [:, :, (z + 1 ) % nz ].mean ())
244+
245+ dIdV = np .zeros ((npoints , len (biases )))
246+ for i in range (npoints ):
247+ dIdV [i , :] = np .gradient (current [i , :], biasstep )
248+
249+ return biases , np .linspace (0 , 1 , npoints ), current , dIdV
250+
251+
228252 def find_current (self , ldos , z ):
229253 """ Finds current for given LDOS at height z."""
230254 nz = self .ldos .shape [2 ]
@@ -279,4 +303,4 @@ def find_height(ldos, current, h, z0=None):
279303def delta (biases , bias , width ):
280304 """Return a delta-function centered at 'bias'"""
281305 x = - ((biases - bias ) / width )** 2
282- return np .exp (x ) / (np .sqrt (np .pi ) * width )
306+ return np .exp (x ) / (np .sqrt (np .pi ) * width )
0 commit comments