From 4e2ba02c0b35020116ce140f8b20732422190a39 Mon Sep 17 00:00:00 2001 From: Patrick Godwin <patrick.godwin@ligo.org> Date: Tue, 28 May 2019 16:56:27 -0700 Subject: [PATCH] dagparts.py: add cache_to_instruments(), used in group_T050017_filename_from_T050017_files() to fix bug repeating same ifo when used repeatedly --- gstlal/python/dagparts.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gstlal/python/dagparts.py b/gstlal/python/dagparts.py index c208d86e38..3ebfcc65de 100644 --- a/gstlal/python/dagparts.py +++ b/gstlal/python/dagparts.py @@ -351,6 +351,17 @@ def breakupseglists(seglists, maxextent, overlap): # +def cache_to_instruments(cache): + """! + Given a cache, returns back a string containing all the IFOs that are + contained in each of its cache entries, sorted by IFO name. + """ + observatories = set() + for cache_entry in cache: + observatories.update(groups(cache_entry.observatory, 2)) + return ''.join(sorted(list(observatories))) + + def T050017_filename(instruments, description, seg, extension, path = None): """! A function to generate a T050017 filename. @@ -383,7 +394,7 @@ def group_T050017_filename_from_T050017_files(cache_entries, extension, path = N files from H1 and template bank files from L1. """ # Check that every file has same observatory. - observatories = ''.join(sorted(list(set([cache_entry.observatory for cache_entry in cache_entries])))) + observatories = cache_to_instruments(cache_entries) split_description = cache_entries[0].description.split('_') min_bin = [x for x in split_description[:2] if x.isdigit()] max_bin = [x for x in cache_entries[-1].description.split('_')[:2] if x.isdigit()] -- GitLab