@classmethod<EOL><INDENT>def from_spectrogram(cls, *spectrograms, **kwargs):<DEDENT>
<EOL>if not spectrograms:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>bins = kwargs.pop('<STR_LIT>', None)<EOL>low = kwargs.pop('<STR_LIT>', None)<EOL>high = kwargs.pop('<STR_LIT>', None)<EOL>nbins = kwargs.pop('<STR_LIT>', <NUM_LIT>)<EOL>log = kwargs.pop('<STR_LIT>', False)<EOL>norm = kwargs.pop('<STR_LIT>', False)<EOL>density = kwargs.pop('<STR_LIT>', False)<EOL>if norm and density:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>spectrogram = spectrograms[<NUM_LIT:0>]<EOL>data = numpy.vstack(s.value for s in spectrograms)<EOL>if bins is None:<EOL><INDENT>if low is None and log:<EOL><INDENT>low = numpy.log10(data.min() / <NUM_LIT:2>)<EOL><DEDENT>elif low is None:<EOL><INDENT>low = data.min()/<NUM_LIT:2><EOL><DEDENT>elif log:<EOL><INDENT>low = numpy.log10(low)<EOL><DEDENT>if high is None and log:<EOL><INDENT>high = numpy.log10(data.max() * <NUM_LIT:2>)<EOL><DEDENT>elif high is None:<EOL><INDENT>high = data.max() * <NUM_LIT:2><EOL><DEDENT>elif log:<EOL><INDENT>high = numpy.log10(high)<EOL><DEDENT>if log:<EOL><INDENT>bins = numpy.logspace(low, high, num=nbins+<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>bins = numpy.linspace(low, high, num=nbins+<NUM_LIT:1>)<EOL><DEDENT><DEDENT>nbins = bins.size-<NUM_LIT:1><EOL>bins = bins * spectrogram.unit<EOL>out = numpy.zeros((data.shape[<NUM_LIT:1>], nbins))<EOL>for i in range(data.shape[<NUM_LIT:1>]):<EOL><INDENT>out[i, :], bins = numpy.histogram(data[:, i], bins,<EOL>density=density)<EOL>if norm and out[i, :].sum():  <EOL><INDENT>out[i, :] /= out[i, :].sum()<EOL><DEDENT><DEDENT>name = '<STR_LIT>' % spectrogram.name<EOL>new = cls(out, bins, epoch=spectrogram.epoch, name=name,<EOL>channel=spectrogram.channel, f0=spectrogram.f0,<EOL>df=spectrogram.df)<EOL>return new<EOL>
Calculate a new `SpectralVariance` from a
        :class:`~gwpy.spectrogram.Spectrogram`

        Parameters
        ----------
        spectrogram : `~gwpy.spectrogram.Spectrogram`
            input `Spectrogram` data

        bins : `~numpy.ndarray`, optional
            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, default: `500`

        log : `bool`, optional
            calculate amplitude bins over a logarithmic scale, only
            read if ``bins`` is not given, default: `False`

        norm : `bool`, optional
            normalise bin counts to a unit sum, default: `False`

        density : `bool`, optional
            normalise bin counts to a unit integral, default: `False`

        Returns
        -------
        specvar : `SpectralVariance`
            2D-array of spectral frequency-amplitude counts

        See Also
        --------
        :func:`numpy.histogram`
            for details on specifying bins and weights