Gitlab@AEI Hannover will go down for maintenance on 2020-09-21 at 4:00 UTC. The service will be unavailable for up to 24 hours. If you have questions about this please contact

Commit fcf6c307 authored by David Keitel's avatar David Keitel

Writer.check_cached_data_okay_to_use(): fix comparing new commandline against old SFT header

 -this used to require exact string match, but SFT header
  can for some reason have the CLAs reordered
  (e.g. when ephemerides are involved)
 -introduce new helper function match_commandlines()
  and do proper unordered set comparison
 -also comment out log info about cff content checking,
  which wasn't actually implemented!
parent 69c31083
......@@ -369,3 +369,16 @@ def twoFDMoffThreshold(
return twoFDMoffthreshold_below_threshold
return 10 ** (prefactor * np.log10(twoFon - offset))
def match_commandlines(cl1, cl2, be_strict_about_full_executable_path=False):
""" Check if two commandlines match element-by-element, regardless of order """
cl1s = cl1.split(" ")
cl2s = cl2.split(" ")
# first item will be the executable name
# by default be generous here and do not worry about full paths
if not be_strict_about_full_executable_path:
cl1s[0] = os.path.basename(cl1s[0])
cl2s[0] = os.path.basename(cl2s[0])
unmatched = np.setxor1d(cl1s,cl2s)
return len(unmatched)==0
......@@ -281,15 +281,23 @@ transientTau = {:10.0f}\n"""
self.config_file_name, self.sftfilepath
)"Checking contents of cff file")"Checking contents of cff file") # FIXME: check doesn't seem to exist...?
#if not XXX:"Contents unmatched")
#return False"Checking commandline against existing SFT header")
cl_dump = "lalapps_SFTdumpheader {} | head -n 20".format(self.sftfilepath)
output = helper_functions.run_commandline(cl_dump)
found = [True for line in output.split("\n") if line[-len(cl_mfd) :] == cl_mfd]
if any(found):"Contents matched, use old sft file")
header_lines_lalapps = [line for line in output.split("\n") if "lalapps" in line]
if len(header_lines_lalapps)==0:"Could not obtain comparison commandline from old SFT header")
return False
cl_old = header_lines_lalapps[0]
if helper_functions.match_commandlines(cl_old,cl_mfd):"Commandline matched with old SFT header, use old sft file")
return True
else:"Contents unmatched, create new sft file")"Commandlines unmatched, create new sft file")
return False
def check_if_cff_file_needs_rewritting(self, content):
......@@ -358,8 +366,8 @@ transientTau = {:10.0f}\n"""
cl_mfd = " ".join(cl_mfd)
if self.check_cached_data_okay_to_use(cl_mfd) is False:
check_ok = self.check_cached_data_okay_to_use(cl_mfd)
if check_ok is False:
def predict_fstat(self):
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