Skip to content

Commit

Permalink
Add nopython=True to @jit to avoid a warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
gb119 committed Dec 20, 2023
1 parent 12a4e80 commit 7ffbe98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Stoner/analysis/fitting/models/e_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
"""Model classes and functions for various models of electron transport (other than tunnelling processes)."""
# pylint: disable=invalid-name
__all__ = ["BlochGrueneisen", "FluchsSondheimer", "WLfit", "blochGrueneisen", "fluchsSondheimer", "wlfit"]
__all__ = ["BlochGrueneisen", "FluchsSondheimer", "WLfit",
"blochGrueneisen", "fluchsSondheimer", "wlfit"]

import numpy as np
from scipy.integrate import quad
Expand All @@ -20,7 +21,7 @@
int64 = _dummy()


@jit(float64(float64, int64))
@jit(float64(float64, int64), nopython=True, nogil=True)
def _bgintegrand(x, n):
"""Calculate the integrand for the Bloch Grueneisen model."""
return x**n / ((np.exp(x) - 1) * (1 - np.exp(-x)))
Expand Down Expand Up @@ -60,8 +61,10 @@ def wlfit(B, s0, DS, B1, B2):
WLpt1 = digamma(0.5 + B2 / np.abs(Bi))
WLpt2 = digamma(0.5 + B1 / np.abs(Bi))
else:
WLpt1 = (digamma(0.5 + B2 / np.abs(B[tt - 1])) + digamma(0.5 + B2 / np.abs(B[tt + 1]))) / 2
WLpt2 = (digamma(0.5 + B1 / np.abs(B[tt - 1])) + digamma(0.5 + B1 / np.abs(B[tt + 1]))) / 2
WLpt1 = (digamma(
0.5 + B2 / np.abs(B[tt - 1])) + digamma(0.5 + B2 / np.abs(B[tt + 1]))) / 2
WLpt2 = (digamma(
0.5 + B1 / np.abs(B[tt - 1])) + digamma(0.5 + B1 / np.abs(B[tt + 1]))) / 2

WLpt3 = np.log(B2 / B1)

Expand Down Expand Up @@ -94,7 +97,7 @@ def fluchsSondheimer(t, l, p, sigma_0):
"""
k = t / l

kernel = lambda x, k: (x - x**3) * np.exp(-k * x) / (1 - np.exp(-k * x))
def kernel(x, k): return (x - x**3) * np.exp(-k * x) / (1 - np.exp(-k * x))

result = np.zeros(k.shape)
for i, v in enumerate(k):
Expand Down
2 changes: 1 addition & 1 deletion Stoner/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def _load(self, filename: Filename, *args: Any, **kargs: Any) -> "metadataObject
raise NotImplementedError("Save is not implemented in the base class.")


if pd is not None:
if pd is not None and not hasattr(pd.DataFrame,"metadata"): # Don;t double add metadata

@pd.api.extensions.register_dataframe_accessor("metadata")
class PandasMetadata(typeHintedDict):
Expand Down

0 comments on commit 7ffbe98

Please sign in to comment.