return centered squared magnitude

    Parameters
    ----------
    im: 2d array
        A CCS DFT image
    Returns
    -------
    im: 2d array
        A centered image of the magnitude of the DFT

    Notes
    -----
    Check doc Intel* Image Processing Library
    https://www.comp.nus.edu.sg/~cs4243/doc/ipl.pdf

    The center is at position (ys//2, 0)

def centered_mag_sq_ccs(im):
    """return centered squared magnitude

    Parameters
    ----------
    im: 2d array
        A CCS DFT image
    Returns
    -------
    im: 2d array
        A centered image of the magnitude of the DFT

    Notes
    -----
    Check doc Intel* Image Processing Library
    https://www.comp.nus.edu.sg/~cs4243/doc/ipl.pdf

    The center is at position (ys//2, 0)
    """
    im = np.asarray(im)
    # multiply image by image* to get squared magnitude
    im = cv2.mulSpectrums(im, im, flags=0, conjB=True)

    ys = im.shape[0]
    xs = im.shape[1]

    # get correct size return
    ret = np.zeros((ys, xs // 2 + 1))

    # first column:
    # center
    ret[ys // 2, 0] = im[0, 0]
    # bottom
    ret[ys // 2 + 1:, 0] = im[1:ys - 1:2, 0]
    # top (Inverted copy bottom)
    ret[ys // 2 - 1::-1, 0] = im[1::2, 0]

    # center columns
    ret[ys // 2:, 1:] = im[:(ys - 1) // 2 + 1, 1::2]
    ret[:ys // 2, 1:] = im[(ys - 1) // 2 + 1:, 1::2]

    # correct last line if even
    if xs % 2 is 0:
        ret[ys // 2 + 1:, xs // 2] = im[1:ys - 1:2, xs - 1]
        ret[:ys // 2, xs // 2] = 0

    return ret