Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions bin/bank/pycbc_brute_bank
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ parser.add_argument('--approximant', required=False,
parser.add_argument('--minimal-match', default=0.97, type=float)
parser.add_argument('--buffer-length', default=2, type=float,
help='size of waveform buffer in seconds')
parser.add_argument('--use-td-waveform', action='store_true',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to remove the option and have the code handle the waveform generation internally. So if the approximant is TD use the time domain waveform, if the approximant is in fd_approximants use the frequency domain handling.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkacanja The pycbc_brute_bank code already handles this automatically. The --use-td-waveform option would simply force the code to use time-domain waveforms exclusively, which can be useful for faster bank generation.

help='Generate waveform in the time domain (default is frequency domain).')
parser.add_argument('--full-resolution-buffer-length', default=None, type=float,
help='Size of the waveform buffer in seconds for generating time-domain signals at full resolution before conversion to the frequency domain.')
parser.add_argument('--max-signal-length', type= float,
Expand Down Expand Up @@ -363,17 +365,25 @@ class GenUniformWaveform(object):
if hasattr(kwds['approximant'], 'decode'):
kwds['approximant'] = kwds['approximant'].decode()

if args.full_resolution_buffer_length is not None:
buff_len = args.full_resolution_buffer_length
else:
buff_len = 1.0 / self.delta_f

if kwds['approximant'] in pycbc.waveform.fd_approximants():
if args.full_resolution_buffer_length is not None:
# Generate the frequency-domain waveform at full frequency resolution
high_hp, high_hc = pycbc.waveform.get_fd_waveform(delta_f=1 / args.full_resolution_buffer_length,

# Optionally generate time-domain waveform
if args.use_td_waveform:
hp, hc = pycbc.waveform.get_td_waveform(delta_t=1.0 / args.sample_rate,
**kwds)
# Decimate the generated signal to a reduced frequency resolution
hp = decimate_frequency_domain(high_hp, 1 / args.buffer_length)
hc = decimate_frequency_domain(high_hc, 1 / args.buffer_length)

hp = hp.to_frequencyseries(delta_f = 1.0 / buff_len)
hc = hc.to_frequencyseries(delta_f = 1.0 / buff_len)

else:
hp, hc = pycbc.waveform.get_fd_waveform(delta_f=self.delta_f,
hp, hc = pycbc.waveform.get_fd_waveform(delta_f = 1.0 / buff_len,
**kwds)

if args.use_cross:
hp = hc

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

if args.full_resolution_buffer_length is not None:
# Decimate the generated signal to a reduced frequency resolution
hp = decimate_frequency_domain(hp, 1 / args.buffer_length)

hp.resize(self.flen)
hp = hp.astype(numpy.complex64)
hp[self.kmin:-1] *= self.w
Expand Down
Loading