From 9b24117f6e1397fe2903f1179652f493c545bc16 Mon Sep 17 00:00:00 2001 From: karnem <mikhail.karnevskiy@desy.de> Date: Tue, 16 Jul 2019 15:59:26 +0200 Subject: [PATCH] Small refactoring --- cal_tools/cal_tools/tools.py | 2 +- notebooks/LPD/LPDChar_Darks_NBC.ipynb | 14 ++++++++------ xfel_calibrate/calibrate.py | 13 ++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/cal_tools/cal_tools/tools.py b/cal_tools/cal_tools/tools.py index 8eb72105f..c82137238 100644 --- a/cal_tools/cal_tools/tools.py +++ b/cal_tools/cal_tools/tools.py @@ -54,7 +54,7 @@ def combine_report(run_path, calibration): with open("{}/{}.rst".format(sphinx_path, group), "a") as gfile: if conc_param != "None": - title = "{}. {} = {}".format(calibration, name_param, + title = "{}, {} = {}".format(calibration, name_param, conc_param) gfile.write(title + "\n") gfile.write("=" * len(title) + "\n") diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb index 360eebee4..00fcd83e1 100644 --- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb +++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb @@ -6,7 +6,7 @@ "source": [ "# Offset, Noise and Dead Pixels Characterization #\n", "\n", - "Author: S. Hauf, Version: 0.1\n", + "Author: S. Hauf\n", "\n", "This notebook performs recharacterize of dark images to get offset, noise and bad-pixel maps. All 3 type of constants are evaluated per pixel and per memory cell.\n", "\n", @@ -14,13 +14,15 @@ "\n", "Evaluated calibration constants are stored locally and injected in the calibration data base.\n", "\n", - "**Offset** ($O$) is defined as median ($M$) of dark signal ($Ds$) over trains ($t$) for a given pixel ($x,y$) and memory cell ($c$). **Noise** $N$ is a standard deviation $\\delta$ of dark signal.\n", + "**Offset** ($O$) is defined as median ($M$) of dark signal ($Ds$) over trains ($t$) for a given pixel ($x,y$) and memory cell ($c$). \n", + "\n", + "**Noise** $N$ is a standard deviation $\\delta$ of dark signal.\n", "\n", "$$ O_{x,y,c} = M(Ds)_{t} ,\\,\\,\\,\\,\\,\\, N_{x,y,c} = \\delta(Ds)_{t}$$\n", "\n", "**Bad-pixel** mask is evaluated bitweise.\n", "\n", - "** Bit: \"Offset_out_of_threshold\": **\n", + "**Bit: \"OFFSET_OUT_OF_THRESHOLD\":**\n", "\n", "Offset outside of bounds:\n", "\n", @@ -30,7 +32,7 @@ "\n", "$$thresholds\\_offset\\_hard\\_low < O < thresholds\\_offset\\_hard\\_high $$\n", "\n", - "** Bit: \"Noise_out_of_threshold\": **\n", + "**Bit: \"NOISE_OUT_OF_THRESHOLD\":**\n", "\n", "Noise outside of bounds:\n", "\n", @@ -40,7 +42,7 @@ "\n", "$$thresholds\\_noise\\_hard\\_low < N < thresholds\\_noise\\_hard\\_high $$\n", "\n", - "** Bit: \"\"OFFSET_NOISE_EVAL_ERROR\": **\n", + "**Bit: \"OFFSET_NOISE_EVAL_ERROR\":**\n", "\n", "Offset and Noise both not $nan$ values \n", "\n", @@ -1088,7 +1090,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Aggregate values, and per cell behaviour ##\n", + "## Aggregate values and per cell behaviour ##\n", "\n", "Following tables and plots give an overview of statistical aggregates for each constant, as well as per cell behavior, averaged across pixels." ] diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py index c8d9d859e..d1353b09e 100755 --- a/xfel_calibrate/calibrate.py +++ b/xfel_calibrate/calibrate.py @@ -407,7 +407,8 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None, parms = extract_parameters(nb) params = parameter_values(parms, **args) new_nb = replace_definitions(nb, params, execute=False) - first_markdown_cell(new_nb).source = '' + if len(job_list) > 0 and not final_job: + first_markdown_cell(new_nb).source = '' set_figure_format(new_nb, args["vector_figs"]) base_name = nbname.replace(".ipynb", "") new_name = "{}__{}__{}.ipynb".format( @@ -658,15 +659,21 @@ def run(): cmd = ('"from cal_tools.tools import finalize; ' + 'finalize({{joblist}}, $1, \'{run_path}\', \'{out_path}\', ' + '\'{project}\', \'{calibration}\', \'{author}\', ' - '\'{version}\', \'{report_to}\')"') + '\'{version}\', \'{report_to}\', \'{in_folder}\' )"') report_to = title.replace(" ", "") if args["report_to"] is not None: report_to = args["report_to"] + folder = '' + for p in parms: + if p.name == 'in_folder': + folder = p.value + fmtcmd = cmd.format(run_path=run_tmp_path, out_path=out_path, project=title, calibration=title, - author=author, version=version, report_to=report_to) + author=author, version=version, + report_to=report_to, in_folder=folder) joblist = [] if concurrency.get("parameter", None) is None: -- GitLab