Skip to content
Snippets Groups Projects
Commit 24cf845e authored by Kipp Cannon's avatar Kipp Cannon
Browse files

add some process metadata

parent b27e7628
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,7 @@ from glue import segmentsUtils
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import utils
from glue.ligolw.utils import process as ligolw_process
from pylal import series as lalseries
from pylal.datatypes import LIGOTimeGPS
from pylal.xlal.datatypes.snglinspiraltable import from_buffer as sngl_inspiral_from_buffer
......@@ -508,6 +509,32 @@ class LLOIDHandler(object):
#
def make_process_params(options):
params = {}
#
# required options
#
for option in ("gps_start_time", "gps_end_time", "instrument", "channel_name", "output"):
params[option] = getattr(options, option)
# FIXME: what about template_bank?
#
# optional options
#
for option in ("frame_cache", "injections", "reference_psd", "write_pipeline", "write_psd", "fake_data", "comment", "verbose"):
if getattr(options, option) is not None:
params[option] = getattr(options, option)
#
# done
#
return list(ligolw_process.process_params_from_dict(params))
def parse_command_line():
parser = OptionParser(
version = "%prog ??",
......@@ -527,6 +554,7 @@ def parse_command_line():
parser.add_option("--write-pipeline", metavar = "filename", help = "Write a GStreamer XML description of the as-built pipeline to this file (optional).")
parser.add_option("--write-psd", metavar = "filename", help = "Write measured noise spectrum to this LIGO light-weight XML file (optional). This option has no effect if --reference-psd is used.")
parser.add_option("--fake-data", action = "store_true", help = "Instead of reading data from .gwf files, generate and process coloured Gaussian noise modelling the Initial LIGO design spectrum (optional).")
parser.add_option("--comment", help = "Set the string to be recorded in comment and tag columns in various places in the output file (optional).")
parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose (optional).")
options, filenames = parser.parse_args()
......@@ -541,11 +569,13 @@ def parse_command_line():
if options.fake_data and options.frame_cache is not None:
raise ValueError, "cannot set --frame-cache with --fake-data"
process_params = make_process_params(options)
options.gps_start_time = LIGOTimeGPS(options.gps_start_time)
options.gps_end_time = LIGOTimeGPS(options.gps_end_time)
options.nxydump_segment, = segmentsUtils.from_range_strings([options.nxydump_segment], boundtype = LIGOTimeGPS)
return options, filenames
return options, filenames, process_params
#
......@@ -654,7 +684,7 @@ def write_psd(filename, psd, verbose = False):
#
options, filenames = parse_command_line()
options, filenames, process_params = parse_command_line()
#
......@@ -716,6 +746,8 @@ banks = [
xmldoc = ligolw.Document()
xmldoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.append_process(xmldoc, program = "gstlal_inspiral", comment = options.comment, ifos = set([options.instrument]))
ligolw_process.append_process_params(xmldoc, process, process_params)
sngl_inspiral_table = xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.SnglInspiralTable, columns = ("process_id", "ifo", "search", "channel", "end_time", "end_time_ns", "end_time_gmst", "impulse_time", "impulse_time_ns", "template_duration", "event_duration", "amplitude", "eff_distance", "coa_phase", "mass1", "mass2", "mchirp", "mtotal", "eta", "kappa", "chi", "tau0", "tau2", "tau3", "tau4", "tau5", "ttotal", "psi0", "psi3", "alpha", "alpha1", "alpha2", "alpha3", "alpha4", "alpha5", "alpha6", "beta", "f_final", "snr", "chisq", "chisq_dof", "bank_chisq", "bank_chisq_dof", "cont_chisq", "cont_chisq_dof", "sigmasq", "rsqveto_duration", "Gamma0", "Gamma1", "Gamma2", "Gamma3", "Gamma4", "Gamma5", "Gamma6", "Gamma7", "Gamma8", "Gamma9", "event_id")))
......@@ -774,6 +806,7 @@ mainloop.run()
for row in sngl_inspiral_table:
row.process_id = process.process_id
row.event_id = sngl_inspiral_table.get_next_id()
......
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