<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def spectral_variance(self, stride, fftlength=None, overlap=None, method=DEFAULT_FFT_METHOD, window='hann', nproc=1, filter=None, bins=None, low=None, high=None, nbins=500, log=False, norm=False, density=False):
 """Calculate the `SpectralVariance` of this `TimeSeries`. Parameters stride : `float` number of seconds in single PSD (column of spectrogram) fftlength : `float` number of seconds in single FFT method : `str`, optional FFT-averaging method, see *Notes* for more details overlap : `float`, optional number of seconds of overlap between FFTs, defaults to the recommended overlap for the given window (if given), or 0 window : `str`, `numpy.ndarray`, optional window function to apply to timeseries prior to FFT, see :func:`scipy.signal.get_window` for details on acceptable formats nproc : `int` maximum number of independent frame reading processes, default is set to single-process file reading. bins : `numpy.ndarray`, optional, default `None` array of histogram bin edges, including the rightmost edge low : `float`, optional left edge of lowest amplitude bin, only read if ``bins`` is not given high : `float`, optional right edge of highest amplitude bin, only read if ``bins`` is not given nbins : `int`, optional number of bins to generate, only read if ``bins`` is not given log : `bool`, optional calculate amplitude bins over a logarithmic scale, only read if ``bins`` is not given norm : `bool`, optional normalise bin counts to a unit sum density : `bool`, optional normalise bin counts to a unit integral Returns ------- specvar : `SpectralVariance` 2D-array of spectral frequency-amplitude counts See Also -------- :func:`numpy.histogram` for details on specifying bins and weights 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 """

        specgram = self.spectrogram(stride, fftlength=fftlength,
                                    overlap=overlap, method=method,
                                    window=window, nproc=nproc) ** (1/2.)
        if filter:
            specgram = specgram.filter(*filter)
        return specgram.variance(bins=bins, low=low, high=high, nbins=nbins,
                                 log=log, norm=norm, density=density)