Skip to content

Commit 60b0fdb

Browse files
committed
Squash some bugs
1 parent c2c043e commit 60b0fdb

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

Stoner/Image/imagefuncs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ def imshow(
644644
im,
645645
figure="new",
646646
ax=None,
647-
show_axis=False,
648647
title=None,
649648
title_args=None,
650649
cmap="gray",

Stoner/analysis/fitting/models/superconductivity.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
""":py:class:`lmfit.Model` model classes and functions for various superconductivity related models."""
4+
45
# pylint: disable=invalid-name
56
# This module can be used with Stoner v.0.9.0 asa standalone module
67
__all__ = [
@@ -39,6 +40,12 @@
3940
float64 = _dummy()
4041

4142

43+
@jit(float64[:](float64[:], float64, float64), nopython=True, parallel=True, nogil=True)
44+
def _normalized_gaussian(x, mu=0, sigma=1):
45+
"""Normalised gaussian function."""
46+
return (1 / (sigma * np.sqrt(2 * np.pi))) * np.exp(-((x - mu) ** 2) / (2 * sigma**2))
47+
48+
4249
@jit(float64[:](float64[:], float64, float64, float64, float64), nopython=True, parallel=True, nogil=True)
4350
def _strijkers_core(V, omega, delta, P, Z):
4451
"""Implement strijkers Model for point-contact Andreev Reflection Spectroscopy.
@@ -62,8 +69,7 @@ def _strijkers_core(V, omega, delta, P, Z):
6269

6370
mv = np.max(np.abs(V)) # Limit for evaluating the integrals
6471
E = np.linspace(-2 * mv, 2 * mv, V.size * 20) # Energy range in meV - we use a mesh 20x denser than data points
65-
gauss = np.exp(-(E**2 / (2 * omega**2)))
66-
gauss /= gauss.sum() # Normalised gaussian for the convolution
72+
gauss = _normalized_gaussian(E, 0, omega)
6773

6874
# Conductance calculation
6975
# For ease of calculation, epsilon = E/(sqrt(E^2 - delta^2))
@@ -74,12 +80,13 @@ def _strijkers_core(V, omega, delta, P, Z):
7480
# Ap is always zero as the polarised current has 0 prob for an Andreev
7581
# event
7682

77-
Au1 = (delta**2) / ((E**2) + (((delta**2) - (E**2)) * (1 + 2 * (Z**2)) ** 2))
78-
Au2 = (((np.abs(E) / (np.sqrt((E**2) - (delta**2)))) ** 2) - 1) / (
79-
((np.abs(E) / (np.sqrt((E**2) - (delta**2)))) + (1 + 2 * (Z**2))) ** 2
83+
Au = (
84+
(delta**2) / ((E**2) + (((delta**2) - (E**2)) * (1 + 2 * (Z**2)) ** 2)),
85+
(((np.abs(E) / (np.sqrt((E**2) - (delta**2)))) ** 2) - 1)
86+
/ (((np.abs(E) / (np.sqrt((E**2) - (delta**2)))) + (1 + 2 * (Z**2))) ** 2),
8087
)
8188
Bu2 = (4 * (Z**2) * (1 + (Z**2))) / (((np.abs(E) / (np.sqrt((E**2) - (delta**2)))) + (1 + 2 * (Z**2))) ** 2)
82-
Bp2 = Bu2 / (1 - Au2)
89+
Bp2 = Bu2 / (1 - Au[1])
8390

8491
unpolarised_prefactor = (1 - P) * (1 + (Z**2))
8592
polarised_prefactor = 1 * (P) * (1 + (Z**2))
@@ -89,21 +96,18 @@ def _strijkers_core(V, omega, delta, P, Z):
8996
+ polarised_prefactor
9097
+ +np.where(
9198
np.abs(E) <= delta,
92-
unpolarised_prefactor * (2 * Au1 - 1) - np.ones_like(E) * polarised_prefactor,
93-
unpolarised_prefactor * (Au2 - Bu2) - Bp2 * polarised_prefactor,
99+
unpolarised_prefactor * (2 * Au[0] - 1) - np.ones_like(E) * polarised_prefactor,
100+
unpolarised_prefactor * (Au[1] - Bu2) - Bp2 * polarised_prefactor,
94101
)
95102
)
96103

97104
# Convolve and chop out the central section
98-
cond = np.convolve(G, gauss)
99-
cond = cond[(E.size // 2) : 3 * (E.size // 2)]
105+
cond = np.convolve(G, gauss)[(E.size // 2) : 3 * (E.size // 2)]
100106
# Linear interpolation back onto the V data point
101107
matches = np.searchsorted(E, V)
102-
condl = cond[matches - 1]
103-
condh = cond[matches]
104-
El = E[matches - 1]
105-
Er = E[matches]
106-
cond = (condh - condl) / (Er - El) * (V - El) + condl
108+
cond = (cond[matches] - cond[matches - 1]) / (E[matches] - E[matches - 1]) * (V - E[matches - 1]) + cond[
109+
matches - 1
110+
]
107111
return cond
108112

109113

@@ -314,7 +318,7 @@ def integrad(mu, m):
314318
def prefactor(m):
315319
return delta**2 / (delta**2 + w_m(m) ** 2)
316320

317-
def term(m):
321+
def term(m): # pylint: disable=unused-variable
318322
return prefactor(m) * quad(integrad, -1, 1, (m,)) # pylint: disable=W0612
319323

320324

Stoner/core/operators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def __invert__(self):
247247
ret.setas = setas
248248
return ret #
249249

250-
def __read_iterable(self, reader):
250+
def __read_iterable(self, reader): # pylint: disable=unused-private-member
251251
"""Read a string representation of py:class:`DataFile` in line by line."""
252252
if isiterable(reader):
253253
reader = iter(reader)

Stoner/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def assemnle_data(datafile, **kwargs):
165165
return_data.working = return_data.working[~return_data.working.mask[:, 0]]
166166
# Now check for sigma_y and sigma_x and have them default to sigma (which in turn defaults to None)
167167
_assemble_x_data(_.xcol, datafile, return_data)
168-
for i, yc in enumerate(ycol):
168+
for i in range(len(ycol)):
169169
for col, attr in zip(["ycol", "zcol", "ucol", "vcol", "wcol"], "yzuvw"):
170170
col = getattr(_, col)
171171
if isinstance(col, list) and len(col) > i:

0 commit comments

Comments
 (0)