diff --git a/examples/plotting/README.rst b/examples/plotting/README.rst new file mode 100644 index 000000000..65308cd96 --- /dev/null +++ b/examples/plotting/README.rst @@ -0,0 +1,3 @@ +Plotting +=============== +Below is a gallery of examples on how to make nice plots with Matplotlib from hyperspy/ pyxem signals. \ No newline at end of file diff --git a/examples/plotting/making_a_gif.py b/examples/plotting/making_a_gif.py new file mode 100644 index 000000000..0835907e7 --- /dev/null +++ b/examples/plotting/making_a_gif.py @@ -0,0 +1,8 @@ +""" +============ +Making a Gif +============ + +This example shows how to create a gif from a series of images. Here we use the "hyperspy" idea of a +signal and navigation axes to create a series of images +""" diff --git a/pyxem/__init__.py b/pyxem/__init__.py index 64c2fde7e..e2bf0ab6f 100644 --- a/pyxem/__init__.py +++ b/pyxem/__init__.py @@ -26,9 +26,6 @@ except ImportError: CUPY_INSTALLED = False -_logger = logging.getLogger(__name__) - - from pyxem import components from pyxem import detectors from pyxem import dummy_data @@ -38,6 +35,10 @@ from . import release_info + +_logger = logging.getLogger(__name__) + + __all__ = [ "components", "detectors", diff --git a/pyxem/generators/displacement_gradient_tensor_generator.py b/pyxem/generators/displacement_gradient_tensor_generator.py index 964814cd1..dccd6c96e 100644 --- a/pyxem/generators/displacement_gradient_tensor_generator.py +++ b/pyxem/generators/displacement_gradient_tensor_generator.py @@ -141,7 +141,6 @@ def get_single_DisplacementGradientTensor( # see https://stackoverflow.com/questions/27128688 weights = np.asarray(weights) # Need vectors normalized to the unstrained region otherwise the weighting breaks down - norm = np.linalg.norm(Vu, axis=1) Vs = (np.divide(Vs.T, np.linalg.norm(Vu, axis=1)) * np.sqrt(weights)).T Vu = (np.divide(Vu.T, np.linalg.norm(Vu, axis=1)) * np.sqrt(weights)).T else: diff --git a/pyxem/signals/__init__.py b/pyxem/signals/__init__.py index 160ef9bb9..167da8cc4 100644 --- a/pyxem/signals/__init__.py +++ b/pyxem/signals/__init__.py @@ -74,15 +74,21 @@ "DiffractionVectors1D", "DiffractionVectors2D", "Diffraction1D", + "LazyDiffraction1D", + "LazyDiffraction2D", "Diffraction2D", "ElectronDiffraction1D", + "LazyElectronDiffraction1D", + "LazyElectronDiffraction2D", "ElectronDiffraction2D", "VectorMatchingResults", "PairDistributionFunction1D", "PolarDiffraction2D", + "LazyPolarDiffraction2D", "PolarVectors", "LazyPolarVectors", "Power2D", + "LazyPower2D", "ReducedIntensity1D", "LearningSegment", "VDFSegment", diff --git a/pyxem/signals/diffraction2d.py b/pyxem/signals/diffraction2d.py index 2de32b523..86980f392 100644 --- a/pyxem/signals/diffraction2d.py +++ b/pyxem/signals/diffraction2d.py @@ -32,12 +32,6 @@ from pyxem.signals import ( CommonDiffraction, - DPCBaseSignal, - DPCSignal1D, - DPCSignal2D, - LazyDPCBaseSignal, - LazyDPCSignal1D, - LazyDPCSignal2D, ) from pyxem.utils.pyfai_utils import ( get_azimuthal_integrator, @@ -48,7 +42,6 @@ azimuthal_integrate1d, azimuthal_integrate2d, gain_normalise, - regional_filter, remove_bad_pixels, circular_mask, find_beam_offset_cross_correlation, @@ -75,7 +68,6 @@ from pyxem.utils.signal import ( select_method_from_method_dict, to_hyperspy_index, - transfer_navigation_axes, ) import pyxem.utils._pixelated_stem_tools as pst import pyxem.utils.dask_tools as dt diff --git a/pyxem/signals/diffraction_vectors.py b/pyxem/signals/diffraction_vectors.py index 69db1c378..ae40c5236 100644 --- a/pyxem/signals/diffraction_vectors.py +++ b/pyxem/signals/diffraction_vectors.py @@ -23,7 +23,6 @@ import matplotlib import matplotlib.pyplot as plt from scipy.spatial import distance_matrix -from sklearn.cluster import DBSCAN import dask.array as da from hyperspy.signals import BaseSignal, Signal1D diff --git a/pyxem/signals/labeled_diffraction_vectors2d.py b/pyxem/signals/labeled_diffraction_vectors2d.py index 90686e3bd..7c300146a 100644 --- a/pyxem/signals/labeled_diffraction_vectors2d.py +++ b/pyxem/signals/labeled_diffraction_vectors2d.py @@ -18,7 +18,6 @@ from pyxem.signals.diffraction_vectors2d import DiffractionVectors2D -from scipy.spatial.distance import cdist import numpy as np import matplotlib.pyplot as plt diff --git a/pyxem/signals/reduced_intensity1d.py b/pyxem/signals/reduced_intensity1d.py index cb55be9d6..3e5075134 100644 --- a/pyxem/signals/reduced_intensity1d.py +++ b/pyxem/signals/reduced_intensity1d.py @@ -21,8 +21,6 @@ import numpy as np from pyxem.components import ReducedIntensityCorrectionComponent -from diffsims.utils.atomic_scattering_params import ATOMIC_SCATTERING_PARAMS -from diffsims.utils.lobato_scattering_params import ATOMIC_SCATTERING_PARAMS_LOBATO from scipy import special diff --git a/pyxem/signals/tensor_field.py b/pyxem/signals/tensor_field.py index ecaac7dde..213695eeb 100644 --- a/pyxem/signals/tensor_field.py +++ b/pyxem/signals/tensor_field.py @@ -99,7 +99,7 @@ def get_strain_maps(self): e11 = np.reciprocal(U.isig[0, 0].T) - 1 e12 = U.isig[0, 1].T - e21 = U.isig[1, 0].T + # e21 = U.isig[1, 0].T # Same as e12 e22 = np.reciprocal(U.isig[1, 1].T) - 1 theta = R.map(_get_rotation_angle, inplace=False) theta = theta.transpose(2) diff --git a/pyxem/tests/components/test_red_int_correction_component.py b/pyxem/tests/components/test_red_int_correction_component.py deleted file mode 100644 index 5637a8129..000000000 --- a/pyxem/tests/components/test_red_int_correction_component.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2016-2024 The pyXem developers -# -# This file is part of pyXem. -# -# pyXem is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# pyXem is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with pyXem. If not, see . - -import pytest -import numpy as np -import diffpy.structure