How to use the pyxem.signals.diffraction_profile.DiffractionProfile function in pyxem

To help you get started, we’ve selected a few pyxem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyxem / pyxem / pyxem / signals / electron_diffraction.py View on Github external
"""
        # TODO: fix for case when data is singleton
        if centers is None:
            centers = self.get_direct_beam_position(radius=10)
        centers = Signal1D(centers)

        # TODO: the cython implementation is throwing dtype errors
        radial_profiles = self.map(radial_average, center=centers,
                                   inplace=False, cython=False)
        ragged = len(radial_profiles.data.shape) == 1
        if ragged:
            max_len = max(map(len, radial_profiles.data))
            radial_profiles = Signal1D([
                np.pad(row.reshape(-1,), (0, max_len-len(row)), mode="constant", constant_values=0)
                for row in radial_profiles.data])
            return DiffractionProfile(radial_profiles)
        else:
            radial_profiles.axes_manager.signal_axes[0].offset = 0
            signal_axis = radial_profiles.axes_manager.signal_axes[0]
            return DiffractionProfile(radial_profiles.as_signal1D(signal_axis))
github pyxem / pyxem / pyxem / signals / electron_diffraction.py View on Github external
centers = Signal1D(centers)

        # TODO: the cython implementation is throwing dtype errors
        radial_profiles = self.map(radial_average, center=centers,
                                   inplace=False, cython=False)
        ragged = len(radial_profiles.data.shape) == 1
        if ragged:
            max_len = max(map(len, radial_profiles.data))
            radial_profiles = Signal1D([
                np.pad(row.reshape(-1,), (0, max_len-len(row)), mode="constant", constant_values=0)
                for row in radial_profiles.data])
            return DiffractionProfile(radial_profiles)
        else:
            radial_profiles.axes_manager.signal_axes[0].offset = 0
            signal_axis = radial_profiles.axes_manager.signal_axes[0]
            return DiffractionProfile(radial_profiles.as_signal1D(signal_axis))