pymks/filter.py
def resize(self, size):
        """
        Changes the size of the kernel to size.

        Args:
          size: tuple with the shape of the new kernel
        """
        if len(size) != len(self.Fkernel.shape[1:-1]):
            raise RuntimeError("length of resize shape is incorrect.")
        if not np.all(size >= self.Fkernel.shape[1:-1]):
            raise RuntimeError("resize shape is too small.")

        kernel = self._frequency_2_real()
        size = kernel.shape[:1] + size + kernel.shape[-1:]
        padsize = np.array(size) - np.array(kernel.shape)
        paddown = padsize // 2
        padup = padsize - paddown
        padarray = np.concatenate((padup[..., None],
                                   paddown[..., None]), axis=1)
        pads = tuple([tuple(p) for p in padarray])
        kernel_pad = np.pad(kernel, pads, 'constant', constant_values=0)
        Fkernel_pad = self._real_2_frequency(kernel_pad)

        self.Fkernel = Fkernel_pad

        Changes the size of the kernel to size.

        Args:
          size: tuple with the shape of the new kernel
        
Changes the size of the kernel to size.
Changes the size of the kernel to size .
def resize(self, size):
        if len(size) != len(self.Fkernel.shape[1:-1]):
            raise RuntimeError("length of resize shape is incorrect.")
        if not np.all(size >= self.Fkernel.shape[1:-1]):
            raise RuntimeError("resize shape is too small.")
        kernel = self._frequency_2_real()
        size = kernel.shape[:1] + size + kernel.shape[-1:]
        padsize = np.array(size) - np.array(kernel.shape)
        paddown = padsize // 2
        padup = padsize - paddown
        padarray = np.concatenate((padup[..., None],
                                   paddown[..., None]), axis=1)
        pads = tuple([tuple(p) for p in padarray])
        kernel_pad = np.pad(kernel, pads, 'constant', constant_values=0)
        Fkernel_pad = self._real_2_frequency(kernel_pad)
        self.Fkernel = Fkernel_pad
def resize ( self , size ) : if len ( size ) != len ( self . Fkernel . shape [ 1 : - 1 ] ) : raise RuntimeError ( "length of resize shape is incorrect." ) if not np . all ( size >= self . Fkernel . shape [ 1 : - 1 ] ) : raise RuntimeError ( "resize shape is too small." ) kernel = self . _frequency_2_real ( ) size = kernel . shape [ : 1 ] + size + kernel . shape [ - 1 : ] padsize = np . array ( size ) - np . array ( kernel . shape ) paddown = padsize // 2 padup = padsize - paddown padarray = np . concatenate ( ( padup [ ... , None ] , paddown [ ... , None ] ) , axis = 1 ) pads = tuple ( [ tuple ( p ) for p in padarray ] ) kernel_pad = np . pad ( kernel , pads , 'constant' , constant_values = 0 ) Fkernel_pad = self . _real_2_frequency ( kernel_pad ) self . Fkernel = Fkernel_pad
Changes the size of the kernel to size.
Changes the size of the kernel to size .
"""
        Changes the size of the kernel to size.

        Args:
          size: tuple with the shape of the new kernel
        """
self
size
tuple with the shape of the new kernel
tuple with the shape of the new kernel