From fdf7227e3c1d61af35cff59605243b550889f20f Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Wed, 6 Sep 2023 16:56:30 -0500 Subject: [PATCH] move tracking of input files to coadder --- maps/python/map_modules.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/maps/python/map_modules.py b/maps/python/map_modules.py index a94ba3cc..19b6aeba 100644 --- a/maps/python/map_modules.py +++ b/maps/python/map_modules.py @@ -606,6 +606,19 @@ def __call__(self, frame): map_ids += [map_id] cfr["InputMapIds"] = core.G3VectorString(map_ids) + if "InputFiles" in cfr: + input_files = list(cfr.pop("InputFiles")) + else: + input_files = [] + if "InputFiles" in frame: + # allow for recursive coadds + input_files += list(frame["InputFiles"]) + elif getattr(frame, "filename", None): + if frame.filename not in input_files: + input_files += [frame.filename] + if len(input_files): + cfr["InputFiles"] = core.G3VectorString(input_files) + for key in ["T", "Q", "U", "Wpol", "Wunpol"]: if key not in frame: continue @@ -674,13 +687,6 @@ def coadd_map_files( ) pipe.Add(coadder) - def RecordInputFiles(frame): - if frame.type != core.G3FrameType.Map: - return - frame["InputFiles"] = core.G3VectorString(input_files) - - pipe.Add(RecordInputFiles) - if output_file: pipe.Add(core.G3Writer, filename=output_file) pipe.Run()