Skip to content
Snippets Groups Projects
Commit 4bb32873 authored by Stephen Privitera's avatar Stephen Privitera
Browse files

treebank: implement stochastic placement as command line option

parent 607d9781
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ from gstlal import tree
from gstlal.tree import *
import os,sys,argparse
# Read command line options
def parse_command_line():
......@@ -71,6 +72,10 @@ def parse_command_line():
# meta-params
parser.add_argument("--min-match", action="store", type=float,\
default=0.95, help="Minimum match to generate bank.")
parser.add_argument("--stochastic", action="store_true", \
default=False, help="Use stochastic placement for tiling instead of a regular lattice.")
parser.add_argument("--rng-seed", action="store", type=float,\
default=314, help="Set seed used for random number generator. Relevant only when using stocahstic placement.")
parser.add_argument("--flow", action="store", type=float,\
default=30.0, help="Low frequency cutoff for overlap calculations.")
parser.add_argument("--fhigh", action="store", type=float,\
......@@ -84,6 +89,8 @@ def parse_command_line():
args = parser.parse_args()
numpy.random.seed(args.rng_seed)
if args.noise_model and args.psd_file:
raise ValueError("Cannot specify both --psd-file and --noise-model")
......@@ -166,7 +173,7 @@ ligolw_process.set_process_end_time(process)
totalpopcount = 0
for n, c in enumerate(bank.walk()):
tiles, temppopcount = c.tile(mismatch = mismatch)
tiles, temppopcount = c.tile(mismatch = mismatch, stochastic = args.stochastic)
totalpopcount = totalpopcount + temppopcount
for t in tiles:
......
......@@ -70,7 +70,7 @@ class HyperCube(object):
rightbound[dim,0] = self.center[dim]
return HyperCube(leftbound, self.__mismatch, self.symmetry_func, metric = self.metric), HyperCube(rightbound, self.__mismatch, self.symmetry_func, metric = self.metric)
def tile(self, mismatch, verbose = True):
def tile(self, mismatch, stochastic = False, verbose = True):
popcount = 0
......@@ -84,7 +84,7 @@ class HyperCube(object):
raise
return self.tiles, popcount
if False:
if stochastic:
# To Stephen with love
# From Chad
self.tiles = [self.center]
......@@ -104,7 +104,7 @@ class HyperCube(object):
if len(self.tiles) > target:
break
if True:
else:
# The bounding box has 2*N points to define it each point is
# an N length vector. Figure out the x' coordinates of the
# bounding box in and divide by dl to get number of templates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment