Source code for hexrd.convolution.utils

# Based on code from astropy
# Licensed under a 3-clause BSD style license
import ctypes
import numpy as np

[docs]class DiscretizationError(Exception): """ Called when discretization of models goes wrong. """
[docs]class KernelSizeError(Exception): """ Called when size of kernels is even. """
[docs]def has_even_axis(array): if isinstance(array, (list, tuple)): return not len(array) % 2 else: return any(not axes_size % 2 for axes_size in array.shape)
[docs]def raise_even_kernel_exception(): raise KernelSizeError("Kernel size must be odd in all axes.")