From 64b60cf91740af5cda5429f7771be95168c4b021 Mon Sep 17 00:00:00 2001 From: Daichi Tsuna <daichi.tsuna@ligo.org> Date: Mon, 15 Apr 2019 02:16:37 -0700 Subject: [PATCH] gstlal_inspiral_lvalert_sngls_plotter: avoid reading files with ~ suffix --- gstlal-inspiral/bin/gstlal_inspiral_lvalert_sngls_plotter | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_sngls_plotter b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_sngls_plotter index c6956f09c0..9f635e24a6 100755 --- a/gstlal-inspiral/bin/gstlal_inspiral_lvalert_sngls_plotter +++ b/gstlal-inspiral/bin/gstlal_inspiral_lvalert_sngls_plotter @@ -19,7 +19,6 @@ import sys import os -import subprocess import re import time import logging @@ -31,6 +30,7 @@ import matplotlib matplotlib.use('Agg') from matplotlib import pyplot import multiprocessing +import glob matplotlib.rcParams.update({ @@ -133,16 +133,13 @@ except OSError: # FIXME hardcodes gps digits to 5 to match current -subprocess.call(["ls %s/* | lalapps_path2cache > %s/%s.cache" % (str(gps)[:5], wd, str(gps))], shell=True) -subprocess.call(["ls %s/* | lalapps_path2cache >> %s/%s.cache" % (str(gps - 100000)[:5], wd, str(gps))], shell=True) -subprocess.call(["ls %s/* | lalapps_path2cache >> %s/%s.cache" % (str(gps + 100000)[:5], wd, str(gps))], shell=True) +ce = map(CacheEntry.from_T050017, sum((glob.glob(pattern) for pattern in [os.path.join(str(gps)[:5],"*.xml.gz"), os.path.join(str(gps - 100000)[:5],"*.xml.gz"), os.path.join(str(gps + 100000)[:5],"*.xml.gz")]), [])) # Parse the files in many threads # FIXME don't hard code this regex pattern = re.compile("0[0-9]{3}_LLOID$") pool = multiprocessing.Pool(8) -ce = [CacheEntry(l) for l in open("%s/%s.cache" % (wd, str(gps)))] sngl = [] for res in pool.map(parse, [c for c in ce if gps in c.segment and pattern.match(c.description)]): sngl.extend(res) -- GitLab