# Then we can download a simulation of the GW150914 signal from GWOSC: from astropy.utils.data import get_readable_fileobj url = ("https://www.gw-openscience.org/s/events/GW150914/P150914/" "fig2-unfiltered-waveform-H.txt") with get_readable_fileobj(url) as f: signal = TimeSeries.read(f, format='txt') signal.t0 = .5 # make sure this intersects with noise time samples # Note, since this simulation cuts off before a certain time, it is # important to taper its ends to zero to avoid ringing artifacts. # We can accomplish this using the # :meth:`~gwpy.timeseries.TimeSeries.taper` method. signal = signal.taper() # Since the time samples overlap, we can inject this into our noise data # using :meth:`~gwpy.types.series.Series.inject`: data = noise.inject(signal) # Finally, we can visualize the full process in the time domain: from gwpy.plot import Plot plot = Plot(noise, signal, data, separate=True, sharex=True, sharey=True) plot.gca().set_epoch(0) plot.show() # We can clearly see that the loud GW150914-like signal has been layered # on top of Gaussian noise with the correct amplitude and phase evolution.
delta = bm - am ad = a + delta dist = np.zeros(len(a)) xf = 1000000 xfi = 1 / xf ad = a.copy() bd = b.copy() thresh = 10000000 for i in range(len(a)): dist[i] = 1 / np.linalg.norm(a[i] - b[i]) if dist[i] < -1E-6: ad[i] = am bd[i] = bm return dist, ad, bd # time=np.arange(0, 100, 0.1); # a= TimeSeries(np.sin(time)) # b= TimeSeries(np.sin(time*1.5)) # plot=Plot([a,b, dist]) # plot.show() hdata = TimeSeries.fetch_open_data('H1', 1126259446, 1126259478, cache=True) ldata = TimeSeries.fetch_open_data('L1', 1126259446, 1126259478, cache=True) d, hl, ll = distance(hdata, ldata) print(d) plot = Plot([hdata, ldata], d, [hl, ll]) plot.show()
def zoom(ts: [TimeSeries], t, dt=0.5 * u.s): print(t) plot2 = Plot(ts) ax = plot2.gca() ax.set_xlim(t - dt, t + dt) plot2.show()