From 81c3ee5471433ca5d9f220f05f315439ee5fd1dc Mon Sep 17 00:00:00 2001
From: Brendan Sullivan <sullivanbt@ornl.gov>
Date: Wed, 13 Jun 2018 14:29:25 -0400
Subject: [PATCH] Re #22567 flake8 fixes

---
 .../plugins/algorithms/IntegratePeaksProfileFitting.py | 10 ++++++----
 .../plugins/functions/BivariateGaussian.py             |  2 +-
 scripts/SCD_Reduction/BVGFitTools.py                   |  4 ----
 scripts/SCD_Reduction/ICCFitTools.py                   |  6 +++---
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py
index acf3ae01be6..49484fe5f0d 100644
--- a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py
+++ b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksProfileFitting.py
@@ -13,6 +13,7 @@ import numpy as np
 
 class IntegratePeaksProfileFitting(PythonAlgorithm):
 
+
     def summary(self):
         return 'Fits a series fo peaks using 3D profile fitting as an Ikeda-Carpenter function by a bivariate gaussian.'
 
@@ -58,7 +59,7 @@ class IntegratePeaksProfileFitting(PythonAlgorithm):
                              extensions=[".pkl"]))
         self.declareProperty("IntensityCutoff", defaultValue=0., doc="Minimum number of counts to force a profile")
         edgeDocString = 'Pixels within EdgeCutoff from a detector edge will be have a profile forced.  Currently for Anger cameras only.'
-        self.declareProperty("EdgeCutoff", defaultValue=0., doc=edgeDocString) 
+        self.declareProperty("EdgeCutoff", defaultValue=0., doc=edgeDocString)
         self.declareProperty("FracHKL", defaultValue=0.5, validator=FloatBoundedValidator(lower=0., exclusive=True),
                              doc="Fraction of HKL to consider for profile fitting.")
         self.declareProperty("FracStop", defaultValue=0.05, validator=FloatBoundedValidator(lower=0., exclusive=True),
@@ -69,7 +70,8 @@ class IntegratePeaksProfileFitting(PythonAlgorithm):
 
         self.declareProperty("MinpplFrac", defaultValue=0.7, doc="Min fraction of predicted background level to check")
         self.declareProperty("MaxpplFrac", defaultValue=1.5, doc="Max fraction of predicted background level to check")
-        self.declareProperty("MindtBinWidth", defaultValue=15, doc="Smallest spacing (in microseconds) between data points for TOF profile fitting.")
+        mindtBinWidthDocString = "Smallest spacing (in microseconds) between data points for TOF profile fitting."
+        self.declareProperty("MindtBinWidth", defaultValue=15, doc=mindtBinWidthDocString)
 
         self.declareProperty("NTheta", defaultValue=50, doc="Number of bins for bivarite Gaussian along the scattering angle.")
         self.declareProperty("NPhi", defaultValue=50,  doc="Number of bins for bivariate Gaussian along the azimuthal angle.")
@@ -193,8 +195,8 @@ class IntegratePeaksProfileFitting(PythonAlgorithm):
             except KeyboardInterrupt:
                 raise
             except:
-                raise
-                #numerrors += 1
+                # raise
+                numerrors += 1
                 peak.setIntensity(0.0)
                 peak.setSigmaIntensity(1.0)
 
diff --git a/Framework/PythonInterface/plugins/functions/BivariateGaussian.py b/Framework/PythonInterface/plugins/functions/BivariateGaussian.py
index 4bf946d56ba..e3bc87e1435 100644
--- a/Framework/PythonInterface/plugins/functions/BivariateGaussian.py
+++ b/Framework/PythonInterface/plugins/functions/BivariateGaussian.py
@@ -3,7 +3,7 @@ from mantid.api import IFunction1D, FunctionFactory
 from matplotlib.mlab import bivariate_normal
 
 
-class BivariateGaussian(IFunction1D): 
+class BivariateGaussian(IFunction1D):
     """
     BivariateGaussian implements a bivariate gaussian (BivariateGaussian) in Mantid (M) as a 1D function.  This is done so that it can be
     fit in a straightforward fashion using Mantid's Fit() function.  To achieve this, we use the flattened
diff --git a/scripts/SCD_Reduction/BVGFitTools.py b/scripts/SCD_Reduction/BVGFitTools.py
index 5852575e671..3a978a86c68 100644
--- a/scripts/SCD_Reduction/BVGFitTools.py
+++ b/scripts/SCD_Reduction/BVGFitTools.py
@@ -250,9 +250,6 @@ def fitTOFCoordinate(box, peak, padeCoefficients, dtSpread=0.03, minFracPixels=0
 
     yScaled = (yFit - bg) / np.max(yFit - bg)
     goodIDX = yScaled > fracStop
-    if np.sum(goodIDX) > 0:
-        iStart = np.min(np.where(goodIDX))
-        iStop = np.max(np.where(goodIDX))
 
     interpF = interp1d(x, yFit, kind='cubic')
     tofxx = np.linspace(tofWS.readX(0).min(), tofWS.readX(0).max(), 1000)
@@ -523,7 +520,6 @@ def doBVGFit(box, nTheta=200, nPhi=200, zBG=1.96, fracBoxToHistogram=1.0, goodID
         m = BivariateGaussian.BivariateGaussian()
         m.init()
         m['A'] = 0.1
-        
         #m['muX'] = np.average(thCenters,weights=np.sum(h,axis=1))
         #m['muY'] = np.average(phCenters,weights=np.sum(h,axis=0))
 
diff --git a/scripts/SCD_Reduction/ICCFitTools.py b/scripts/SCD_Reduction/ICCFitTools.py
index 70717347c7f..032683a9fcb 100644
--- a/scripts/SCD_Reduction/ICCFitTools.py
+++ b/scripts/SCD_Reduction/ICCFitTools.py
@@ -931,9 +931,9 @@ def integrateSample(run, MDdata, peaks_ws, paramList, UBMatrix, dQ, qMask, padeC
                 wavelength = peak.getWavelength()  # in Angstrom
                 energy = 81.804 / wavelength**2 / 1000.0  # in eV
                 flightPath = peak.getL1() + peak.getL2()  # in m
-                print( '---fitting peak ' + \
-                    str(i) + '  Num events: ' + \
-                    str(Box.getNEvents()), ' ', peak.getHKL())
+                print( '---fitting peak ' + 
+                       str(i) + '  Num events: ' + 
+                       str(Box.getNEvents()), ' ', peak.getHKL())
                 if Box.getNEvents() < 1 or np.all(np.abs(peak.getHKL()) == 0):
                     print("Peak %i has 0 events or is HKL=000. Skipping!" % i)
                     peak.setIntensity(0)
-- 
GitLab