Beispiel #1
0
 def getMergerStrain(self):
     '''
     Uses the pycbc library to load in the strain data for the purposes
     of using the matched filtering methode. It dosent go through the gwpy
     library that would normally use for the fft and spectrogram stuff
     '''
     merger = Merger(self.event_id)
     return merger.strain(self.detector_id)
Beispiel #2
0
    def setUp(self, *args):
        self.context = _context
        self.scheme = _scheme
        self.tolerance = 1e-6
        xr = numpy.random.uniform(low=-1, high=1.0, size=2**20)
        xi = numpy.random.uniform(low=-1, high=1.0, size=2**20)
        self.x = Array(xr + xi * 1.0j, dtype=complex64)
        self.z = zeros(2**20, dtype=float32)
        for i in range(0, 4):
            trusted_accum(self.z, self.x)

        m = Merger("GW170814")

        ifos = ['H1', 'L1', 'V1']
        data = {}
        psd = {}
        for ifo in ifos:
            # Read in and condition the data and measure PSD
            ts = m.strain(ifo).highpass_fir(15, 512)
            data[ifo] = resample_to_delta_t(ts, 1.0 / 2048).crop(2, 2)
            p = data[ifo].psd(2)
            p = interpolate(p, data[ifo].delta_f)
            p = inverse_spectrum_truncation(p,
                                            int(2 * data[ifo].sample_rate),
                                            low_frequency_cutoff=15.0)
            psd[ifo] = p
        hp, _ = get_fd_waveform(approximant="IMRPhenomD",
                                mass1=31.36,
                                mass2=31.36,
                                f_lower=20.0,
                                delta_f=data[ifo].delta_f)
        hp.resize(len(psd[ifo]))

        # For each ifo use this template to calculate the SNR time series
        snr = {}
        snr_unnorm = {}
        norm = {}
        corr = {}
        for ifo in ifos:
            snr_unnorm[ifo], corr[ifo], norm[ifo] = \
                matched_filter_core(hp, data[ifo], psd=psd[ifo],
                                    low_frequency_cutoff=20)
            snr[ifo] = snr_unnorm[ifo] * norm[ifo]

        self.snr = snr
        self.snr_unnorm = snr_unnorm
        self.norm = norm
        self.corr = corr
        self.hp = hp
        self.data = data
        self.psd = psd
        self.ifos = ifos
Beispiel #3
0
    def setUp(self,*args):
        self.context = _context
        self.scheme = _scheme
        self.tolerance = 1e-6
        xr = numpy.random.uniform(low=-1, high=1.0, size=2**20)
        xi = numpy.random.uniform(low=-1, high=1.0, size=2**20)
        self.x = Array(xr + xi * 1.0j, dtype=complex64)
        self.z = zeros(2**20, dtype=float32)
        for i in range(0, 4):
            trusted_accum(self.z, self.x)

        m = Merger("GW170814")

        ifos = ['H1', 'L1', 'V1']
        data = {}
        psd = {}
        for ifo in ifos:
            # Read in and condition the data and measure PSD
            ts = m.strain(ifo).highpass_fir(15, 512)
            data[ifo] = resample_to_delta_t(ts, 1.0/2048).crop(2, 2)
            p = data[ifo].psd(2)
            p = interpolate(p, data[ifo].delta_f)
            p = inverse_spectrum_truncation(p, 2 * data[ifo].sample_rate,
                                            low_frequency_cutoff=15.0)
            psd[ifo] = p
        hp, _ = get_fd_waveform(approximant="IMRPhenomD",
                                 mass1=31.36, mass2=31.36,
                                 f_lower=20.0, delta_f=data[ifo].delta_f)
        hp.resize(len(psd[ifo]))

        # For each ifo use this template to calculate the SNR time series
        snr = {}
        snr_unnorm = {}
        norm = {}
        corr = {}
        for ifo in ifos:
            snr_unnorm[ifo], corr[ifo], norm[ifo] = \
                matched_filter_core(hp, data[ifo], psd=psd[ifo],
                                    low_frequency_cutoff=20)
            snr[ifo] = snr_unnorm[ifo] * norm[ifo]

        self.snr = snr
        self.snr_unnorm = snr_unnorm
        self.norm = norm
        self.corr = corr
        self.hp = hp
        self.data = data
        self.psd = psd
        self.ifos = ifos
Beispiel #4
0
# IPython log file

from pycbc.catalog import Merger
m = Merger('GW150914')
data = {
    ifo : m.strain(ifo) for ifo in ('H1', 'L1')
}
ligo_data = dat['L1']
ligo_data = data['L1']
ligo_data
type(ligo_data)
import pycbc
get_ipython().run_line_magic('pinfo', 'pycbc.types.timeseries.TimeSeries')
pycbc.types.timeseries.TimeSeries.__bases__
pycbc.types.timeseries.Array.__bases__
get_ipython().run_line_magic('pinfo2', 'pycbc.types.timeseries.TimeSeries')
get_ipython().run_line_magic('pinfo2', 'pycbc.types.timeseries.Array')
get_ipython().run_line_magic('pinfo', 'ligo_data._data')
type(ligo_data._data)
get_ipython().run_line_magic('pinfo', 'ligo_data._data')
type(ligo_data._data)
pycbc.types.aligned.ArrayWithAligned.__bases__
get_ipython().run_line_magic('pinfo2', 'ligo_data.highpass_fir')
get_ipython().run_line_magic('pinfo', 'pycbc.filter.highpass_fir')
import pycbc.filter
get_ipython().run_line_magic('pinfo', 'pycbc.filter.highpass_fir')
get_ipython().run_line_magic('pinfo2', 'pycbc.filter.highpass_fir')
get_ipython().run_line_magic('pinfo2', 'ligo_data.highpass_fir')
freq = 15
get_ipython().run_line_magic('pinfo2', 'ligo_data.highpass_fir')
get_ipython().run_line_magic('pinfo2', 'pycbc.filter.highpass_fir')
                    end_time=merger.time + 32,
                    check_integrity=False)

"""Cleaning and applying highpass filter. Downsample to 2048 Hz to make the data analysis more convenient. Power density of the noise is higher than the signal. At higher frequency the amplitude of the noise is lower. And then graph."""

from pycbc.catalog import Merger
from pycbc.filter import resample_to_delta_t, highpass

from pycbc.catalog import Merger
from pycbc.filter import resample_to_delta_t, highpass

merger = Merger("GW170817")
strain, stilde = {}, {} # tuple of directories: strain and stilde=cleaned data
for ifo in ['L1', 'H1']:
    # We'll download the data and select 256 seconds that includes the event time
    ts = merger.strain(ifo)
    # Remove the low frequency content and downsample the data to 2048Hz
    strain[ifo] = resample_to_delta_t(highpass(ts, 15.0), 1.0/2048)
    #remove the begining and ending spikes from the data
    strain[ifo] = strain[ifo].crop(2, 2) # remove 2 first and 2 last seconds
    # Also create a frequency domain version of the data
    stilde[ifo] = strain[ifo].to_frequencyseries()

#print (strain.delta_t)
pylab.plot(strain['L1'].sample_times, strain['L1'])
pylab.xlabel('Time (s)')
pylab.show()

"""***part 2***

Then the power spectral density is plotted.