Skip to content
Snippets Groups Projects
Commit b857bb89 authored by Soichiro Kuwahara's avatar Soichiro Kuwahara
Browse files

gstlal_cherenkov_inj: make it possible to generate multiple injections with...

gstlal_cherenkov_inj: make it possible to generate multiple injections with randomlt generated amplitude and other input parametes in the defined range.
parent 7ed823de
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
import math
from optparse import OptionParser
import random
import sys
import lal
......@@ -63,7 +64,9 @@ def parse_command_line():
description = "GstLAL-based cherenkov burst injection pipeline."
)
parser.add_option("--beta", type = "float", help = "Set beta.")
parser.add_option("--beta-width", type = "float", default = 0, help = "Set beta width for random input parameters (Optional).")
parser.add_option("--f-natural", metavar = "Hz", type = "float", help = "Set f_natural.")
parser.add_option("--f-width", metavar = "Hz", default = 0, type = "float", help = "Set f width for random input parameters (Optional)")
parser.add_option("--output", metavar = "filename", help = "Set the name of the output file (default = stdout).")
parser.add_option("--time-slide-file", metavar = "filename", help = "Associate injections with the first time slide ID in this XML file (required).")
parser.add_option("--gps-geocent-time", metavar = "s", type = "int", help = "Set the start time of the tiling in GPS seconds (required).")
......@@ -79,7 +82,7 @@ def parse_command_line():
# FIXME: gps seconds and nanoseconds divided, error checking whether the waveform can be made is missing.
if options.gps_geocent_time is None:
raise ValueError("missing required option --gps-geocent-time")
required_options = set(("output", "time_slide_file"))
required_options = set(("output", "time_slide_file", "gps_geocent_time", "beta", "f_natural"))
missing_options = set(option for option in required_options if getattr(options, option) is None)
if missing_options:
raise ValueError("missing required option(s) %s" % ", ".join("--%s" % options.subst("_", "_") for option in (requied_options - missing_options)))
......@@ -159,9 +162,10 @@ for i in range(options.num):
# waveform parameters
time_geocent = lal.LIGOTimeGPS(int(options.gps_geocent_time) + int(i * options.deltaT)),
frequency = options.f_natural,
bandwidth = options.beta,
egw_over_rsquared = 1.,
frequency = options.f_natural + random.uniform(-options.f_width, options.f_width),
bandwidth = options.beta + random.uniform(-options.beta_width, options.beta_width),
# Create the uniform and random amplitude in log10.
egw_over_rsquared = pow(10, random.uniform(-1, 2)),
# FIXME. sky location and polarization axis orientation
ra = 0.,
......
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