From 8e0ac83b94e77728f85909091d1dcf3d12ab4f6e Mon Sep 17 00:00:00 2001
From: karnem <mikhail.karnevskiy@desy.de>
Date: Thu, 23 May 2019 14:15:50 +0200
Subject: [PATCH] Change formatting of list of input parameters

---
 xfel_calibrate/calibrate.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py
index a7655aa7b..34a25713c 100755
--- a/xfel_calibrate/calibrate.py
+++ b/xfel_calibrate/calibrate.py
@@ -528,15 +528,24 @@ def run():
         # Write all input parameters to rst file to be included to final report
         parms = parameter_values(parms, **args)
         with open("{}/slurm_tmp_{}/InputParameters.rst".format(temp_path, run_uuid), "w") as finfile:
-            finfile.write("Input Parameters \n")
-            finfile.write("================ \n")
+            finfile.write("Input of the calibration pipeline \n")
+            finfile.write("================================= \n\n")
+            finfile.write(".. math::\n")
+            finfile.write("    \\begin{tabular}{ll}\n")
+            finfile.write("    \\hline\n")
             for p in parms:
-                finfile.write("{} \n\n".format(p.comment))
-                finfile.write(".. parsed-literal::\n")
+                #finfile.write("{} \n\n".format(p.comment))
+                #finfile.write(".. parsed-literal::\n")
                 if p.type is str:
-                    finfile.write("    {} = '{}' \n\n".format(p.name, p.value))
+                    tmpl = "    \\textbf{{-{{}}-{} }} & ``{}'', {}\\\\\n"
                 else:
-                    finfile.write("    {} = {} \n\n".format(p.name, p.value))
+                    tmpl = "    \\textbf{{-{{}}-{} }} & {}, {}\\\\\n"
+
+                finfile.write(tmpl.format(p.name.replace('_', '-'),
+                                          str(p.value).replace('_', '\\_'),
+                                          str(p.comment)[1:].replace('_', '\\_')))
+            finfile.write("    \\hline\n")
+            finfile.write("    \\end{tabular}\n")
 
         # wait on all jobs to run and then finalize the run by creating a report from the notebooks
         out_path = "{}/{}/{}/{}".format(report_path, detector.upper(),
-- 
GitLab