diff --git a/tools/stm/plot.py b/tools/stm/plot.py index 50ef09a262..edeaa948dd 100644 --- a/tools/stm/plot.py +++ b/tools/stm/plot.py @@ -59,7 +59,7 @@ start_points = [0, 0, 8] end_points = [2, 0, 8] distance = np.linalg.norm(np.array(end_points) - np.array(start_points)) -biases, points, dIdV_map = stm.line_sts(biasstart, biasend, biasstep, start_points, end_points, 50) +biases, points, current, dIdV_map = stm.line_sts(biasstart, biasend, biasstep, start_points, end_points, 50) plt.figure(figsize=(10, 6), dpi=150) diff --git a/tools/stm/stm.py b/tools/stm/stm.py index edf7d8f3a7..a3a493367f 100644 --- a/tools/stm/stm.py +++ b/tools/stm/stm.py @@ -156,8 +156,6 @@ def linescan(self, bias, current, p1, p2, npoints=50, z0=None): def pointcurrent(self, bias, x, y, z): """Current for a single x, y, z position for a given bias.""" - self.read_ldos(bias) - nx = self.ldos.shape[0] ny = self.ldos.shape[1] nz = self.ldos.shape[2] @@ -193,6 +191,7 @@ def sts(self, x, y, z, bias0, bias1, biasstep): for b in np.arange(len(biases)): print(b, biases[b]) + self.read_ldos(biases[b]) current[b] = self.pointcurrent(biases[b], x, y, z) dIdV = np.gradient(current, biasstep) @@ -209,14 +208,21 @@ def line_sts(self, bias0, bias1, biasstep, p1, p2, npoints=50): d = p2 - p1 s = np.dot(d, d)**0.5 biases = np.arange(bias0, bias1 + biasstep, biasstep) + current = np.zeros((npoints, len(biases))) - dIdV = np.zeros((npoints, len(biases))) + for b in np.arange(len(biases)): + print(b, biases[b]) + self.read_ldos(biases[b]) + + for i in range(npoints): + x, y, z = p1 + i * d / (npoints - 1) + current[i, b] = self.pointcurrent(biases[b], x, y, z) + dIdV = np.zeros((npoints, len(biases))) for i in range(npoints): - x, y, z = p1 + i * d / (npoints - 1) - biases, current, dIdV[i, :] = self.sts(x, y, z, bias0, bias1, biasstep) + dIdV[i, :] = np.gradient(current[i, :], biasstep) - return biases, np.linspace(0, s, npoints), dIdV + return biases, np.linspace(0, s, npoints), current, dIdV def find_current(self, ldos, z):