Skip to content

Commit b551de0

Browse files
authored
add scale option to bank compression along with higher order interpolation functions (2nd, 3rd, and 4th order). (#5218)
* add scale option to bank compression to make initial points more course * fixes * stay with this for now * another fix * add inline quadratic interpolation * add cubic inline * also add quartic * remove boilerplate * set scale to 1 as default * try this for mac compmlication * minor performance improvement
1 parent ed21679 commit b551de0

File tree

5 files changed

+891
-254
lines changed

5 files changed

+891
-254
lines changed

bin/pycbc_compress_bank

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ hdf file."""
2222
import argparse
2323
import numpy
2424
import logging
25+
import time
2526

2627
import pycbc
2728
from pycbc import psd
@@ -87,6 +88,11 @@ parser.add_argument("--precision", type=str, choices=["double", "single"],
8788
parser.add_argument("--force", action="store_true", default=False,
8889
help="Overwrite the given hdf file if it exists. "
8990
"Otherwise, an error is raised.")
91+
parser.add_argument("--scale", type=float, default=1,
92+
help="Scale factor to apply to the courseness of the initial "
93+
"compression points. >1 means a courser set of initial "
94+
"points. The algorithm will still add points to meet"
95+
"the tolerance goals.")
9096
parser.add_argument(
9197
"--do-not-compress",
9298
nargs="+",
@@ -161,7 +167,10 @@ for ii in range(templates.size):
161167
if tmplt['approximant'] in args.do_not_compress:
162168
continue
163169
# generate the waveform
170+
t1 = time.time()
164171
htilde = bank[ii]
172+
htime = time.time() - t1
173+
logging.info("... %.2f ms to generate normally", htime * 1000)
165174
fmin=tmplt.f_lower
166175
template_duration = htilde.chirp_length
167176
output['template_duration'][ii] = template_duration
@@ -180,11 +189,13 @@ for ii in range(templates.size):
180189
# get the compressed sample points
181190
if args.compression_algorithm == 'mchirp':
182191
sample_points = compress.mchirp_compression(tmplt.mass1, tmplt.mass2,
183-
fmin, kmax*df, min_seglen=args.t_pad, df_multiple=df).astype(
192+
fmin, kmax*df, min_seglen=args.t_pad, df_multiple=df,
193+
scale=args.scale).astype(
184194
real_same_precision_as(htilde))
185195
elif args.compression_algorithm == 'spa':
186196
sample_points = compress.spa_compression(htilde, fmin, kmax*df,
187-
min_seglen=args.t_pad).astype(real_same_precision_as(htilde))
197+
min_seglen=args.t_pad,
198+
scale=args.scale).astype(real_same_precision_as(htilde))
188199
else:
189200
raise ValueError("unrecognized compression algorithm %s" %(
190201
args.compression_algorithm))

0 commit comments

Comments
 (0)