From f3ec684fedbe019ffdfa36acde3511c874350e1c Mon Sep 17 00:00:00 2001 From: Atharva Arya <55894364+atharva-2001@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:43:42 +0530 Subject: [PATCH] Set contents of temporary file if reference data does not match in `ref_data_compare_from_paths.ipynb` (#58) * Set contents of tmp file to zero if datasets do not match * change file location and contents * Rename file variable to fh --- notebooks/ref_data_compare_from_paths.ipynb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/notebooks/ref_data_compare_from_paths.ipynb b/notebooks/ref_data_compare_from_paths.ipynb index 8ad24ef7..037e1fa3 100644 --- a/notebooks/ref_data_compare_from_paths.ipynb +++ b/notebooks/ref_data_compare_from_paths.ipynb @@ -9,7 +9,6 @@ "import os\n", "import sys\n", "import shutil\n", - "import tempfile\n", "import subprocess\n", "import numpy as np\n", "import pandas as pd\n", @@ -456,6 +455,22 @@ " tmp2['/test_runner_simple/spectrum_virtual/_frequency'][:-1], \n", " tmp2['/test_runner_simple/spectrum_virtual/luminosity'])" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if False in tt.match.values or None in tt.match.values:\n", + " print(\"Reference files do not match, setting contents of tmp file to zero.\")\n", + " with open('refdata_compare_result', 'w+') as fh:\n", + " fh.write('REFDATA COMPARISON FAILED')\n", + "else:\n", + " print(\"Reference files match.\")\n", + " with open('refdata_compare_result', 'w+') as fh:\n", + " fh.write('REFDATA COMPARISON SUCCEEDED') " + ] } ], "metadata": {