From 73ca1eb1aa5603c2995ccc2a63f76accf4d9aadb Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Mon, 7 Nov 2022 11:52:15 +0100
Subject: [PATCH] warning instead of warn

---
 notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb | 4 ++--
 src/cal_tools/step_timing.py                                  | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
index a5f9a894a..55d1a9ec6 100644
--- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
@@ -76,7 +76,7 @@
     "import sys\n",
     "import warnings\n",
     "from functools import partial\n",
-    "from logging import warn\n",
+    "from logging import warning\n",
     "from pathlib import Path\n",
     "\n",
     "import h5py\n",
@@ -504,7 +504,7 @@
     "        # Raise a WARNING if this sequence has no trains to correct.\n",
     "        # Otherwise, print number of trains with no data.\n",
     "        if corr_ntrains == 0:\n",
-    "            warn(f\"No trains to correct for {sequence_file.name}: \"\n",
+    "            warning(f\"No trains to correct for {sequence_file.name}: \"\n",
     "                 \"Skipping the processing of this file.\")\n",
     "            empty_seq += 1\n",
     "            continue\n",
diff --git a/src/cal_tools/step_timing.py b/src/cal_tools/step_timing.py
index e95362444..a68587dcb 100644
--- a/src/cal_tools/step_timing.py
+++ b/src/cal_tools/step_timing.py
@@ -29,6 +29,8 @@ class StepTimer:
         """Wall time from 1st call to start() to last start() or done_step()"""
         if self.t_latest is not None and self.t0 is not None:
             return self.t_latest - self.t0
+        else:
+            return 0
 
     def print_summary(self):
         """Show mean & std for each step"""
-- 
GitLab