pystella/fourier/dft.py
def zero_corner_modes(self, array, only_imag=False):
        """
        Zeros the "corner" modes (modes where each component of its
        integral wavenumber is either zero or the Nyquist along
        that axis) of ``array`` (or just the imaginary part).

        :arg array: The array to operate on.
            May be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.

        :arg only_imag: A :class:`bool` determining whether to only
            set the imaginary part of the array to zero.
            Defaults to *False*, i.e., setting the mode to ``0+0j``.
        """

        sub_k = list(x.get().astype("int") for x in self.sub_k.values())
        shape = self.grid_shape

        where_to_zero = []
        for mu in range(3):
            kk = sub_k[mu]
            where_0 = np.argwhere(abs(kk) == 0).reshape(-1)
            where_N2 = np.argwhere(abs(kk) == shape[mu]//2).reshape(-1)
            where_to_zero.append(np.concatenate([where_0, where_N2]))

        from itertools import product
        for i, j, k in product(*where_to_zero):
            if only_imag:
                array[i, j, k] = array[i, j, k].real
            else:
                array[i, j, k] = 0.

        return array

        Zeros the "corner" modes (modes where each component of its
        integral wavenumber is either zero or the Nyquist along
        that axis) of ``array`` (or just the imaginary part).

        :arg array: The array to operate on.
            May be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.

        :arg only_imag: A :class:`bool` determining whether to only
            set the imaginary part of the array to zero.
            Defaults to *False*, i.e., setting the mode to ``0+0j``.
        
Zeros the "corner" modes (modes where each component of its
integral wavenumber is either zero or the Nyquist along
that axis) of ``array`` (or just the imaginary part).
Zeros the " corner " modes ( modes where each component of its integral wavenumber is either zero or the Nyquist along that axis ) of ` ` array ` ` ( or just the imaginary part ) .
def zero_corner_modes(self, array, only_imag=False):
        sub_k = list(x.get().astype("int") for x in self.sub_k.values())
        shape = self.grid_shape
        where_to_zero = []
        for mu in range(3):
            kk = sub_k[mu]
            where_0 = np.argwhere(abs(kk) == 0).reshape(-1)
            where_N2 = np.argwhere(abs(kk) == shape[mu]//2).reshape(-1)
            where_to_zero.append(np.concatenate([where_0, where_N2]))
        from itertools import product
        for i, j, k in product(*where_to_zero):
            if only_imag:
                array[i, j, k] = array[i, j, k].real
            else:
                array[i, j, k] = 0.
        return array
def zero_corner_modes ( self , array , only_imag = False ) : sub_k = list ( x . get ( ) . astype ( "int" ) for x in self . sub_k . values ( ) ) shape = self . grid_shape where_to_zero = [ ] for mu in range ( 3 ) : kk = sub_k [ mu ] where_0 = np . argwhere ( abs ( kk ) == 0 ) . reshape ( - 1 ) where_N2 = np . argwhere ( abs ( kk ) == shape [ mu ] // 2 ) . reshape ( - 1 ) where_to_zero . append ( np . concatenate ( [ where_0 , where_N2 ] ) ) from itertools import product for i , j , k in product ( * where_to_zero ) : if only_imag : array [ i , j , k ] = array [ i , j , k ] . real else : array [ i , j , k ] = 0. return array
Zeros the "corner" modes (modes where each component of its
integral wavenumber is either zero or the Nyquist along
that axis) of ``array`` (or just the imaginary part).
Zeros the " corner " modes ( modes where each component of its integral wavenumber is either zero or the Nyquist along that axis ) of ` ` array ` ` ( or just the imaginary part ) .
"""
        Zeros the "corner" modes (modes where each component of its
        integral wavenumber is either zero or the Nyquist along
        that axis) of ``array`` (or just the imaginary part).

        :arg array: The array to operate on.
            May be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.

        :arg only_imag: A :class:`bool` determining whether to only
            set the imaginary part of the array to zero.
            Defaults to *False*, i.e., setting the mode to ``0+0j``.
        """
self
array
The array to operate on.
May be a :class:`pyopencl.array.Array` or a :class:`numpy.ndarray`.
The array to operate on . May be a : class : ` pyopencl . array . Array ` or a : class : ` numpy . ndarray ` .
only_imag
A :class:`bool` determining whether to only
set the imaginary part of the array to zero.
Defaults to *False*, i.e., setting the mode to ``0+0j``.
A : class : ` bool ` determining whether to only set the imaginary part of the array to zero . Defaults to * False * i . e . setting the mode to ` ` 0 + 0j ` ` .