From d2a7f2fab83365658134f1a0bfb31b4602201dfb Mon Sep 17 00:00:00 2001
From: Dan Nixon <dan@dan-nixon.com>
Date: Wed, 1 Apr 2015 09:51:12 +0100
Subject: [PATCH] Add check for sample log existance

Refs #11464
---
 .../ElasticWindowMultiple.py                  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py
index b5778fa9c80..0e2f7424379 100644
--- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py
+++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py
@@ -328,16 +328,19 @@ class ElasticWindowMultiple(DataProcessorAlgorithm):
                 # Get temperature from log file
                 LoadLog(Workspace=ws_name, Filename=log_path)
                 run_logs = mtd[ws_name].getRun()
-                tmp = run_logs[self._sample_log_name].value
-                temp = tmp[len(tmp) - 1]
-                logger.debug('Temperature %d K found for run: %s' % (temp, run_name))
-                return temp
-
+                if self._sample_log_name in run_logs:
+                    tmp = run_logs[self._sample_log_name].value
+                    temp = tmp[len(tmp) - 1]
+                    logger.debug('Temperature %d K found for run: %s' % (temp, run_name))
+                    return temp
+                else:
+                    logger.warning('Log entry %s for run %s not found' % (self._sample_log_name, run_name))
             else:
-                # Can't find log file
                 logger.warning('Log file for run %s not found' % run_name)
-                logger.warning('No temperature found for run: %s' % run_name)
-                return None
+
+        # Can't find log file
+        logger.warning('No temperature found for run: %s' % run_name)
+        return None
 
 
 # Register algorithm with Mantid
-- 
GitLab