def whiten(series, fftlength, overlap=None, method='median', window='hann',
    detrend='linear'):
    """Whiten a `TimeSeries` against its own ASD

    Parameters
    ----------
    series : `~gwpy.timeseries.TimeSeries`
        the `TimeSeries` data to whiten

    fftlength : `float`
        FFT integration length (in seconds) for ASD estimation

    overlap : `float`, optional
        seconds of overlap between FFTs, defaults to half the FFT length

    method : `str`, optional
        FFT-averaging method, default: ``'median'``,

    window : `str`, `numpy.ndarray`, optional
        window function to apply to timeseries prior to FFT,
        default: ``'hann'``
        see :func:`scipy.signal.get_window` for details on acceptable
        formats

    detrend : `str`, optional
        type of detrending to do before FFT, default: ``'linear'``

    Returns
    -------
    wseries : `~gwpy.timeseries.TimeSeries`
        a whitened version of the input data with zero mean and unit variance

    See Also
    --------
    gwpy.timeseries.TimeSeries.whiten
    """
    if overlap is None:
        overlap = fftlength / 2
    return series.whiten(fftlength=fftlength, overlap=overlap, window=
        window, detrend=detrend, method=method).detrend(detrend)
