<commit_before>import numpy as np
import numpy.fft as fft
import warnings

def cfftnc(x, N):
    """
    centered n-dimensional FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(x.ndim), range(x.ndim-N.__len__()), assume_unique=True))
    return fft.fftshift(fft.fftn(fft.ifftshift(x, ax), N), ax)/np.prod(N)

def icfftnc(Fx, N):
    """
    centered n-dimensional inverse FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(Fx.ndim), range(Fx.ndim-N.__len__()), assume_unique=True))
    return fft.fftshift(fft.ifftn(fft.ifftshift(Fx, ax), N), ax).real*np.prod(N)

def fftnc(x, N):
    """
    centered n-dimensional FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(x.ndim), range(x.ndim-N.__len__()), assume_unique=True))
    return fft.fftshift(fft.fftn(x, N), ax)/np.prod(N)

def icfftn(Fx, N):
    """
    centered n-dimensional inverse FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(Fx.ndim), range(Fx.ndim-N.__len__()), assume_unique=True))
    return fft.ifftn(fft.ifftshift(Fx, ax), N).real*np.prod(N)


def fftn(x, N):
    return fft.fftn(x, N)/np.prod(N) # numpy.fft.fftn

def ifftn(x, N):
    return fft.ifftn(x, N).real*np.prod(N) # numpy.fft.fftn

def rfftn(x, N):
    return fft.rfftn(x, N) # real version of numpy.fft.fftn

def irfftn(x, N):
    return fft.irfftn(x, N) # real version of numpy.fft.fftn<commit_msg>small improvement in normalisation in fft<commit_after>import numpy as np
import numpy.fft as fft

def cfftnc(x, N):
    """
    centered n-dimensional FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(x.ndim), range(x.ndim-N.__len__()), assume_unique=True))
    return 1./np.prod(N)*fft.fftshift(fft.fftn(fft.ifftshift(x, ax), N), ax)

def icfftnc(Fx, N):
    """
    centered n-dimensional inverse FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(Fx.ndim), range(Fx.ndim-N.__len__()), assume_unique=True))
    return fft.fftshift(fft.ifftn(fft.ifftshift(Fx, ax), N), ax).real*np.prod(N)

def fftnc(x, N):
    """
    centered n-dimensional FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(x.ndim), range(x.ndim-N.__len__()), assume_unique=True))
    return 1./np.prod(N)*fft.fftshift(fft.fftn(x, N), ax)

def icfftn(Fx, N):
    """
    centered n-dimensional inverse FFT algorithm
    """
    ax=tuple(np.setdiff1d(range(Fx.ndim), range(Fx.ndim-N.__len__()), assume_unique=True))
    return fft.ifftn(fft.ifftshift(Fx, ax), N).real*np.prod(N)


def fftn(x, N):
    return 1./np.prod(N)*fft.fftn(x, N) # numpy.fft.fftn

def ifftn(x, N):
    return fft.ifftn(x, N).real*np.prod(N) # numpy.fft.fftn

def rfftn(x, N):
    return fft.rfftn(x, N) # real version of numpy.fft.fftn

def irfftn(x, N):
    return fft.irfftn(x, N) # real version of numpy.fft.fftn
{'fraction_non_alphanumeric': 0.17519322782480679, 'fraction_numerical': 0.004048582995951417, 'mean_word_length': 3.8106194690265487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '885731', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1168, 'n_words': 210}