From 243d2f64c44e24fd28084c057ae30c1683d08057 Mon Sep 17 00:00:00 2001
From: Vlad Kondratiev <vlad.kondratiev@gmail.com>
Date: Fri, 12 May 2023 07:22:03 +0200
Subject: [PATCH] added writing requantisation command to the
 ldv_psrfits_requantisation.log

---
 bf_pulp_utils/bf_pulp_utils/psrfits_requantisation.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bf_pulp_utils/bf_pulp_utils/psrfits_requantisation.py b/bf_pulp_utils/bf_pulp_utils/psrfits_requantisation.py
index 8e1acb0..dc98044 100644
--- a/bf_pulp_utils/bf_pulp_utils/psrfits_requantisation.py
+++ b/bf_pulp_utils/bf_pulp_utils/psrfits_requantisation.py
@@ -165,9 +165,14 @@ def main():
             # removing the converted file if it's still there (for instance after the crash, etc).
             # otherwise psrfits_subband will not work - can't override the file if it exists already
             os.system("rm -f %s.fits" % (outputbase))
+            outf = open(logfile, 'w')
+            outf.write("=" * 75 + "\n")
+            outf.write("Input PSRFITS file: %s\n" % (ii))
+            outf.write("Command: %s\n" % (cmd))
+            outf.close()
             proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=STDOUT, cwd="%s/%s" % (workdir, rootdir), shell=False)
             (sout, serr) = proc.communicate()
-            outf = open(logfile, 'w')
+            outf = open(logfile, 'a')
             outf.write(sout.decode("utf-8").replace("\r\n", "\n"))
             outf.close()
             for line in sout.decode("utf-8").split("\n"):
-- 
GitLab