本文整理汇总了Python中gwpy.timeseries.TimeSeries.fetch_open_data方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.fetch_open_data方法的具体用法?Python TimeSeries.fetch_open_data怎么用?Python TimeSeries.fetch_open_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gwpy.timeseries.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.fetch_open_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwpy.timeseries import TimeSeries
hoft = TimeSeries.fetch_open_data('H1', 1187007040, 1187009088, tag='C00')
示例2: star
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
The standard metric of the sensitivity of a gravitational-wave detector
is the distance to which a canonical binary neutron star (BNS) inspiral
(with two 1.4 solar mass components) would be detected with a
signal-to-noise ratio (SNR) of 8.
We can estimate using :func:`gwpy.astro.inspiral_range` after calculating
the power-spectral density (PSD) of the strain readout for a detector, and
can plot the variation over time by looping over a power spectral density
:class:`~gwpy.spectrogram.Spectrogram`.
"""
# First, we need to load some data, for this we can use the
# `LOSC <https://losc.ligo.org>`_ public data around the GW150914 event:
from gwpy.timeseries import TimeSeries
h1 = TimeSeries.fetch_open_data('H1', 1126257414, 1126261510)
l1 = TimeSeries.fetch_open_data('L1', 1126257414, 1126261510)
# and then calculating the PSD spectrogram:
h1spec = h1.spectrogram(30, fftlength=4)
l1spec = l1.spectrogram(30, fftlength=4)
# To calculate the inspiral range variation, we need to create a
# :class:`~gwpy.timeseries.TimeSeries` in which to store the values, then
# loop over each PSD bin in the spectrogram, calculating the
# :func:`gwpy.astro.inspiral_range` for each one:
import numpy
from gwpy.astro import inspiral_range
h1range = TimeSeries(numpy.zeros(len(h1spec)),
示例3:
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwosc import datasets
from gwpy.timeseries import TimeSeries
gps = datasets.event_gps('GW170817')
data = TimeSeries.fetch_open_data('L1', gps-34, gps+34, tag='C00')
示例4: noise
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
can wash out transient noise (as is often desired).
The `SpectralVariance` histogram provide by `gwpy.frequencyseries` allows
us to look at the spectral sensitivity in a different manner, displaying
which frequencies sit at which amplitude _most_ of the time, but also
highlighting excursions from normal behaviour.
"""
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.frequencyseries'
# To demonstate this, we can load some data from the LIGO Livingston
# intereferometer around the time of the GW151226 gravitational wave detection:
from gwpy.timeseries import TimeSeries
llo = TimeSeries.fetch_open_data('L1', 1135136228, 1135140324, verbose=True)
# We can then call the :meth:`~gwpy.timeseries.TimeSeries.spectral_variance`
# method of the ``llo`` `~gwpy.timeseries.TimeSeries` by calculating an ASD
# every 5 seconds and counting the amount of time each frequency bin spends
# at each ASD value:
variance = llo.spectral_variance(5, fftlength=2, overlap=1, log=True,
low=1e-24, high=1e-19, nbins=100)
# We can then :meth:`~SpectralVariance.plot` the `SpectralVariance`
plot = variance.plot(norm='log', vmin=.5, cmap='plasma')
ax = plot.gca()
ax.grid()
ax.set_xlim(20, 1500)
示例5: run
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GWpy. If not, see <http://www.gnu.org/licenses/>.
"""Plotting public LIGO data
I would like to study the gravitational wave strain time-series around the time of an interesting simulated signal during the last science run (S6).
These data are public, so we can load them directly from the web.
"""
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.timeseries'
# The `TimeSeries` object has a `classmethod` dedicated to fetching open-access
# data hosted by the LIGO Open Science Center, so we can just import that
# object
from gwpy.timeseries import TimeSeries
# then call the `~TimeSeries.fetch_open_data` method, passing it the prefix
# for the interferometer we want ('L1'), and the GPS start and stop times of
# our query:
data = TimeSeries.fetch_open_data('L1', 968654552, 968654562)
# and then we can make a plot:
plot = data.plot()
plot.set_title('LIGO Livingston Observatory data for GW100916')
plot.set_ylabel('Gravitational-wave strain amplitude')
plot.show()
示例6: int
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.timeseries'
# First, we identify the GPS time of interest:
gps = 968654558
# and use that to define the start and end times of our required data
duration = 32
start = int(round(gps - duration/2.))
end = start + duration
# next, we import the `TimeSeries` and fetch some open data from
# `LOSC <//losc.ligo.org>`_:
from gwpy.timeseries import TimeSeries
data = TimeSeries.fetch_open_data('H1', start, end)
# and next we generate the `~TimeSeries.q_transform` of these data:
qspecgram = data.q_transform()
# Now, we can plot the resulting `~gwpy.spectrogram.Spectrogram`, focusing on a
# specific window around the interesting time
#
# .. note::
#
# Using `~gwpy.spectrogram.Spectrogram.crop` is highly recommended at
# this stage because rendering the high-resolution spectrogram as it is
# done here is very slow (for experts this is because we're using
# `~matplotlib.axes.Axes.pcolormesh` and not any sort of image
# interpolation, mainly to support both linear and log scaling nicely)
示例7: label
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwpy.timeseries import TimeSeries # import the class
data = TimeSeries.fetch_open_data('L1', 968654500, 968654600) # fetch data from LOSC
asd = data.asd(4, 2) # calculated amplitude spectral density with 4-second FFT and 50% overlap
plot = asd.plot() # make plot
ax = plot.gca() # extract Axes
ax.set_xlabel('Frequency [Hz]') # set X-axis label
ax.set_ylabel(r'ASD [strain/\rtHz]') # set Y-axis label (requires latex)
ax.set_xlim(40, 2000) # set X-axis limits
ax.set_ylim(8e-24, 5e-20) # set Y-axis limits
ax.set_title('Strain sensitivity of LLO during S6') # set Axes title
plot.show() # show me the plot
示例8: overlap
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
As described in :ref:`gwpy-example-frequencyseries-rayleigh`, the Rayleigh
statistic can be used to study non-Gaussianity in a timeseries.
We can study the time variance of these features by plotting a
time-frequency spectrogram where we calculate the Rayleigh statistic for
each time bin.
"""
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.spectrogram'
# To demonstate this, we can load some data from the LIGO Livingston
# intereferometer around the time of the GW151226 gravitational wave detection:
from gwpy.timeseries import TimeSeries
gwdata = TimeSeries.fetch_open_data('L1', 'Dec 26 2015 03:37',
'Dec 26 2015 03:47', verbose=True)
# Next, we can calculate a Rayleigh statistic `Spectrogram` using the
# :meth:`~gwpy.timeseries.TimeSeries.rayleigh_spectrogram` method of the
# `~gwpy.timeseries.TimeSeries` and a 5-second stride with a 2-second FFT and
# 1-second overlap (50%):
rayleigh = gwdata.rayleigh_spectrogram(5, fftlength=2, overlap=1)
# and can make a plot using the :meth:`~Spectrogram.plot` method
plot = rayleigh.plot(norm='log', vmin=0.25, vmax=4)
ax = plot.gca()
ax.set_yscale('log')
ax.set_ylim(30, 1500)
ax.set_title('Sensitivity of LIGO-Livingston around GW151226')
plot.add_colorbar(cmap='coolwarm', label='Rayleigh statistic')
plot.show()
示例9:
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwpy.timeseries import TimeSeries
h1 = TimeSeries.fetch_open_data('H1', 1126259457, 1126259467)
l1 = TimeSeries.fetch_open_data('L1', 1126259457, 1126259467)
示例10:
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwpy.timeseries import TimeSeries
data = TimeSeries.fetch_open_data('L1', 1187008866, 1187008898, tag='C00')
specgram = data.spectrogram2(fftlength=.5, overlap=.25,
window='hann') ** (1/2.)
plot = specgram.plot(yscale='log', ylim=(30, 1400))
plot.colorbar(norm='log', clim=(1e-24, 1e-21), label='Strain ASD')
plot.show()
示例11: print
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
print(abs(h1segs.active))
# .. currentmodule:: gwpy.timeseries
#
# Working with strain data
# ------------------------
#
# Now, we can loop through the active segments of ``'H1_DATA'`` and fetch the
# strain `TimeSeries` for each segment, calculating a
# :class:`~gwpy.spectrogram.Spectrogram` for each segment.
from gwpy.timeseries import TimeSeries
spectrograms = []
for start, end in h1segs.active:
h1strain = TimeSeries.fetch_open_data('H1', start, end, verbose=True)
specgram = h1strain.spectrogram(30, fftlength=4) ** (1/2.)
spectrograms.append(specgram)
# Finally, we can build a :meth:`~gwpy.spectrogram.Spectrogram.plot`:
from gwpy.plotter import SpectrogramPlot
plot = SpectrogramPlot()
ax = plot.gca()
for specgram in spectrograms:
ax.plot(specgram)
ax.set_epoch('Sep 16 2010')
ax.set_xlim('Sep 16 2010', 'Sep 17 2010')
ax.set_ylim(40, 2000)
ax.set_yscale('log')
ax.set_ylabel('Frequency [Hz]')
示例12:
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
to calculate discrete PSDs for each stride. This is fine for long-duration
data, but give poor resolution when studying short-duration phenomena.
The `~TimeSeries.spectrogram2` method allows for highly-overlapping FFT
calculations to over-sample the frequency content of the input `TimeSeries`
to produce a much more feature-rich output.
"""
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.timeseries'
# To demonstrate this, we can download some data associated with the
# gravitational-wave event GW510914:
from gwpy.timeseries import TimeSeries
lho = TimeSeries.fetch_open_data('H1', 1126259458, 1126259467, verbose=True)
# and can :meth:`~TimeSeries.highpass` and :meth:`~TimeSeries.whiten`
# the remove low-frequency noise and try and enhance low-amplitude signals
# across the middle of the frequency band:
hp = lho.highpass(20)
white = hp.whiten(4, 2).crop(1126259460, 1126259465)
# .. note::
#
# We chose to :meth:`~TimeSeries.crop` out the leading and trailing 2
# seconds of the the whitened data series here to remove any filtering
# artefacts that may have been introduced.
# Now we can call the `~TimeSeries.spectrogram2` method of `gwdata` to
示例13: overlap
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
One of the most useful methods of visualising gravitational-wave data is to
use a spectrogram, highlighting the frequency-domain content of some data
over a number of time steps.
For this example we can use the public data around the GW150914 detection.
"""
__author__ = "Duncan Macleod <[email protected]>"
__currentmodule__ = 'gwpy.timeseries'
# First, we import the `TimeSeries` and call
# :meth:`TimeSeries.fetch_open_data` the download the strain
# data for the LIGO-Hanford interferometer
from gwpy.timeseries import TimeSeries
data = TimeSeries.fetch_open_data(
'H1', 'Sep 14 2015 09:45', 'Sep 14 2015 09:55')
# Next, we can calculate a `~gwpy.spectrogram.Spectrogram` using the
# :meth:`spectrogram` method of the `TimeSeries` over a 2-second stride
# with a 1-second FFT and # .5-second overlap (50%):
specgram = data.spectrogram(2, fftlength=1, overlap=.5) ** (1/2.)
# .. note::
# :meth:`TimeSeries.spectrogram` returns a Power Spectral Density (PSD)
# `~gwpy.spectrogram.Spectrogram` by default, so we use the ``** (1/2.)``
# to convert this into a (more familiar) Amplitude Spectral Density.
# Finally, we can make a plot using the
# :meth:`~gwpy.spectrogram.Spectrogram.plot` method
plot = specgram.plot(norm='log', vmin=5e-24, vmax=1e-19)
ax = plot.gca()
示例14: import
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
from gwpy.timeseries import (TimeSeries, StateVector)
print(TimeSeries.fetch_open_data('H1', 1126259446, 1126259478))
# TimeSeries([ 2.17704028e-19, 2.08763900e-19, 2.39681183e-19,
# ..., 3.55365541e-20, 6.33533516e-20,
# 7.58121195e-20]
# unit: Unit(dimensionless),
# t0: 1126259446.0 s,
# dt: 0.000244140625 s,
# name: Strain,
# channel: None)
print(StateVector.fetch_open_data('H1', 1126259446, 1126259478))
# StateVector([127,127,127,127,127,127,127,127,127,127,127,127,
# 127,127,127,127,127,127,127,127,127,127,127,127,
# 127,127,127,127,127,127,127,127]
# unit: Unit(dimensionless),
# t0: 1126259446.0 s,
# dt: 1.0 s,
# name: Data quality,
# channel: None,
# bits: Bits(0: data present
# 1: passes cbc CAT1 test
# 2: passes cbc CAT2 test
# 3: passes cbc CAT3 test
# 4: passes burst CAT1 test
# 5: passes burst CAT2 test
# 6: passes burst CAT3 test,
# channel=None,
# epoch=1126259446.0))
# For the `StateVector`, the naming of the bits will be
# ``format``-dependent, because they are recorded differently by LOSC
示例15: TimeSeriesPlot
# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import fetch_open_data [as 别名]
# Demodulation is useful when trying to examine steady sinusoidal
# signals we know to be contained within data. For instance,
# we can download some data from LOSC to look at trends of the
# amplitude and phase of Livingston's calibration line at 331.3 Hz:
from gwpy.timeseries import TimeSeries
data = TimeSeries.fetch_open_data('L1', 1131350417, 1131357617)
# We can demodulate the `TimeSeries` at 331.3 Hz with a stride of once
# per minute:
amp, phase = data.demodulate(331.3, stride=60)
# We can then plot these trends to visualize changes in the amplitude
# and phase of the calibration line:
from gwpy.plotter import TimeSeriesPlot
plot = TimeSeriesPlot(amp, phase, sep=True)
plot.show()