<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def whiten(self, fftlength=None, overlap=0, method=DEFAULT_FFT_METHOD, window='hanning', detrend='constant', asd=None, fduration=2, highpass=None, **kwargs):
 """Whiten this `TimeSeries` using inverse spectrum truncation Parameters fftlength : `float`, optional FFT integration length (in seconds) for ASD estimation, default: choose based on sample rate overlap : `float`, optional number of seconds of overlap between FFTs, defaults to the recommended overlap for the given window (if given), or 0 method : `str`, optional FFT-averaging method window : `str`, `numpy.ndarray`, optional window function to apply to timeseries prior to FFT, default: ``'hanning'`` see :func:`scipy.signal.get_window` for details on acceptable formats detrend : `str`, optional type of detrending to do before FFT (see `~TimeSeries.detrend` for more details), default: ``'constant'`` asd : `~gwpy.frequencyseries.FrequencySeries`, optional the amplitude spectral density using which to whiten the data, overrides other ASD arguments, default: `None` fduration : `float`, optional duration (in seconds) of the time-domain FIR whitening filter, must be no longer than `fftlength`, default: 2 seconds highpass : `float`, optional highpass corner frequency (in Hz) of the FIR whitening filter, default: `None` **kwargs other keyword arguments are passed to the `TimeSeries.asd` method to estimate the amplitude spectral density `FrequencySeries` of this `TimeSeries` Returns ------- out : `TimeSeries` a whitened version of the input data with zero mean and unit variance See Also -------- TimeSeries.asd for details on the ASD calculation TimeSeries.convolve for details on convolution with the overlap-save method gwpy.signal.filter_design.fir_from_transfer for FIR filter design through spectrum truncation Notes ----- The accepted ``method`` arguments are: - ``'bartlett'`` : a mean average of non-overlapping periodograms - ``'median'`` : a median average of overlapping periodograms - ``'welch'`` : a mean average of overlapping periodograms The ``window`` argument is used in ASD estimation, FIR filter design, and in preventing spectral leakage in the output. Due to filter settle-in, a segment of length ``0.5*fduration`` will be corrupted at the beginning and end of the output. See `~TimeSeries.convolve` for more details. The input is detrended and the output normalised such that, if the input is stationary and Gaussian, then the output will have zero mean and unit variance. For more on inverse spectrum truncation, see arXiv:gr-qc/0509116. """

        # compute the ASD
        fftlength = fftlength if fftlength else _fft_length_default(self.dt)
        if asd is None:
            asd = self.asd(fftlength, overlap=overlap,
                           method=method, window=window, **kwargs)
        asd = asd.interpolate(1./self.duration.decompose().value)
        # design whitening filter, with highpass if requested
        ncorner = int(highpass / asd.df.decompose().value) if highpass else 0
        ntaps = int((fduration * self.sample_rate).decompose().value)
        tdw = filter_design.fir_from_transfer(1/asd.value, ntaps=ntaps,
                                              window=window, ncorner=ncorner)
        # condition the input data and apply the whitening filter
        in_ = self.copy().detrend(detrend)
        out = in_.convolve(tdw, window=window)
        return out * numpy.sqrt(2 * in_.dt.decompose().value)