Commit d4c1d614 authored by Patrick Godwin's avatar Patrick Godwin

gstlal_inspiral_pipe, gstlal_inspiral_rerank_pipe, inspiral_pipe.py: tidy up, formatting changes

parent 2f6a4567
Pipeline #78638 passed with stages
in 28 minutes and 31 seconds
......@@ -369,7 +369,12 @@ if __name__ == '__main__':
psd_nodes, ref_psd_parent_nodes = inspiral_pipe.inj_psd_layer(segsdict, options)
ref_psd = inspiral_pipe.load_reference_psd(options)
elif options.reference_psd is None:
elif options.reference_psd:
# load reference PSD
ref_psd = inspiral_pipe.load_reference_psd(options)
ref_psd_parent_nodes = []
else:
# Compute the PSDs for each segment
psd_nodes = inspiral_pipe.ref_psd_layer(dag, jobs, [], segsdict, channel_dict, options)
......@@ -381,27 +386,22 @@ if __name__ == '__main__':
ref_psd = median_psd_node.output_files["output-name"]
ref_psd_parent_nodes = [median_psd_node]
else:
# load reference PSD
ref_psd = inspiral_pipe.load_reference_psd(options)
ref_psd_parent_nodes = []
# Calculate Expected SNR jobs
if not options.disable_calc_inj_snr:
ligolw_add_nodes = inspiral_pipe.expected_snr_layer(dag, jobs, ref_psd_parent_nodes, options, num_split_inj_snr_jobs = 100)
else:
ligolw_add_nodes = []
if not options.injection_only:
if options.injection_only:
model_node = None
model_file = options.mass_model_file
svd_dtdphi_map, _ = inspiral_pipe.load_svd_dtdphi_map(options)
else:
# Compute SVD banks
svd_nodes, template_mchirp_dict, svd_dtdphi_map = inspiral_pipe.svd_layer(dag, jobs, ref_psd_parent_nodes, ref_psd, bank_cache, options, boundary_seg, output_dir, template_mchirp_dict)
# mass model
model_node, model_file = inspiral_pipe.mass_model_layer(dag, jobs, ref_psd_parent_nodes, instruments, options, boundary_seg, ref_psd)
else:
model_node = None
model_file = options.mass_model_file
svd_dtdphi_map, _ = inspiral_pipe.load_svd_dtdphi_map(options)
# Inspiral jobs by segment
inspiral_nodes, lloid_output, lloid_diststats = inspiral_pipe.inspiral_layer(dag, jobs, psd_nodes, svd_nodes, segsdict, options, channel_dict, template_mchirp_dict)
......
......@@ -91,9 +91,7 @@ def parse_command_line():
parser.add_option("--frame-segments-file", metavar = "filename", help = "Set the name of the LIGO light-weight XML file from which to load frame segments. Optional iff --data-source=frames")
parser.add_option("--frame-segments-name", metavar = "name", help = "Set the name of the segments to extract from the segment tables. Required iff --frame-segments-file is given")
# FIXME: uhhhhh... yeah
parser.add_option("--injections", action = "append", help = "append injection files to analyze. Must prepend filename with X:Y:, where X and Y are floats, e.g. 1.2:3.1:filename, so that the injections are only searched for in regions of the template bank with X <= chirp mass < Y.")
parser.add_option("--analysis-path", metavar = "path", help = "Set the path to the analysis you want to rerank.")
# caches
......@@ -129,15 +127,6 @@ def parse_command_line():
if len(options.dtdphi_file) != len(options.bank_cache):
raise ValueError("You must provide as many dtdphi files as banks")
#missing_injection_options = []
#for option in ("dist_stats_cache", "svd_bank_cache", "psd_cache", "non_injection_db", "marginalized_likelihood_file", "marginalized_likelihood_with_zerolag_file"):
# if getattr(options, option) is None:
# missing_injection_options.append(option)
#if len(missing_injection_options) > 0 and len(missing_injection_options) < 6:
# raise ValueError("missing injection-only options %s." % ", ".join([option for option in missing_injection_options]))
#if len(missing_injection_options) == 0 and options.num_banks:
# raise ValueError("cant specify --num-banks in injection-only run")
#FIXME a hack to find the sql paths
share_path = os.path.split(dagparts.which('gstlal_inspiral'))[0].replace('bin', 'share/gstlal')
options.cluster_sql_file = os.path.join(share_path, 'simplify_and_cluster.sql')
......
......@@ -113,6 +113,7 @@ def ref_psd_layer(dag, jobs, parent_nodes, segsdict, channel_dict, options):
return psd_nodes
def median_psd_layer(dag, jobs, parent_nodes, options, boundary_seg, instruments):
gpsmod5 = str(int(boundary_seg[0]))[:5]
median_psd_path = subdir_path([jobs['medianPSD'].output_path, gpsmod5])
......@@ -120,22 +121,21 @@ def median_psd_layer(dag, jobs, parent_nodes, options, boundary_seg, instruments
# FIXME Use machinery in inspiral_pipe.py to create reference_psd.cache
median_psd_nodes = []
for chunk, nodes in enumerate(dagparts.groups(parent_nodes.values(), 50)):
median_psd_node = \
dagparts.DAGNode(jobs['medianPSD'], dag,
parent_nodes = parent_nodes.values(),
input_files = {"": [node.output_files["write-psd"] for node in nodes]},
output_files = {"output-name": dagparts.T050017_filename(instruments, "REFERENCE_PSD_CHUNK_%04d" % chunk, boundary_seg, '.xml.gz', path = median_psd_path)}
)
median_psd_node = dagparts.DAGNode(jobs['medianPSD'], dag,
parent_nodes = parent_nodes.values(),
input_files = {"": [node.output_files["write-psd"] for node in nodes]},
output_files = {"output-name": dagparts.T050017_filename(instruments, "REFERENCE_PSD_CHUNK_%04d" % chunk, boundary_seg, '.xml.gz', path = median_psd_path)}
)
median_psd_nodes.append(median_psd_node)
median_psd_node = \
dagparts.DAGNode(jobs['medianPSD'], dag,
parent_nodes = median_psd_nodes,
input_files = {"": [node.output_files["output-name"] for node in median_psd_nodes]},
output_files = {"output-name": dagparts.T050017_filename(instruments, "REFERENCE_PSD", boundary_seg, '.xml.gz', path = subdir_path([jobs['medianPSD'].output_path, gpsmod5]))}
)
median_psd_node = dagparts.DAGNode(jobs['medianPSD'], dag,
parent_nodes = median_psd_nodes,
input_files = {"": [node.output_files["output-name"] for node in median_psd_nodes]},
output_files = {"output-name": dagparts.T050017_filename(instruments, "REFERENCE_PSD", boundary_seg, '.xml.gz', path = subdir_path([jobs['medianPSD'].output_path, gpsmod5]))}
)
return median_psd_node
def svd_layer(dag, jobs, parent_nodes, psd, bank_cache, options, seg, output_dir, template_mchirp_dict):
svd_nodes = {}
new_template_mchirp_dict = {}
......@@ -1380,7 +1380,6 @@ def load_reference_psd(options):
return ref_psd
if __name__ == "__main__":
import doctest
doctest.testmod()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment