repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
pycbc
pycbc-master/pycbc/inference/models/brute_marg.py
# Copyright (C) 2020 Alex Nitz # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the ho...
7,614
32.108696
79
py
pycbc
pycbc-master/pycbc/inference/jump/normal.py
# Copyright (C) 2019 Collin Capano # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
20,231
35.454054
79
py
pycbc
pycbc-master/pycbc/inference/jump/discrete.py
# Copyright (C) 2020 Collin Capano # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
5,794
33.494048
79
py
pycbc
pycbc-master/pycbc/inference/jump/angular.py
# Copyright (C) 2020 Collin Capano # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
4,775
34.909774
78
py
pycbc
pycbc-master/pycbc/inference/jump/__init__.py
# Copyright (C) 2019 Collin Capano # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
3,211
36.788235
77
py
pycbc
pycbc-master/pycbc/inference/jump/bounded_normal.py
# Copyright (C) 2020 Collin Capano # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
4,652
33.723881
78
py
pycbc
pycbc-master/pycbc/waveform/waveform.py
# Copyright (C) 2012 Alex Nitz # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the...
57,449
39.860597
107
py
pycbc
pycbc-master/pycbc/waveform/pycbc_phenomC_tmplt.py
# Copyright (C) 2012 Prayush Kumar # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distribut...
15,018
37.022785
128
py
pycbc
pycbc-master/pycbc/waveform/supernovae.py
"""Generate core-collapse supernovae waveform for core bounce and subsequent postbounce oscillations. """ import numpy import h5py from pycbc.types import TimeSeries _pc_dict = {} def get_corecollapse_bounce(**kwargs): """ Generates core bounce and postbounce waveform by using principal component basis vect...
1,893
34.735849
79
py
pycbc
pycbc-master/pycbc/waveform/spa_tmplt_cuda.py
# # Apapted from code in LALSimInpspiralTaylorF2.c # # Copyright (C) 2007 Jolien Creighton, B.S. Sathyaprakash, Thomas Cokelaer # Copyright (C) 2012 Leo Singer, Alex Nitz # Adapted from code found in: # - LALSimInspiralTaylorF2.c # # This program is free software; you can redistribute it and/or modify # it und...
3,243
32.443299
98
py
pycbc
pycbc-master/pycbc/waveform/ringdown.py
# Copyright (C) 2016 Miriam Cabero Mueller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distrib...
54,746
43.329555
80
py
pycbc
pycbc-master/pycbc/waveform/plugin.py
""" Utilities for handling waveform plugins """ def add_custom_waveform(approximant, function, domain, sequence=False, has_det_response=False, force=False,): """ Make custom waveform available to pycbc Parameters ---------- approximant : str The...
4,171
37.275229
84
py
pycbc
pycbc-master/pycbc/waveform/compress.py
# Copyright (C) 2016 Alex Nitz, Collin Capano # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is dis...
30,086
39.990463
79
py
pycbc
pycbc-master/pycbc/waveform/bank.py
# Copyright (C) 2012 Alex Nitz, Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This p...
39,507
41.299786
121
py
pycbc
pycbc-master/pycbc/waveform/waveform_modes.py
# Copyright (C) 2020 Collin Capano, Alex Nitz # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distr...
11,042
33.509375
79
py
pycbc
pycbc-master/pycbc/waveform/utils.py
# Copyright (C) 2013 Alex Nitz # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the...
19,760
35.867537
127
py
pycbc
pycbc-master/pycbc/waveform/multiband.py
""" Tools and functions to calculate interpolate waveforms using multi-banding """ import numpy from pycbc.types import TimeSeries, zeros def multiband_fd_waveform(bands=None, lengths=None, overlap=0, **p): """ Generate a fourier domain waveform using multibanding Speed up generation of a fouerier domain wa...
3,724
31.964602
79
py
pycbc
pycbc-master/pycbc/waveform/sinegauss.py
""" Generation of sine-Gaussian bursty type things """ import pycbc.types import numpy def fd_sine_gaussian(amp, quality, central_frequency, fmin, fmax, delta_f): """ Generate a Fourier domain sine-Gaussian Parameters ---------- amp: float Amplitude of the sine-Gaussian quality: float ...
1,285
30.365854
76
py
pycbc
pycbc-master/pycbc/waveform/spa_tmplt.py
# Adapted from code in LALSimInspiralTaylorF2.c # # Copyright (C) 2007 Jolien Creighton, B.S. Sathyaprakash, Thomas Cokelaer # Copyright (C) 2012 Leo Singer, Alex Nitz # # This program is free software you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # t...
9,385
34.153558
100
py
pycbc
pycbc-master/pycbc/waveform/premerger.py
""" Waveform approximants for the pre-merger detection of gravitational waves """ import logging def premerger_taylorf2(**p): """ Generate time-shifted TaylorF2""" from pycbc.waveform import get_fd_waveform from pycbc.waveform.spa_tmplt import spa_length_in_time from pycbc.waveform.utils import fd_tap...
1,282
30.292683
80
py
pycbc
pycbc-master/pycbc/waveform/parameters.py
# Copyright (C) 2016 Collin Capano # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in ...
29,135
44.811321
99
py
pycbc
pycbc-master/pycbc/waveform/utils_cuda.py
# Copyright (C) 2018 Josh Willis # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in th...
3,136
29.163462
108
py
pycbc
pycbc-master/pycbc/waveform/__init__.py
from pycbc.waveform.waveform import * from pycbc.waveform.utils import * from pycbc.waveform.bank import * from pycbc.waveform.ringdown import * from pycbc.waveform.parameters import * from pycbc.waveform.waveform_modes import (get_td_waveform_modes, get_fd_waveform_modes) fro...
520
42.416667
65
py
pycbc
pycbc-master/pycbc/waveform/generator.py
# Copyright (C) 2016 Collin Capano, Alex Nitz, Christopher Biwer # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # Th...
51,496
42.238455
258
py
pycbc
pycbc-master/pycbc/waveform/decompress_cuda.py
# Copyright (C) 2016 Josh Willis # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the...
11,138
32.250746
119
py
pycbc
pycbc-master/pycbc/waveform/nltides.py
""" Utilities for introducing nonlinear tidal effects into waveform approximants """ import pycbc.conversions import numpy import lal def nltides_fourier_phase_difference(f, delta_f, f0, amplitude, n, m1, m2): """Calculate the change to the Fourier phase change due to non-linear tides. Note that the Fourier ph...
2,683
30.952381
80
py
pycbc
pycbc-master/pycbc/waveform/decompress_cpu.py
# Copyright (C) 2016 Alex Nitz, Collin Capano # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is dis...
2,155
40.461538
79
py
pycbc
pycbc-master/pycbc/waveform/SpinTaylorF2.py
# Copyright (C) 2013 Haris K # Ported from LALSimulation's LALSimInspiralSpinTaylorF2.c # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your opt...
18,361
43.139423
701
py
pycbc
pycbc-master/pycbc/noise/gaussian.py
# Copyright (C) 2012 Alex Nitz # # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
5,192
30.472727
97
py
pycbc
pycbc-master/pycbc/noise/__init__.py
from .gaussian import noise_from_psd, noise_from_string, frequency_noise_from_psd # noqa
89
44
88
py
pycbc
pycbc-master/pycbc/noise/reproduceable.py
# Copyright (C) 2017 Alex Nitz # # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
8,316
35.964444
79
py
pycbc
pycbc-master/pycbc/fft/backend_mkl.py
# Copyright (C) 2014 Josh Willis # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed...
1,197
30.526316
71
py
pycbc
pycbc-master/pycbc/fft/core.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
11,855
41.647482
98
py
pycbc
pycbc-master/pycbc/fft/mkl.py
import ctypes, pycbc.libutils from pycbc.types import zeros from .core import _BaseFFT, _BaseIFFT import pycbc.scheme as _scheme lib = pycbc.libutils.get_ctypes_library('mkl_rt', []) if lib is None: raise ImportError #MKL constants taken from mkl_df_defines.h DFTI_FORWARD_DOMAIN = 0 DFTI_DIMENSION = 1 DFTI_LENGT...
6,206
31.160622
84
py
pycbc
pycbc-master/pycbc/fft/backend_support.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
3,126
36.22619
93
py
pycbc
pycbc-master/pycbc/fft/fftw_pruned.py
"""This module provides a functions to perform a pruned FFT based on FFTW This should be considered a test and example module, as the functionality can and should be generalized to other FFT backends, and precisions. These functions largely implemented the generic FFT decomposition as described rather nicely by wikip...
7,186
29.45339
82
py
pycbc
pycbc-master/pycbc/fft/fftw.py
import os from pycbc.types import zeros import numpy as _np import ctypes import pycbc.scheme as _scheme from pycbc.libutils import get_ctypes_library from .core import _BaseFFT, _BaseIFFT from ..types import check_aligned # IMPORTANT NOTE TO PYCBC DEVELOPERS: # Because this module is loaded automatically when present...
22,788
41.201852
109
py
pycbc
pycbc-master/pycbc/fft/backend_cpu.py
# Copyright (C) 2014 Josh Willis # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed...
1,285
30.365854
71
py
pycbc
pycbc-master/pycbc/fft/cuda_pyfft.py
# Copyright (C) 2012 Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in...
2,283
33.089552
87
py
pycbc
pycbc-master/pycbc/fft/parser_support.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
4,879
36.829457
88
py
pycbc
pycbc-master/pycbc/fft/func_api.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
3,470
35.925532
79
py
pycbc
pycbc-master/pycbc/fft/backend_cuda.py
# Copyright (C) 2014 Josh Willis # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed...
1,315
28.909091
71
py
pycbc
pycbc-master/pycbc/fft/fft_callback.py
#!/usr/bin/python import os, subprocess, ctypes from mako.template import Template full_corr = """ __device__ cufftComplex in_call(void* input, size_t offset, void* caller_info, void* shared) { cufftComplex r; cufftComplex* hp = ((cufftComplex*) callback_params.hti...
8,478
31.737452
121
py
pycbc
pycbc-master/pycbc/fft/class_api.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
3,391
36.274725
79
py
pycbc
pycbc-master/pycbc/fft/__init__.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
952
44.380952
81
py
pycbc
pycbc-master/pycbc/fft/npfft.py
# Copyright (C) 2012 Josh Willis # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in t...
3,765
37.824742
79
py
pycbc
pycbc-master/pycbc/fft/cufft.py
# Copyright (C) 2012 Josh Willis, Andrew Miller # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is d...
3,710
35.029126
87
py
pycbc
pycbc-master/pycbc/inject/__init__.py
from pycbc.inject.injfilterrejector import * from pycbc.inject.inject import *
79
25.666667
44
py
pycbc
pycbc-master/pycbc/inject/injfilterrejector.py
# Copyright (C) 2013 Ian Harry # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the ...
19,409
49.025773
79
py
pycbc
pycbc-master/pycbc/inject/inject.py
# Copyright (C) 2012 Alex Nitz, Tito Dal Canton # # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This program is...
48,285
37.080442
79
py
pycbc
pycbc-master/examples/overlap.py
from pycbc.waveform import get_td_waveform from pycbc.filter import match, overlap from pycbc.psd import aLIGOZeroDetHighPower # Buffer size in seconds. This is presumed to be # longer than the longest waveform. time_buffer = 4 f_low = 30 sample_rate = 4096 # Length of corresponding time series and frequency series ...
1,520
28.823529
69
py
pycbc
pycbc-master/examples/detector/delay.py
from pycbc.detector import Detector from astropy.utils import iers # Make sure the documentation can be built without an internet connection iers.conf.auto_download = False # The source of the gravitational waves right_ascension = 0.7 declination = -0.5 # Reference location will be the Hanford detector # see the `ti...
785
30.44
77
py
pycbc
pycbc-master/examples/detector/ant.py
from pycbc.detector import Detector from pycbc.waveform import get_td_waveform # Time, orientation and location of the source in the sky ra = 1.7 dec = 1.7 pol = 0.2 inc = 0 time = 1000000000 # We can calcualate the antenna pattern for Hanford at # the specific sky location d = Detector("H1") # We get back the fp an...
997
27.514286
73
py
pycbc
pycbc-master/examples/detector/loc.py
from pycbc.detector import Detector, get_available_detectors # We can list the available detectors. This gives their detector abbreviation # along with a longer name. Note that some of these are not physical detectors # but may be useful for testing or study purposes for abv in get_available_detectors(): d = Dete...
550
38.357143
78
py
pycbc
pycbc-master/examples/detector/travel.py
from pycbc.detector import Detector for ifo1 in ['H1', 'L1', 'V1']: for ifo2 in ['H1', 'L1', 'V1']: dt = Detector(ifo1).light_travel_time_to_detector(Detector(ifo2)) print("Direct Time from {} to {} is {} seconds".format(ifo1, ifo2, dt))
259
36.142857
79
py
pycbc
pycbc-master/examples/psd/estimate.py
import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd # generate some colored gaussian noise flow = 30.0 delta_f = 1.0 / 16 flen = int(2048 / delta_f) + 1 psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow) ### Generate 128 seconds of noise at 4096 Hz delta_t = 1.0 / 4096 tsamples = int(128 / del...
884
26.65625
76
py
pycbc
pycbc-master/examples/psd/analytic.py
import matplotlib.pyplot as pp import pycbc.psd # List the available analytic psds print(pycbc.psd.get_lalsim_psd_list()) delta_f = 1.0 / 4 flen = int(1024 / delta_f) low_frequency_cutoff = 30.0 # One can either call the psd generator by name p1 = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, low_frequency_cutoff)...
576
25.227273
87
py
pycbc
pycbc-master/examples/psd/read.py
import matplotlib.pyplot as pp import pycbc.psd import pycbc.types filename = 'example_psd.txt' # The PSD will be interpolated to the requested frequency spacing delta_f = 1.0 / 4 length = int(1024 / delta_f) low_frequency_cutoff = 30.0 psd = pycbc.psd.from_txt(filename, length, delta_f, low...
742
26.518519
70
py
pycbc
pycbc-master/examples/distributions/spin_spatial_distr_example.py
import numpy import matplotlib.pyplot as plt import pycbc.coordinates as co from pycbc import distributions # We can choose any bounds between 0 and pi for this distribution but in units # of pi so we use between 0 and 1. theta_low = 0. theta_high = 1. # Units of pi for the bounds of the azimuthal angle which goes fr...
1,933
36.921569
78
py
pycbc
pycbc-master/examples/distributions/mchirp_q_from_uniform_m1m2_example.py
import matplotlib.pyplot as plt from pycbc import distributions from pycbc import conversions import numpy as np # Create chirp mass and mass ratio distribution object that is uniform # in mass1 and mass2 minmc = 5 maxmc = 60 mc_distribution = distributions.MchirpfromUniformMass1Mass2(mc=(minmc,maxmc)) # generate q in...
1,986
30.046875
77
py
pycbc
pycbc-master/examples/distributions/sampling_from_config_example.py
import numpy as np import matplotlib.pyplot as plt from pycbc.distributions.utils import draw_samples_from_config # A path to the .ini file. CONFIG_PATH = "./pycbc_bbh_prior.ini" random_seed = np.random.randint(low=0, high=2**32-1) # Draw a single sample. sample = draw_samples_from_config( path=CONFIG_PA...
1,236
27.113636
69
py
pycbc
pycbc-master/examples/distributions/mass_examples.py
import matplotlib.pyplot as plt from pycbc import distributions # Create a mass distribution object that is uniform between 0.5 and 1.5 # solar masses. mass1_distribution = distributions.Uniform(mass1=(0.5, 1.5)) # Take 100000 random variable samples from this uniform mass distribution. mass1_samples = mass1_distribut...
1,651
35.711111
77
py
pycbc
pycbc-master/examples/distributions/list_distributions.py
from pycbc import distributions # print all distribution names print(distributions.distribs.keys())
100
24.25
36
py
pycbc
pycbc-master/examples/distributions/spin_examples.py
import matplotlib.pyplot as plt import numpy import pycbc.coordinates as co from pycbc import distributions # We can choose any bounds between 0 and pi for this distribution but in # units of pi so we use between 0 and 1 theta_low = 0. theta_high = 1. # Units of pi for the bounds of the azimuthal angle which goes fro...
1,894
32.245614
78
py
pycbc
pycbc-master/examples/catalog/data.py
import matplotlib.pyplot as pp import pycbc.catalog m = pycbc.catalog.Merger("GW170817", source='gwtc-1') fig, axs = pp.subplots(2, 1, sharex=True, sharey=True) for ifo, ax in zip(["L1", "H1"], axs): pp.sca(ax) pp.title(ifo) # Retreive data around the BNS merger ts = m.strain(ifo).time_slice(m.time -...
716
26.576923
62
py
pycbc
pycbc-master/examples/catalog/stat.py
import matplotlib.pyplot as pp import pycbc.catalog c = pycbc.catalog.Catalog(source='gwtc-2') mchirp, elow, ehigh = c.median1d('mchirp', return_errors=True) spin = c.median1d('chi_eff') pp.errorbar(mchirp, spin, xerr=[-elow, ehigh], fmt='o', markersize=7) pp.xlabel('Chirp Mass') pp.xscale('log') pp.ylabel('Effectiv...
339
23.285714
69
py
pycbc
pycbc-master/examples/catalog/what.py
import pycbc.catalog c = pycbc.catalog.Catalog(source='gwtc-2') # Names of mergers in the catalog print(c.names) # Approximate GPS time of the mergers print([c[m].time for m in c])
184
17.5
42
py
pycbc
pycbc-master/examples/multi_inspiral/check_faceon_faceaway_trigs.py
#!/usr/bin/env python # Read a pycbc_multi_inspiral HDF5 trigger file and check that it contains # triggers compatible with mock GW170817-like injections # 2022 Andrew Williamson, Tito Dal Canton import sys import logging import h5py import numpy as np from pycbc import init_logging init_logging(True) gw170817_time =...
1,158
29.5
79
py
pycbc
pycbc-master/examples/multi_inspiral/check_gw170817_trigs.py
#!/usr/bin/env python # Read a pycbc_multi_inspiral HDF5 trigger file and check that it contains # triggers compatible with mock GW170817-like injections # 2022 Andrew Williamson, Tito Dal Canton import sys import logging import h5py import numpy as np from pycbc import init_logging init_logging(True) gw170817_time =...
957
23.564103
79
py
pycbc
pycbc-master/examples/filter/fir.py
# Apply an FIR filter. The algorithm is written for high performance so if you # have a large number of taps, it will resort to a FFT based implementation # under the hood. import pycbc.types import pycbc.filter.resample # Reference time series ts = pycbc.types.TimeSeries([-1, 1, -1, 1, -1], delta_t=1.0) # May also b...
624
30.25
81
py
pycbc
pycbc-master/examples/filter/snr.py
import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd import pycbc.filter import pycbc.waveform # Generate some noise with an advanced ligo psd flow = 30.0 delta_f = 1.0 / 16 flen = int(2048 / delta_f) + 1 psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow) # Generate 16 seconds of noise at 4096 ...
949
26.941176
69
py
pycbc
pycbc-master/examples/filter/chisq.py
"""This example shows how to calculate the chi^2 discriminator described in https://arxiv.org/abs/gr-qc/0405045, also known as the "power chi^2" or "Allen chi^2" discriminator. """ import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd import pycbc.waveform import pycbc.vetoes # Generate some noise with ...
1,198
27.547619
78
py
pycbc
pycbc-master/examples/filter/pass.py
import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd import pycbc.filter # Generate some noise with an advanced ligo psd flow = 5.0 delta_f = 1.0 / 16 flen = int(2048 / delta_f) + 1 psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow) # Generate 1 seconds of noise at 4096 Hz delta_t = 1.0 / 4096 ...
795
24.677419
65
py
pycbc
pycbc-master/examples/gw150914/audio.py
from pycbc.frame import read_frame from pycbc.filter import highpass_fir, lowpass_fir from pycbc.psd import welch, interpolate from pycbc.types import TimeSeries try: from urllib.request import urlretrieve except ImportError: # python < 3 from urllib import urlretrieve # Read data and remove low frequency con...
1,150
33.878788
83
py
pycbc
pycbc-master/examples/gw150914/gw150914_h1_snr.py
import matplotlib.pyplot as pp from urllib.request import urlretrieve from pycbc.frame import read_frame from pycbc.filter import highpass_fir, matched_filter from pycbc.waveform import get_fd_waveform from pycbc.psd import welch, interpolate # Read data and remove low frequency content fname = 'H-H1_LOSC_4_V2-112625...
1,097
31.294118
70
py
pycbc
pycbc-master/examples/gw150914/gw150914_shape.py
import matplotlib.pyplot as pp from pycbc.filter import highpass_fir, lowpass_fir from pycbc.psd import welch, interpolate from pycbc.catalog import Merger for ifo in ['H1', 'L1']: # Read data and remove low frequency content h1 = Merger("GW150914").strain(ifo) h1 = highpass_fir(h1, 15, 8) # Calculat...
934
24.972222
73
py
pycbc
pycbc-master/examples/dataquality/hwinj.py
"""This example shows how to determine when a CBC hardware injection is present in the data from a detector. """ import matplotlib.pyplot as pp from pycbc import dq start_time = 1126051217 end_time = start_time + 10000000 # Get times that the Livingston detector has CBC injections into the data segs = dq.query_flag...
504
20.956522
79
py
pycbc
pycbc-master/examples/dataquality/on.py
"""This example shows how to determine when a detector is active.""" import matplotlib.pyplot as pp from pycbc import dq from pycbc.results import ifo_color start_time = 1126051217 end_time = start_time + 100000 # Get times that the Hanford detector has data hsegs = dq.query_flag('H1', 'DATA', start_time, end_time)...
709
24.357143
69
py
pycbc
pycbc-master/examples/live/make_singles_fits_file.py
""" This script will make a valid singles-fits file for use in the pycbc_live CI tests. It doesn't have much physical meaning, but will give broadly representative numbers for singles. """ import h5py import numpy as np f = h5py.File('single_trigger_fits.hdf','w') # Some numbers to design the output # These are loose...
2,238
33.984375
78
py
pycbc
pycbc-master/examples/live/check_results.py
#!/usr/bin/env python import sys import argparse import glob import logging as log import numpy as np import h5py import pycbc from pycbc.io import FieldArray from pycbc.io.ligolw import LIGOLWContentHandler from ligo.lw.utils import load_filename as load_xml_doc from ligo.lw import lsctables from pycbc import convers...
8,211
38.104762
88
py
pycbc
pycbc-master/examples/live/generate_injections.py
#!/usr/bin/env python import sys import numpy as np from pycbc.io import FieldArray from pycbc.inject import InjectionSet dtype = [('mass1', float), ('mass2', float), ('spin1z', float), ('spin2z', float), ('tc', float), ('distance', float), ('ra', float), ('dec', float), ('approxi...
1,508
34.093023
73
py
pycbc
pycbc-master/examples/search/check_job.py
import subprocess import time time.sleep(30) while 1: time.sleep(60) subprocess.run(["condor_q", "-bet"]) subprocess.run(["pegasus-status", "submitdir/work/"]) out = subprocess.check_output(["pegasus-status", "submitdir/work/"]) out = str(out) lines = out.split('\\n') for i in range(len(line...
1,136
26.731707
78
py
pycbc
pycbc-master/examples/workflow/generic/multilevel_subworkflow_data/simple.py
../simple_subworkflow_data/simple.py
36
36
36
py
pycbc
pycbc-master/examples/workflow/generic/simple_subworkflow_data/simple.py
""" A minimal pycbc workflow example """ import argparse import pycbc import pycbc.workflow as wf import os pycbc.init_logging(True) parser = argparse.ArgumentParser(description=__doc__[1:]) parser.add_argument("--multilevel", action='store_true', default=False) wf.add_workflow_command_line_group(parser) wf.add_workf...
1,914
28.015152
77
py
pycbc
pycbc-master/examples/workflow/dayhopecheck/dayhopecheck.py
#!/usr/bin/env python # Copyright (C) 2013 Ian W. Harry # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This prog...
7,198
40.373563
250
py
pycbc
pycbc-master/examples/workflow/data_checker/daily_test.py
#!/usr/bin/env python # Copyright (C) 2013 Ian W. Harry # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This prog...
6,801
30.059361
250
py
pycbc
pycbc-master/examples/workflow/data_checker/get_data_example.py
#!/usr/bin/env python # Copyright (C) 2013 Ian W. Harry # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 3 of the License, or (at your # option) any later version. # # This prog...
2,162
33.887097
88
py
pycbc
pycbc-master/examples/inference/list_parameters.py
from pycbc.waveform import parameters # print base parameters for CBC waveform print(parameters.fd_waveform_params + parameters.location_params + \ parameters.calibration_params)
183
35.8
68
py
pycbc
pycbc-master/examples/inference/lisa_smbhb_ldc/advanced_plot.py
import subprocess import pickle import numpy as np from pycbc.conversions import q_from_mass1_mass2, mchirp_from_mass1_mass2 def spin_ldc2pycbc(mag, pol): return mag*np.cos(pol) def plt(index): with open('./MBHB_params_v2_LISA_frame.pkl', 'rb') as f: params_true_all = pickle.load(f) p_index = i...
2,428
36.369231
95
py
pycbc
pycbc-master/examples/waveform/what_waveform.py
from pycbc.waveform import td_approximants, fd_approximants # List of td approximants that are available print(td_approximants()) # List of fd approximants that are currently available print(fd_approximants()) # Note that these functions only print what is available for your current # processing context. If a wavefo...
426
34.583333
77
py
pycbc
pycbc-master/examples/waveform/plot_waveform.py
import matplotlib.pyplot as pp from pycbc.waveform import get_td_waveform for apx in ['SEOBNRv4', 'IMRPhenomD']: hp, hc = get_td_waveform(approximant=apx, mass1=10, mass2=10, spin1z=0.9, ...
498
25.263158
50
py
pycbc
pycbc-master/examples/waveform/plot_freq.py
import matplotlib.pyplot as pp from pycbc import waveform for phase_order in [2, 3, 4, 5, 6, 7]: hp, hc = waveform.get_td_waveform(approximant='SpinTaylorT4', mass1=10, mass2=10, phase_order=phase_order, delta_t=1.0...
700
30.863636
67
py
pycbc
pycbc-master/examples/waveform/add_waveform.py
import numpy import matplotlib.pyplot as pp import pycbc.waveform from pycbc.types import TimeSeries def test_waveform(**args): flow = args['f_lower'] # Required parameter dt = args['delta_t'] # Required parameter fpeak = args['fpeak'] # A new parameter for my model t = numpy.arange(0, 10, dt) ...
1,497
29.571429
77
py
pycbc
pycbc-master/examples/waveform/match_waveform.py
from pycbc.waveform import get_td_waveform from pycbc.filter import match from pycbc.psd import aLIGOZeroDetHighPower f_low = 30 sample_rate = 4096 # Generate the two waveforms to compare hp, hc = get_td_waveform(approximant="EOBNRv2", mass1=10, mass2=10, ...
1,045
28.885714
69
py
pycbc
pycbc-master/examples/waveform/plot_detwaveform.py
import matplotlib.pyplot as pp from pycbc.waveform import get_td_waveform from pycbc.detector import Detector apx = 'SEOBNRv4' # NOTE: Inclination runs from 0 to pi, with poles at 0 and pi # coa_phase runs from 0 to 2 pi. hp, hc = get_td_waveform(approximant=apx, mass1=10, ...
1,500
32.355556
84
py
pycbc
pycbc-master/examples/waveform/plot_phase.py
import matplotlib.pyplot as pp from pycbc import waveform for apx in ['SEOBNRv4', 'TaylorT4', 'IMRPhenomB']: hp, hc = waveform.get_td_waveform(approximant=apx, mass1=10, mass2=10, delta_t=1.0/4096, ...
657
28.909091
61
py
pycbc
pycbc-master/examples/waveform/plot_fd_td.py
"""Plot a time domain and Fourier domain waveform together in the time domain. Note that without special cleanup the Fourier domain waveform will exhibit the Gibb's phenomenon. (http://en.wikipedia.org/wiki/Gibbs_phenomenon) """ import matplotlib.pyplot as pp from pycbc import types, fft, waveform # Get a time domai...
997
31.193548
78
py
pycbc
pycbc-master/examples/inspiral/check_GW150914_detection.py
#!/usr/bin/env python # Read a pycbc_inspiral HDF5 trigger file and check that it contains triggers # compatible with GW150914 # 2016 Tito Dal Canton import sys import h5py import numpy as np gw150914_time = 1126259462.4 gw150914_snr = {'H1': 19.71, 'L1': 13.28} gw150914_chi2r = {'H1': 1.05, 'L1': 0.45} f = h5py.Fil...
1,207
32.555556
77
py
pycbc
pycbc-master/examples/noise/frequency.py
import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd # The color of the noise matches a PSD which you provide flow = 30.0 delta_f = 1.0 / 64 flen = int(2048 / delta_f) + 1 psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow) # Here the noise is generated directly in the frequency domain so it mat...
668
28.086957
76
py
pycbc
pycbc-master/examples/noise/timeseries.py
import matplotlib.pyplot as pp import pycbc.noise import pycbc.psd # The color of the noise matches a PSD which you provide flow = 30.0 delta_f = 1.0 / 16 flen = int(2048 / delta_f) + 1 psd = pycbc.psd.aLIGOZeroDetHighPower(flen, delta_f, flow) # Generate 32 seconds of noise at 4096 Hz delta_t = 1.0 / 4096 tsamples ...
488
22.285714
65
py