SpectralVariance#

class gwpy.frequencyseries.SpectralVariance(
data: ArrayLike,
bins: ArrayLike1D,
unit: UnitLike = None,
f0: Quantity | float | None = None,
df: Quantity | float | None = None,
frequencies: ArrayLike1D | None = None,
name: str | None = None,
channel: Channel | str | None = None,
epoch: SupportsToGps | None = None,
**kwargs,
)[source]#

Bases: Array2D

A variance histogram of a FrequencySeries.

Attributes Summary

T

Transpose is not supported.

bins

Array of bin edges, including the rightmost edge.

df

Frequency spacing of this SpectralVariance.

dy

Size of the first (lowest value) amplitude bin.

f0

Starting frequency for this SpectralVariance.

frequencies

Array of frequencies for each sample

read

Read data into a SpectralVariance.

write

Write this SpectralVariance to a file.

y0

Starting value of the first (lowest value) amplitude bin.

yindex

List of left-hand amplitude bin edges.

yspan

Amplitude range (low, high) spanned by this array.

Methods Summary

from_spectrogram(*spectrograms[, bins, low, ...])

Calculate a new SpectralVariance from a Spectrogram.

percentile(percentile)

Calculate a given spectral percentile for this SpectralVariance.

plot([xscale, method])

Plot the data for this SpectralVariance.

Attributes Documentation

T[source]#

Transpose is not supported.

bins[source]#

Array of bin edges, including the rightmost edge.

Type:

astropy.units.Quantity

df[source]#

Frequency spacing of this SpectralVariance.

dy[source]#

Size of the first (lowest value) amplitude bin.

f0[source]#

Starting frequency for this SpectralVariance.

frequencies[source]#

Array of frequencies for each sample

read#

Read data into a SpectralVariance.

Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats.

Parameters:
sourcestr, os.PathLike, file, or list of these

Source of data, any of the following:

  • Path of a single data file

  • List of data file paths

  • Path of LAL-format cache file

args

Other positional arguments are (in general) specific to the given format. See below for list of acceptable formats.

formatstr, optional

Source format identifier. If not given, the format will be detected if possible. See below for list of acceptable formats.

kwargs

Other keywords are (in general) specific to the given format. See below for list of acceptable formats.

Raises:
IndexError

If source is an empty list.

write#

Write this SpectralVariance to a file.

Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats.

Parameters:
targetstr

Output filename.

formatstr, optional

Output format identifier. If not given, the format will be detected if possible. See below for list of acceptable formats.

y0[source]#

Starting value of the first (lowest value) amplitude bin.

yindex[source]#

List of left-hand amplitude bin edges.

yspan[source]#

Amplitude range (low, high) spanned by this array.

Methods Documentation

classmethod from_spectrogram(
*spectrograms: Spectrogram,
bins: ArrayLike1D | None = None,
low: float | None = None,
high: float | None = None,
nbins: int = 500,
log: bool = False,
norm: bool = False,
density: bool = False,
) Self[source]#

Calculate a new SpectralVariance from a Spectrogram.

Parameters:
*spectrogramsSpectrogram

Input Spectrogram data.

binsndarray, optional

Array of histogram bin edges, including the rightmost edge.

lowfloat, optional

Left edge of lowest amplitude bin, only read if bins is not given.

highfloat, optional

Right edge of highest amplitude bin, only read if bins is not given.

nbinsint, optional

Number of bins to generate, only read if bins is not given, default: 500.

logbool, optional

Calculate amplitude bins over a logarithmic scale, only read if bins is not given, default: False.

normbool, optional

Normalise bin counts to a unit sum, default: False.

densitybool, optional

Normalise bin counts to a unit integral, default: False.

Returns:
specvarSpectralVariance

2D-array of spectral frequency-amplitude counts.

See also

numpy.histogram

The histogram function.

percentile(
percentile: float,
) FrequencySeries[source]#

Calculate a given spectral percentile for this SpectralVariance.

Parameters:
percentilefloat

Percentile (0 - 100) of the bins to compute.

Returns:
spectrumFrequencySeries

The given percentile FrequencySeries calculated from this SpectralVariance.

plot(
xscale: str = 'log',
method: str = 'pcolormesh',
**kwargs,
) Plot[source]#

Plot the data for this SpectralVariance.