

def _process(self, overlay, key=None):
    if (len(overlay) != 2):
        raise Exception('Overlay must contain at least to items.')
    [target, kernel] = (overlay.get(0), overlay.get(1))
    if (len(target.vdims) != 1):
        raise Exception('Convolution requires inputs with single value dimensions.')
    xslice = slice(self.p.kernel_roi[0], self.p.kernel_roi[2])
    yslice = slice(self.p.kernel_roi[1], self.p.kernel_roi[3])
    k = (kernel.data if (self.p.kernel_roi == (0, 0, 0, 0)) else kernel[(xslice, yslice)].data)
    fft1 = np.fft.fft2(target.data)
    fft2 = np.fft.fft2(k, s=target.data.shape)
    convolved_raw = np.fft.ifft2((fft1 * fft2)).real
    (k_rows, k_cols) = k.shape
    rolled = np.roll(np.roll(convolved_raw, (- (k_cols // 2)), axis=(- 1)), (- (k_rows // 2)), axis=(- 2))
    convolved = (rolled / float(k.sum()))
    return Image(convolved, bounds=target.bounds, group=self.p.group)

dataset/ETHPy150Open ioam/holoviews/holoviews/operation/element.py convolve._process/original