# The FrequencySeries class¶

While gravitational-wave detectors are time-domain instruments, their sensitivity is frequency dependent and so is often measured as a power-spectral-density over the range of interesting gravitational-wave frequencies (~10-10,000 Hz). Additionally, the auxiliary channels used to sense and control instrumental operations each have their own frequency-domain characteristics, contributing to the overall sensitivity spectrum.

The FrequencySeries object is used to represent any frequency series, including the power-spectral (and amplitude-spectral) density series describing instrument performance.

Analogously to the TimeSeries, a new FrequencySeries can be generated from any data sequence along with the minimal f0 and df metadata:

>>> from gwpy.frequencyseries import FrequencySeries
>>> spec = FrequencySeries([1,2,3,4,5,6,7,8,9,10], f0=0, df=1)
>>> print(spec)
FrequencySeries([ 1  2  3  4  5  6  7  8  9 10],
name: None,
unit: None,
epoch: None,
channel: None,
f0: 0 Hz,
df: 1 Hz,
logf: False)


The full set of metadata that can be provided is as follows:

 name Name for this data set unit The physical unit of these data epoch GPS epoch associated with these data f0 Starting frequency for this FrequencySeries df Frequency spacing of this FrequencySeries

## Generating a FrequencySeries from a TimeSeries¶

The frequency-spectrum of a TimeSeries can be calculated using either of the following methods:

 TimeSeries.psd Calculate the PSD FrequencySeries for this TimeSeries TimeSeries.asd Calculate the ASD FrequencySeries of this TimeSeries

In this example we expand upon plotting a TimeSeries, by calculating the amplitude-spectral density of the gravitational-wave strain data from LHO:

>>> from gwpy.timeseries import TimeSeries
>>> gwdata = TimeSeries.get('H1:LDAS-STRAIN', 'September 16 2010 06:40',
...                         'September 16 2010 06:50')
>>> spectrum = gwdata.asd(8, 4)


where the result is an average spectrum calculated using the Welch method.

## Plotting a FrequencySeries¶

Similary to the TimeSeries, the FrequencySeries object comes with its own plot() method, which will quickly construct a Plot:

>>> plot = spectrum.plot()
>>> ax = plot.gca()
>>> ax.set_xlim(40, 4000)
>>> ax.set_ylabel(r'GW strain ASD [strain$/\sqrt{\mathrm{Hz}}$]')
>>> ax.set_ylim(1e-23, 3e-20)
>>> plot.show()


(png)

## FrequencySeries reference¶

 FrequencySeries(data[, unit, f0, df, ...]) A data array holding some metadata to represent a frequency series SpectralVariance(data, bins[, unit, f0, df, ...]) A 2-dimensional array containing the variance histogram of a frequency-series FrequencySeries