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

gstlal_cherenkov_inj: to catch up with new template version

parent 3bde9f0b
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from ligo.lw.utils import segments as ligolw_segments
from ligo.segments import utils as segments_utils
@lsctables.use_in
......@@ -63,16 +65,12 @@ def parse_command_line():
parser = OptionParser(
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("--EoverRsquared", type = "float", help = "Set EoverRsquared.")
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("--dEoverdA", type = "float", help = "Set dEoverdA. Non input of this generates uniform random amplitude.")
parser.add_option("--gps-geocent-time", metavar = "s", help = "Set the start time of the tiling in GPS seconds (required).")
parser.add_option("--deltaT", metavar = "s", default = 0, type = "float", help = "Set the time interval of injections. Default value is 0 for injecting only one.")
parser.add_option("--num", type = "int", default = 1, help = "Set the number of injections. Default value is 1.")
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("--output", metavar = "filename", help = "Set the name of the output file (default = stdout).")
parser.add_option("--verbose", action = "store_true", help = "Be verbose.")
options, filenames = parser.parse_args()
......@@ -80,13 +78,10 @@ def parse_command_line():
process_params = dict(options.__dict__)
# check for params
# 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", "gps_geocent_time", "beta", "f_natural"))
required_options = set(("output", "time_slide_file", "gps_geocent_time"))
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)))
raise ValueError("missing required option(s) %s" % ", ".join("--%s" % option.replace("_", "-") for option in missing_options))
# type-cast
options.gps_geocent_time = lal.LIGOTimeGPS(options.gps_geocent_time)
......@@ -163,11 +158,10 @@ for i in range(options.num):
# waveform parameters
time_geocent = options.gps_geocent_time + i * options.deltaT,
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)),
egw_over_rsquared = 4 * math.pi * options.EoverRsquared,
frequency = math.nan,
# bandwidth parameter is actually not used. Hence, the length of Enterprise in StarTrek.is inputted as a fixed parameter.
bandwidth = 642.,
egw_over_rsquared = math.nan,
# sky location and polarization axis orientation
ra = random.uniform(0., 2. * math.pi),
......@@ -176,7 +170,8 @@ for i in range(options.num):
# unnecessary columns
waveform_number = 0.,
amplitude = math.nan,
# Create the uniform and random amplitude in log10.
amplitude = pow(10, random.uniform(-1, 4.5)) if options.dEoverdA is None else options.dEoverdA,
duration = math.nan,
q = math.nan,
hrss = math.nan,
......
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