def normalize_fft_params(series, kwargs=None, func=None):
<EOL>if kwargs is None:<EOL><INDENT>kwargs = dict()<EOL><DEDENT>samp = series.sample_rate<EOL>fftlength = kwargs.pop('<STR_LIT>', None) or series.duration<EOL>overlap = kwargs.pop('<STR_LIT>', None)<EOL>window = kwargs.pop('<STR_LIT>', None)<EOL>if func is None:<EOL><INDENT>method = library = None<EOL><DEDENT>else:<EOL><INDENT>method = func.__name__<EOL>library = _fft_library(func)<EOL><DEDENT>nfft = seconds_to_samples(fftlength, samp)<EOL>noverlap = _normalize_overlap(overlap, window, nfft, samp, method=method)<EOL>window = _normalize_window(window, nfft, library, series.dtype)<EOL>if window is not None:  <EOL><INDENT>kwargs['<STR_LIT>'] = window<EOL><DEDENT>if library == '<STR_LIT>' and kwargs.get('<STR_LIT>', None) is None:<EOL><INDENT>from ._lal import generate_fft_plan<EOL>kwargs['<STR_LIT>'] = generate_fft_plan(nfft, dtype=series.dtype)<EOL><DEDENT>kwargs.update({<EOL>'<STR_LIT>': nfft,<EOL>'<STR_LIT>': noverlap,<EOL>})<EOL>return kwargs<EOL>
Normalize a set of FFT parameters for processing

    This method reads the ``fftlength`` and ``overlap`` keyword arguments
    (presumed to be values in seconds), works out sensible defaults,
    then updates ``kwargs`` in place to include ``nfft`` and ``noverlap``
    as values in sample counts.

    If a ``window`` is given, the ``noverlap`` parameter will be set to the
    recommended overlap for that window type, if ``overlap`` is not given.

    If a ``window`` is given as a `str`, it will be converted to a
    `numpy.ndarray` containing the correct window (of the correct length).

    Parameters
    ----------
    series : `gwpy.timeseries.TimeSeries`
        the data that will be processed using an FFT-based method

    kwargs : `dict`
        the dict of keyword arguments passed by the user

    func : `callable`, optional
        the FFT method that will be called

    Examples
    --------
    >>> from numpy.random import normal
    >>> from gwpy.timeseries import TimeSeries
    >>> normalize_fft_params(TimeSeries(normal(size=1024), sample_rate=256))
    {'nfft': 1024, 'noverlap': 0}
    >>> normalize_fft_params(TimeSeries(normal(size=1024), sample_rate=256),
    ...                      {'window': 'hann'})
    {'window': array([  0.00000000e+00,   9.41235870e-06, ...,
         3.76490804e-05,   9.41235870e-06]), 'noverlap': 0, 'nfft': 1024}