Commit 1a8eee0e authored by Vivien Raymond's avatar Vivien Raymond

Merge branch 'pesummary_v0.1.7' into 'master'

Update code for PESummary v0.1.7

See merge request !834
parents 90892c1a 04afcbef
Pipeline #69685 passed with stages
in 186 minutes and 49 seconds
...@@ -1315,11 +1315,26 @@ class LALInferencePipelineDAG(pipeline.CondorDAG): ...@@ -1315,11 +1315,26 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos, respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos,
evstring=evstring, coherence=True) evstring=evstring, coherence=True)
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files()) respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
try:
cachefiles = self.config.get('resultspage','plot-strain-data')
cachefiles_option = True
except:
cachefiles_option = False
if cachefiles_option:
respagenode.set_cache_files(enginenodes[0].channels, enginenodes[0].cachefiles)
try:
labels = self.config.get('resultspage','label')
except:
labels = None
respagenode.set_labels(labels)
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_gid(gid)
if os.path.exists(self.basepath+'/coinc.xml'): if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid) respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
else: else:
...@@ -1333,11 +1348,25 @@ class LALInferencePipelineDAG(pipeline.CondorDAG): ...@@ -1333,11 +1348,25 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos, respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos,
evstring=evstring, coherence=False) evstring=evstring, coherence=False)
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files()) respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
try:
cachefiles = self.config.get('resultspage','plot-strain-data')
cachefiles_option = True
except:
cachefiles_option = False
if cachefiles_option:
respagenode.set_cache_files(enginenodes[0].channels, enginenodes[0].cachefiles)
try:
labels = self.config.get('resultspage','label')
except:
labels = None
respagenode.set_labels(labels)
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_gid(gid)
if os.path.exists(self.basepath+'/coinc.xml'): if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid) respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
else: else:
respagenode=self.add_results_page_node(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos) respagenode=self.add_results_page_node(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos)
...@@ -1444,6 +1473,21 @@ class LALInferencePipelineDAG(pipeline.CondorDAG): ...@@ -1444,6 +1473,21 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
if "summarypages" in self.config.get('condor','resultspage'): if "summarypages" in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos, evstring=evstring, coherence=self.config.getboolean('analysis','coherence-test')) respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos, evstring=evstring, coherence=self.config.getboolean('analysis','coherence-test'))
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files()) respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
try:
cachefiles = self.config.get('resultspage','plot-strain-data')
cachefiles_option = True
except:
cachefiles_option = False
if cachefiles_option:
respagenode.set_cache_files(enginenodes[0].channels, enginenodes[0].cachefiles)
try:
labels = self.config.get('resultspage','label')
except:
labels = None
respagenode.set_labels(labels)
if os.path.exists(self.basepath+'/coinc.xml'): if os.path.exists(self.basepath+'/coinc.xml'):
try: try:
gid = self.config.get('input','gid') gid = self.config.get('input','gid')
...@@ -2818,6 +2862,17 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode): ...@@ -2818,6 +2862,17 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode):
psds += " %s:%s" %(i, st[num]) psds += " %s:%s" %(i, st[num])
self.add_var_arg('--psd%s'%psds) self.add_var_arg('--psd%s'%psds)
def set_cache_files(self, channels, cachefiles):
if cachefiles == {}:
return
if channels is None:
return
gwdata = ""
for i in channels.keys():
gwdata += " %s:%s" % (channels[i], cachefiles[i])
self.add_var_arg('--gwdata%s'%gwdata)
def set_calibration_files(self,ifos,st): def set_calibration_files(self,ifos,st):
if st is None: if st is None:
return return
...@@ -2827,6 +2882,12 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode): ...@@ -2827,6 +2882,12 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode):
calibration += " %s:%s" %(i, st[num]) calibration += " %s:%s" %(i, st[num])
self.add_var_arg('--calibration %s' %calibration) self.add_var_arg('--calibration %s' %calibration)
def set_labels(self, labels):
if labels is None:
return
l = labels.split(",")
self.add_var_arg('--labels %s'%(" ".join(l)))
def set_snr_file(self,st): def set_snr_file(self,st):
if st is None: if st is None:
return return
...@@ -2850,6 +2911,11 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode): ...@@ -2850,6 +2911,11 @@ class PESummaryResultsPageNode(pipeline.CondorDAGNode):
def get_pos_file(self): def get_pos_file(self):
return self.posfile return self.posfile
def set_gid(self, gid):
if gid is None:
return
self.add_var_arg('--gracedb '+gid)
def set_bayes_coherent_incoherent(self,bcifile): def set_bayes_coherent_incoherent(self,bcifile):
self.add_file_opt('bci',bcifile) self.add_file_opt('bci',bcifile)
......
...@@ -73,6 +73,10 @@ def add_variations(cp, section, option, values=None, allowed_values=None): ...@@ -73,6 +73,10 @@ def add_variations(cp, section, option, values=None, allowed_values=None):
if not cp.has_section(section) and not cp.has_option(section,option): if not cp.has_section(section) and not cp.has_option(section,option):
return return
try:
labels = cp.get('resultspage','label').split(',')
except:
labels = None
if values is not None: if values is not None:
vals = values vals = values
else: else:
...@@ -84,9 +88,17 @@ def add_variations(cp, section, option, values=None, allowed_values=None): ...@@ -84,9 +88,17 @@ def add_variations(cp, section, option, values=None, allowed_values=None):
) )
) )
if len(vals) >1: if len(vals) >1:
if labels is not None:
if len(labels) != len(vals):
raise ValueError(
"The number of labels does not match the "
"number of {}'s given".format(option))
return {(section,option): [[i,j] for i,j in zip(vals, labels)]}
return {(section,option): vals} return {(section,option): vals}
elif len(vals)==1: elif len(vals)==1:
cp.set(section, option, vals[0]) cp.set(section, option, vals[0])
if labels is not None:
cp.set('resultspage', 'label', labels[0])
return {} return {}
else: else:
print(("Found no variations of [{section}] {option}".format(section=section, print(("Found no variations of [{section}] {option}".format(section=section,
...@@ -177,7 +189,12 @@ def generate_variations(master_cp, variations): ...@@ -177,7 +189,12 @@ def generate_variations(master_cp, variations):
cp = configparser.ConfigParser() cp = configparser.ConfigParser()
cp.optionxform = str cp.optionxform = str
cp.read(masterpath) cp.read(masterpath)
cp.set(section,opt,val) if type(val) == list:
cp.set(section,opt,val[0])
cp.set('resultspage','label',val[1])
val = val[0]
else:
cp.set(section,opt,val)
# Append to the paths # Append to the paths
cp.set('paths','basedir',os.path.join(cur_basedir, \ cp.set('paths','basedir',os.path.join(cur_basedir, \
'{val}'.format(opt=opt,val=val))) '{val}'.format(opt=opt,val=val)))
......
...@@ -452,6 +452,16 @@ skyres=0.5 ...@@ -452,6 +452,16 @@ skyres=0.5
# Send an email linking to the final page # Send an email linking to the final page
#email=albert.einstein@ligo.org #email=albert.einstein@ligo.org
# Generate a plot showing the strain data at time of merger with the maxL
# waveform superimposed. Can only be used when the resultpage executable
# is resultspage=%(lalsuite-install)s/bin/summarypages
#plot-strain-data=
# Label for your analysis. Can either be a single label or a comma seperated
# list e.g. label = EXP0,EXP1. Can only be used when the resultpage executable
# is resultspage=%(lalsuite-install)s/bin/summarypages
#label = EXP1
##################################################################################### #####################################################################################
[statevector] [statevector]
......
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