Skip to content

Commit 6a949f3

Browse files
Kanchan-05Kanchan Soni
authored andcommitted
Added feature to use time-domain waveforms for bank generation
1 parent afbe577 commit 6a949f3

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

bin/bank/pycbc_brute_bank

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ parser.add_argument('--approximant', required=False,
5353
parser.add_argument('--minimal-match', default=0.97, type=float)
5454
parser.add_argument('--buffer-length', default=2, type=float,
5555
help='size of waveform buffer in seconds')
56+
parser.add_argument('--use-td-waveform', action='store_true',
57+
help='Generate waveform in the time domain (default is frequency domain).')
5658
parser.add_argument('--full-resolution-buffer-length', default=None, type=float,
5759
help='Size of the waveform buffer in seconds for generating time-domain signals at full resolution before conversion to the frequency domain.')
5860
parser.add_argument('--max-signal-length', type= float,
@@ -363,17 +365,25 @@ class GenUniformWaveform(object):
363365
if hasattr(kwds['approximant'], 'decode'):
364366
kwds['approximant'] = kwds['approximant'].decode()
365367

368+
if args.full_resolution_buffer_length is not None:
369+
buff_len = args.full_resolution_buffer_length
370+
else:
371+
buff_len = 1.0 / self.delta_f
372+
366373
if kwds['approximant'] in pycbc.waveform.fd_approximants():
367-
if args.full_resolution_buffer_length is not None:
368-
# Generate the frequency-domain waveform at full frequency resolution
369-
high_hp, high_hc = pycbc.waveform.get_fd_waveform(delta_f=1 / args.full_resolution_buffer_length,
374+
375+
# Optionally generate time-domain waveform
376+
if args.use_td_waveform:
377+
hp, hc = pycbc.waveform.get_td_waveform(delta_t=1.0 / args.sample_rate,
370378
**kwds)
371-
# Decimate the generated signal to a reduced frequency resolution
372-
hp = decimate_frequency_domain(high_hp, 1 / args.buffer_length)
373-
hc = decimate_frequency_domain(high_hc, 1 / args.buffer_length)
379+
380+
hp = hp.to_frequencyseries(delta_f = 1.0 / buff_len)
381+
hc = hc.to_frequencyseries(delta_f = 1.0 / buff_len)
382+
374383
else:
375-
hp, hc = pycbc.waveform.get_fd_waveform(delta_f=self.delta_f,
384+
hp, hc = pycbc.waveform.get_fd_waveform(delta_f = 1.0 / buff_len,
376385
**kwds)
386+
377387
if args.use_cross:
378388
hp = hc
379389

@@ -387,6 +397,10 @@ class GenUniformWaveform(object):
387397
delta_f=self.delta_f, delta_t=dt,
388398
**kwds)
389399

400+
if args.full_resolution_buffer_length is not None:
401+
# Decimate the generated signal to a reduced frequency resolution
402+
hp = decimate_frequency_domain(hp, 1 / args.buffer_length)
403+
390404
hp.resize(self.flen)
391405
hp = hp.astype(numpy.complex64)
392406
hp[self.kmin:-1] *= self.w

0 commit comments

Comments
 (0)