From 5e616993f4a57da3c28cc9832a08cb56f7b92862 Mon Sep 17 00:00:00 2001 From: Gavin Burnell Date: Sat, 2 Jul 2022 20:03:37 +0100 Subject: [PATCH] Tweak to deal with missing scipy.ndimage.measurements.morphology and bump version number --- Stoner/Analysis.py | 5 ++++- Stoner/__init__.py | 2 +- Stoner/tools/decorators.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Stoner/Analysis.py b/Stoner/Analysis.py index 5b182b8cf..8347fdab6 100644 --- a/Stoner/Analysis.py +++ b/Stoner/Analysis.py @@ -160,7 +160,10 @@ def decompose(self, xcol=None, ycol=None, sym=None, asym=None, replace=True, **k ycol = self.find_col(ycol) if isinstance(ycol, list): ycol = ycol[0] # FIXME should work with multiple output columns - pxdata = self.search(xcol, lambda x, r: x > 0, xcol) + if np.abs((self//xcol).min()) 0, xcol) xdata = np.sort(np.append(-pxdata, pxdata)) self.data = self.interpolate(xdata, xcol=xcol) ydata = self.data[:, ycol] diff --git a/Stoner/__init__.py b/Stoner/__init__.py index 238aa6055..01aae61cd 100755 --- a/Stoner/__init__.py +++ b/Stoner/__init__.py @@ -35,7 +35,7 @@ Options = _Options() -__version_info__ = ("0", "10", "4") +__version_info__ = ("0", "10", "5") __version__ = ".".join(__version_info__) __homepath__ = pathlib.Path(__file__).parent.resolve() diff --git a/Stoner/tools/decorators.py b/Stoner/tools/decorators.py index 67086e53f..a2e35ad8f 100755 --- a/Stoner/tools/decorators.py +++ b/Stoner/tools/decorators.py @@ -312,7 +312,10 @@ def actual_decorator(cls): continue # Do not bind all the external functions if we're in ReadTheDocs for fname in dir(mod): if not fname.startswith("_"): - func = getattr(mod, fname) + try: + func = getattr(mod, fname) + except AttributeError: # This shouldn't happen, but it did for scipy.ndimage! + continue fmod = getattr(func, "__module__", getattr(getattr(func, "__class__", None), "__module__", "")) if callable(func) and isinstance(fmod, str) and fmod[:5] in ["Stone", "scipy", "skima"]: if transpose: