diff --git a/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py b/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py
index 19017dea380143fcbe251e2c0cb652e2f9a1f148..9ef2e40aa18f470f27e0ed488dcc8a7502db94d9 100644
--- a/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py
+++ b/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py
@@ -175,6 +175,7 @@ class ComputeIncoherentDOS(PythonAlgorithm):
             #yunit = 'DeltaE_inWavenumber'
         else:
             #yunit = 'DeltaE'
+            pass
 
         # Outputs the calculated density of states to another workspace
         dos2d = CloneWorkspace(inws)
diff --git a/Framework/PythonInterface/plugins/algorithms/CorrectTOF.py b/Framework/PythonInterface/plugins/algorithms/CorrectTOF.py
index 1331f341875ddeadabbc7966fd485128a43d12a6..1500ba585f43af5694eea4bb1de4844c12fea184 100644
--- a/Framework/PythonInterface/plugins/algorithms/CorrectTOF.py
+++ b/Framework/PythonInterface/plugins/algorithms/CorrectTOF.py
@@ -1,10 +1,10 @@
+import numpy as np
+import scipy as sp
 from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceUnitValidator, \
                        InstrumentValidator, ITableWorkspaceProperty
 from mantid.kernel import Direction, CompositeValidator
 # pylint: disable=no-name-in-module
 from mantid.simpleapi import CloneWorkspace, MaskDetectors
-import numpy as np
-import scipy as sp
 
 
 class CorrectTOF (PythonAlgorithm):
diff --git a/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py b/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py
index 756d73e7baf7240f7090fa5255f51d4a00e2201b..1b6147e7b8770e6628126f843b1517a314e5109a 100644
--- a/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py
+++ b/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py
@@ -1,4 +1,6 @@
 #pylint: disable=no-init,too-many-locals,too-many-instance-attributes
+import math
+import numpy as np
 
 from mantid.simpleapi import *
 from mantid.api import (PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty,
@@ -7,9 +9,6 @@ from mantid.kernel import (StringListValidator, StringMandatoryValidator,
                            FloatBoundedValidator, Direction, logger, CompositeValidator)
 from mantid import config
 
-import math
-import numpy as np
-
 
 class CylinderPaalmanPingsCorrection(PythonAlgorithm):
 
diff --git a/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py b/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py
index 775cc7de95f247f599ff7ab28132c2b6bd04e24c..de331ecb5560c97b7f61c161dd25c83f244cfa6b 100644
--- a/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py
+++ b/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py
@@ -1,12 +1,11 @@
 #pylint: disable=no-init,too-many-locals,too-many-instance-attributes,too-many-arguments,invalid-name
-
+import math
+import numpy as np
 from mantid.simpleapi import *
 from mantid.api import (PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty,
                         WorkspaceGroupProperty, InstrumentValidator, WorkspaceUnitValidator, Progress)
 from mantid.kernel import (StringListValidator, StringMandatoryValidator, IntBoundedValidator,
                            FloatBoundedValidator, Direction, logger, CompositeValidator)
-import math
-import numpy as np
 
 
 class CylinderPaalmanPingsCorrection(PythonAlgorithm):
@@ -295,7 +294,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm):
 
     def _sample(self):
         sample_prog = Progress(self, start=0.01, end=0.03, nreports=2)
-        sample_prog.report('Setting Sample Material for Sample') 
+        sample_prog.report('Setting Sample Material for Sample')
         SetSampleMaterial(self._sample_ws_name , ChemicalFormula=self._sample_chemical_formula,
                           SampleNumberDensity=self._sample_number_density)
         sample = mtd[self._sample_ws_name].sample()
@@ -311,7 +310,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm):
         self._density[0] = self._sample_number_density
 
         if self._use_can:
-            sample_prog.report('Setting Sample Material for Container') 
+            sample_prog.report('Setting Sample Material for Container')
             SetSampleMaterial(InputWorkspace=self._can_ws_name, ChemicalFormula=self._can_chemical_formula,
                               SampleNumberDensity=self._can_number_density)
             can_sample = mtd[self._can_ws_name].sample()
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py
index 2a43ffb5a2de5d5fcdbaf42677f67be71ca071ed..3458c197deb05764b1d764cf9ee64fa380ba370d 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py
@@ -1,4 +1,7 @@
 #pylint: disable=invalid-name,too-many-instance-attributes,too-many-branches,no-init
+import os
+import numpy as np
+
 from IndirectImport import *
 
 from mantid.api import (PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode,
@@ -6,8 +9,7 @@ from mantid.api import (PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProper
 from mantid.kernel import StringListValidator, Direction
 from mantid.simpleapi import *
 from mantid import config, logger
-import os
-import numpy as np
+
 
 if is_supported_f2py_platform():
     QLr     = import_f2py("QLres")
@@ -364,7 +366,7 @@ class BayesQuasi(PythonAlgorithm):
             yProb = yPr0
             yProb = np.append(yProb,yPr1)
             yProb = np.append(yProb,yPr2)
-            probWs = CreateWorkspace(OutputWorkspace=probWS, DataX=xProb, DataY=yProb, DataE=eProb,\
+            CreateWorkspace(OutputWorkspace=probWS, DataX=xProb, DataY=yProb, DataE=eProb,\
                 Nspec=3, UnitX='MomentumTransfer')
             outWS = C2Fw(self._samWS[:-4],fname)
             if self._plot != 'None':
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py
index 32bb98f27c6a938069e1ccb3c01af95a91ac9472..3ae293c5c50b55f75454d16defff71432909a1aa 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DetectorFloodWeighting.py
@@ -1,10 +1,10 @@
+import numpy as np
+
 from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceUnitValidator, \
 PropertyMode, Progress
 
 from mantid.kernel import Direction, FloatArrayProperty, FloatArrayBoundedValidator
 
-import numpy as np
-
 class DetectorFloodWeighting(DataProcessorAlgorithm):
 
     def __init__(self):
@@ -22,11 +22,11 @@ class DetectorFloodWeighting(DataProcessorAlgorithm):
 
         self.declareProperty(MatrixWorkspaceProperty('InputWorkspace', '',
                                                      direction=Direction.Input, validator=WorkspaceUnitValidator("Wavelength")),
-                                                     doc='Flood weighting measurement')
+                             doc='Flood weighting measurement')
         self.declareProperty(MatrixWorkspaceProperty('TransmissionWorkspace', '',
                                                      direction=Direction.Input, optional=PropertyMode.Optional,
                                                      validator=WorkspaceUnitValidator("Wavelength")),
-                                                     doc='Flood weighting measurement')
+                             doc='Flood weighting measurement')
 
         validator = FloatArrayBoundedValidator()
         validator.setLower(0.)
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py
index 9d2088fbb5203bc48f5ddd73bd6df80ac7787790..614719bbf00ba95afa3166dd18e6267ebc37bb3b 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py
@@ -1,7 +1,7 @@
 #pylint: disable=no-init,invalid-name
+import math
 from mantid.api import *
 from mantid.kernel import *
-import math
 
 class EQSANSAzimuthalAverage1D(PythonAlgorithm):
 
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py
index 78d848dce68579c0d80f6e50c1b08e0e96df9061..f55159654113f0cc5c0c82533180b1f44beb2245 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py
@@ -1,7 +1,7 @@
 #pylint: disable=no-init,invalid-name
+import os
 from mantid.api import *
 from mantid.kernel import *
-import os
 
 class EQSANSDirectBeamTransmission(PythonAlgorithm):
 
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py
index a5b146a597dc2024994db81f288714094a4c0392..dc816f465394393f31a3ada4d4f844f868bf99a8 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py
@@ -1,8 +1,8 @@
 #pylint: disable=no-init
+import os
 from mantid.api import *
 from mantid.kernel import *
 from reduction_workflow.find_data import find_file
-import os
 
 class EQSANSNormalise(PythonAlgorithm):
     """
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py
index 7a4ffbc8b0d727fbb7ce05489248900575613120..a0a9224d4a800ad3542065ad2c053da8c95420a4 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py
@@ -1,10 +1,11 @@
 #pylint: disable=no-init,invalid-name
+import math
+import numpy as np
 from mantid.simpleapi import *
 from mantid.api import PythonAlgorithm, AlgorithmFactory, PropertyMode, MatrixWorkspaceProperty, \
                        WorkspaceGroupProperty, InstrumentValidator, WorkspaceUnitValidator, Progress
 from mantid.kernel import StringListValidator, StringMandatoryValidator, IntBoundedValidator, \
                           FloatBoundedValidator, Direction, logger, CompositeValidator
-import math, numpy as np
 
 #pylint: disable=too-many-instance-attributes
 class FlatPlatePaalmanPingsCorrection(PythonAlgorithm):
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py
index 9abe3e92fcc0897fadfb56af6c79dd3e27b10109..b3058d3ffefd3e244801f4bd1e46bef86b532f35 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py
@@ -1,9 +1,9 @@
 #pylint: disable=no-init,invalid-name,too-many-branches
+import os
 import mantid.simpleapi as api
 from mantid.api import *
 from mantid.kernel import *
 from reduction_workflow.find_data import find_data
-import os
 
 class HFIRSANSReduction(PythonAlgorithm):
 
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py
index 9c1edef264495a42eac76a7722dc8a86e0c07be3..88e74a6a4e16212bfb10f467cc3e4bd62f804a0d 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py
@@ -1,12 +1,11 @@
 #pylint: disable=no-init,too-many-instance-attributes
+import os
 
 from mantid.simpleapi import *
 from mantid.api import *
 from mantid.kernel import *
 from mantid import config
 
-import os
-
 
 class ISISIndirectDiffractionReduction(DataProcessorAlgorithm):
 
@@ -72,7 +71,7 @@ class ISISIndirectDiffractionReduction(DataProcessorAlgorithm):
                              doc='Selects the type of detector grouping to be used.')
 
         self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '',
-                             direction=Direction.Output),
+                                                    direction=Direction.Output),
                              doc='Group name for the result workspaces.')
 
 #------------------------------------------------------------------------------
@@ -120,12 +119,12 @@ class ISISIndirectDiffractionReduction(DataProcessorAlgorithm):
             load_opts['Mode'] = 'FoilOut'
 
         self._workspace_names, self._chopped_data = load_files(self._data_files,
-                                                              self._ipf_filename,
-                                                              self._spectra_range[0],
-                                                              self._spectra_range[1],
-                                                              sum_files=self._sum_files,
-                                                              load_logs=self._load_logs,
-                                                              load_opts=load_opts)
+                                                               self._ipf_filename,
+                                                               self._spectra_range[0],
+                                                               self._spectra_range[1],
+                                                               sum_files=self._sum_files,
+                                                               load_logs=self._load_logs,
+                                                               load_opts=load_opts)
 
         # Load container if run is given
         if self._container_data_files is not None:
diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitSequential.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitSequential.py
index 36009066aaaee9b342f7da17c5d9ad466458647a..832f5a5228fe238955c3ab0187d568f613b9a64d 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitSequential.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitSequential.py
@@ -122,8 +122,8 @@ class IqtFitSequential(PythonAlgorithm):
 
         # Name stem for generated workspace
         output_workspace = '%sIqtFit_%s_s%d_to_%d' % (getWSprefix(self._input_ws.getName()),
-                                                  self._fit_type, self._spec_min,
-                                                  self._spec_max)
+                                                      self._fit_type, self._spec_min,
+                                                      self._spec_max)
 
         setup_prog.report('Converting to Histogram')
         convert_to_hist_alg = self.createChildAlgorithm("ConvertToHistogram")
diff --git a/Framework/PythonInterface/plugins/functions/ChudleyElliot.py b/Framework/PythonInterface/plugins/functions/ChudleyElliot.py
index 90eb73a4f8eb7f1d06db03e3197d1845ff0b84d7..6526a6c1dfeae5b432a4b87236b87c3da0361dd7 100644
--- a/Framework/PythonInterface/plugins/functions/ChudleyElliot.py
+++ b/Framework/PythonInterface/plugins/functions/ChudleyElliot.py
@@ -23,9 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
+import math
+import numpy as np
 from mantid.api import IFunction1D, FunctionFactory
-import math, numpy as np
 
 class ChudleyElliot(IFunction1D):
 
diff --git a/Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py b/Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py
index eebc84e1ebf58dffe722b5843fe29cbbe14f6db4..d896afc4119754e0b32da02d9cf4db4b18537344 100644
--- a/Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py
+++ b/Framework/PythonInterface/plugins/functions/DSFinterp1DFit.py
@@ -23,12 +23,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
+import numpy
+import scipy.interpolate
 from mantid.api import IFunction1D, FunctionFactory
 from mantid.simpleapi import mtd
 from mantid import logger
-import numpy
-import scipy.interpolate
 
 #pylint: disable=too-many-instance-attributes
 
@@ -126,7 +125,7 @@ class DSFinterp1DFit(IFunction1D):
         if not p:
             return numpy.zeros(len(xvals), dtype=float) # return zeros if parameters not valid
         # The first time the function is called requires initialization of the interpolator
-        if self._channelgroup == None:
+        if self._channelgroup is None:
             # Check consistency of the input
             # check InputWorkspaces have at least the workspace index
             for w in self._InputWorkspaces:
diff --git a/Framework/PythonInterface/plugins/functions/Examples/ExamplePeakFunction.py b/Framework/PythonInterface/plugins/functions/Examples/ExamplePeakFunction.py
index 6ab37b8c45239357b89423871abfa5e9a9038425..14ad529144ef276bc745ce213559d3a93c62354c 100644
--- a/Framework/PythonInterface/plugins/functions/Examples/ExamplePeakFunction.py
+++ b/Framework/PythonInterface/plugins/functions/Examples/ExamplePeakFunction.py
@@ -8,9 +8,9 @@ It uses the so-called IPeakFunction that should be used when there is a sensible
 calculate the centre, height & fwhm of the function. If it does not make sense, for example a in linear background,
 where does not give a peak shape, then see the more general Example1DFunction that does not require these concepts.
 """
-from mantid.api import IPeakFunction, FunctionFactory
 import math
 import numpy as np
+from mantid.api import IPeakFunction, FunctionFactory
 
 class ExamplePeakFunction(IPeakFunction):
 
diff --git a/Framework/PythonInterface/plugins/functions/Guinier.py b/Framework/PythonInterface/plugins/functions/Guinier.py
index 204fcec972c17c2769387b0f66fcc923352d9967..734ed1a39ae0493eb6f81209cfa78bc7a4c4b344 100644
--- a/Framework/PythonInterface/plugins/functions/Guinier.py
+++ b/Framework/PythonInterface/plugins/functions/Guinier.py
@@ -23,10 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
 import math
 import numpy as np
+from mantid.api import IFunction1D, FunctionFactory
 
 class Guinier(IFunction1D):
     """
diff --git a/Framework/PythonInterface/plugins/functions/GuinierPorod.py b/Framework/PythonInterface/plugins/functions/GuinierPorod.py
index ddd41fcfc1d79a5d2cb2e52f66292404edd61340..daec61a55c64152ca0c46d4fedbd9f2e53bff095 100644
--- a/Framework/PythonInterface/plugins/functions/GuinierPorod.py
+++ b/Framework/PythonInterface/plugins/functions/GuinierPorod.py
@@ -23,10 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
 import math
 import numpy as np
+from mantid.api import IFunction1D, FunctionFactory
 
 class GuinierPorod(IFunction1D):
     """
@@ -152,8 +151,8 @@ class GuinierPorod(IFunction1D):
         bgd = self.getParameterValue('Background')
 
         output = np.zeros(len(xvals), dtype=float)
-        for i in range(len(xvals)):
-            output[i] = scale * self._guinier_porod_core(xvals[i]) + bgd
+        for i,x in enumerate(xvals):
+            output[i] = scale * self._guinier_porod_core(x) + bgd
         return output
 
     def functionDeriv1D(self, xvals, jacobian):
diff --git a/Framework/PythonInterface/plugins/functions/HallRoss.py b/Framework/PythonInterface/plugins/functions/HallRoss.py
index d1119183862858730578a4debe2530baf6edf5a3..e103f8da04084872bf886cda70fbece266d04231 100644
--- a/Framework/PythonInterface/plugins/functions/HallRoss.py
+++ b/Framework/PythonInterface/plugins/functions/HallRoss.py
@@ -23,9 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
+import math
+import numpy as np
 from mantid.api import IFunction1D, FunctionFactory
-import math, numpy as np
 
 class HallRoss(IFunction1D):
 
diff --git a/Framework/PythonInterface/plugins/functions/Lorentz.py b/Framework/PythonInterface/plugins/functions/Lorentz.py
index b43bfddd740b5e4ba60d7c7a486418166fa83bb4..1519d5a84a5ed47162d5c1cbaef1598b7c59cd19 100644
--- a/Framework/PythonInterface/plugins/functions/Lorentz.py
+++ b/Framework/PythonInterface/plugins/functions/Lorentz.py
@@ -23,10 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
 import math
 import numpy as np
+from mantid.api import IFunction1D, FunctionFactory
 
 class Lorentz(IFunction1D):
     """
diff --git a/Framework/PythonInterface/plugins/functions/Porod.py b/Framework/PythonInterface/plugins/functions/Porod.py
index 69c6729bd0dfd79104699683ae7c96cd7248f4ab..e92c0794d370de32d5ca01c15cfa6f5f3d2d5003 100644
--- a/Framework/PythonInterface/plugins/functions/Porod.py
+++ b/Framework/PythonInterface/plugins/functions/Porod.py
@@ -23,10 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
 import math
 import numpy as np
+from mantid.api import IFunction1D, FunctionFactory
 
 class Porod(IFunction1D):
     """
diff --git a/Framework/PythonInterface/plugins/functions/StretchedExpFT.py b/Framework/PythonInterface/plugins/functions/StretchedExpFT.py
index f5be59fa5b83d75443b154e401a596a78ea3e690..ebc606db8494f5440ae442cdae1532bb7069d92f 100644
--- a/Framework/PythonInterface/plugins/functions/StretchedExpFT.py
+++ b/Framework/PythonInterface/plugins/functions/StretchedExpFT.py
@@ -23,15 +23,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
-from mantid import logger
-from numpy import interp
-import numpy as np
 import copy
+import numpy as np
 import scipy.constants
 from scipy.fftpack import fft, fftfreq
 from scipy.special import gamma
+from mantid.api import IFunction1D, FunctionFactory
 
 class StretchedExpFT(IFunction1D):
     # Class variables
@@ -41,7 +38,7 @@ class StretchedExpFT(IFunction1D):
     def __init__(self):
         """declare some constants"""
         super(StretchedExpFT, self).__init__()
-        self._parmlist = list()
+        self._parmList = list()
 
     def category(self):
         return 'QuasiElastic'
@@ -64,7 +61,7 @@ class StretchedExpFT(IFunction1D):
         tau = self.getParameterValue('Tau')
         beta = self.getParameterValue('Beta')
         center = self.getParameterValue('Center')
-        for name, value in {'Height': height, 'Tau': tau, 'Beta': beta}.items():
+        for _, value in {'Height': height, 'Tau': tau, 'Beta': beta}.items():
             if value <= 0:
                 return None
         return {'Height': height, 'Tau': tau, 'Beta': beta, 'Center': center}
@@ -112,7 +109,7 @@ class StretchedExpFT(IFunction1D):
         # Find corresponding energies
         energies = StretchedExpFT._planck_constant * fftfreq(2*nt, d=dt)  # standard ordering
         energies = np.concatenate([energies[nt:], energies[:nt]])  # increasing ordering
-        transform = p['Height'] * interp(xvals-p['Center'], energies, fourier)
+        transform = p['Height'] * np.interp(xvals-p['Center'], energies, fourier)
         return transform
 
     def fillJacobian(self, xvals, jacobian, partials):
diff --git a/Framework/PythonInterface/plugins/functions/TeixeiraWater.py b/Framework/PythonInterface/plugins/functions/TeixeiraWater.py
index b49549b786ebde8d6ba94d000109fcf950ada22d..33650a6063c920a6145518414e763b86ae6bc8ac 100644
--- a/Framework/PythonInterface/plugins/functions/TeixeiraWater.py
+++ b/Framework/PythonInterface/plugins/functions/TeixeiraWater.py
@@ -23,9 +23,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 File change history is stored at: <https://github.com/mantidproject/mantid>
 Code Documentation is available at: <http://doxygen.mantidproject.org>
 '''
-
-from mantid.api import IFunction1D, FunctionFactory
 import numpy as np
+from mantid.api import IFunction1D, FunctionFactory
 
 class TeixeiraWater(IFunction1D):
 
diff --git a/scripts/DGSPlanner.py b/scripts/DGSPlanner.py
index b8d17cce5aea018f381439c058310c9c6a1c3a63..fbe780f4f8930a2d7ea7e0bc42c1afe9707a839f 100644
--- a/scripts/DGSPlanner.py
+++ b/scripts/DGSPlanner.py
@@ -1,7 +1,7 @@
 #pylint: disable=invalid-name,unused-import
-from DGSPlanner import DGSPlannerGUI
-from PyQt4 import QtGui
 import sys
+from PyQt4 import QtGui
+from DGSPlanner import DGSPlannerGUI
 
 def qapp():
     if QtGui.QApplication.instance():
diff --git a/scripts/HFIR_4Circle_Reduction/mplgraphicsview.py b/scripts/HFIR_4Circle_Reduction/mplgraphicsview.py
index b4a97dab88656c25f24a0cc39b118daa8f112534..3b2bebc6000080900eda722eb07f354fcd9c0410 100644
--- a/scripts/HFIR_4Circle_Reduction/mplgraphicsview.py
+++ b/scripts/HFIR_4Circle_Reduction/mplgraphicsview.py
@@ -5,7 +5,7 @@ import numpy as np
 from PyQt4 import QtGui
 
 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
-try: 
+try:
     from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar2
 except ImportError:
     from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar2
diff --git a/scripts/HFIR_4Circle_Reduction/reduce4circleControl.py b/scripts/HFIR_4Circle_Reduction/reduce4circleControl.py
index bb11355d3c1b09e8e5b011cd8b698d64614939aa..76de8f0380f214403797eb9edd9a4df3d363bfd4 100644
--- a/scripts/HFIR_4Circle_Reduction/reduce4circleControl.py
+++ b/scripts/HFIR_4Circle_Reduction/reduce4circleControl.py
@@ -439,14 +439,14 @@ class CWSCDReductionControl(object):
         """
         # Check spice file
         spice_file_name = '%s_exp%04d_scan%04d.dat'%(self._instrumentName,
-                                                   self._expNumber, scanno)
+                                                     self._expNumber, scanno)
         spice_file_name = os.path.join(self._dataDir, spice_file_name)
         if os.path.exists(spice_file_name) is False:
             return False, 'Spice data file %s cannot be found.'% spice_file_name
 
         # Check xml file
         xmlfilename = '%s_exp%d_scan%04d_%04d.xml'%(self._instrumentName, self._expNumber,
-                scanno, ptno)
+                                                    scanno, ptno)
         xmlfilename = os.path.join(self._dataDir, xmlfilename)
         if os.path.exists(xmlfilename) is False:
             return (False, "Pt. XML file %s cannot be found."%(xmlfilename))
diff --git a/scripts/Inelastic/Direct/PropertiesDescriptors.py b/scripts/Inelastic/Direct/PropertiesDescriptors.py
index 3e042b13847bc0379c879ffa4538c69181a79235..ddae08194f4421e3be363237ce699db61ebd3b43 100644
--- a/scripts/Inelastic/Direct/PropertiesDescriptors.py
+++ b/scripts/Inelastic/Direct/PropertiesDescriptors.py
@@ -28,7 +28,7 @@ class PropDescriptor(object):
     def dependencies(self):
         """Returns the list of other properties names, this property depends on"""
         return []
-#pylint: disable=unused-argument		
+#pylint: disable=unused-argument
     def validate(self,instance, owner):
         """Interface to validate property descriptor,
            provided to check properties interaction before long run
@@ -89,7 +89,7 @@ class AvrgAccuracy(PropDescriptor):
         else:
             return self._accuracy
     def __set__(self,instance,value):
-        """ Set up incident energy or range of energies in various formats 
+        """ Set up incident energy or range of energies in various formats
             or define autoEi"""
         val = int(value)
         if val < 1:
@@ -114,9 +114,9 @@ class AvrgAccuracy(PropDescriptor):
 
             def out(a,b):
                 if mult>1:
-                   return a<b
-                else: 
-                   return false
+                    return a<b
+                else:
+                    return false
             tv = abs(val)
             fin_mult  = 1
             while out(tv,lim):
@@ -160,7 +160,7 @@ class IncidentEnergy(PropDescriptor):
             return self._incident_energy
 #pylint: disable=too-many-branches
     def __set__(self,instance,value):
-        """ Set up incident energy or range of energies in various formats 
+        """ Set up incident energy or range of energies in various formats
             or define autoEi"""
         if value != None:
             if isinstance(value,str):
@@ -241,7 +241,7 @@ class IncidentEnergy(PropDescriptor):
             if self._incident_energy==0:
                 return []
             else:
-               return [self._incident_energy]
+                return [self._incident_energy]
     #
     def get_current(self):
         """ Return current energy out of range of energies"""
@@ -287,15 +287,15 @@ class IncidentEnergy(PropDescriptor):
         # Calculate autoEi
         self._autoEiCalculated = False
         if ei_mon_spec is None:
-            ei_mon_spec = instance.ei_mon_spectra;
+            ei_mon_spec = instance.ei_mon_spectra
         guess_ei_ws = GetAllEi(Workspace=monitor_ws,Monitor1SpecID = ei_mon_spec[0],\
                                Monitor2SpecID = ei_mon_spec[1])
-        guessEi  = guess_ei_ws.readX(0);
+        guessEi  = guess_ei_ws.readX(0)
         fin_ei = []
         for ei in guessEi:
             try:
-                ei_ref,t_peak,monIndex,tZero=GetEi(InputWorkspace=monitor_ws,\
-                                             Monitor1Spec=ei_mon_spec[0], Monitor2Spec=ei_mon_spec[1], EnergyEstimate=ei)
+                ei_ref,_,_,_=GetEi(InputWorkspace=monitor_ws,\
+                                   Monitor1Spec=ei_mon_spec[0], Monitor2Spec=ei_mon_spec[1], EnergyEstimate=ei)
                 fin_ei.append(ei_ref)
 #pylint: disable=broad-except
             except:
@@ -585,7 +585,7 @@ class mon2NormalizationEnergyRange(PropDescriptor):
         en_range = self._relative_range
         if len(en_range) != 2:
             return(False,2,'mon2_normalization_energy_range can be initialized by list of two values only.'
-                  ' Got {0} values'.format(len(range)))
+                   ' Got {0} values'.format(len(range)))
 
         result = (True,0,'')
 
@@ -1010,8 +1010,8 @@ class EiMonSpectra(prop_helpers.ComplexProperty):
         #end if
         if len(val) != 2:
             raise KeyError("ei_mon_spectra may be either tuple defining two spectra "\
-                "lists or string, which can be transformed to such lists. Got {0}"
-                .format(value))
+                           "lists or string, which can be transformed to such lists. Got {0}"
+                           .format(value))
 
         # Handle self-assignment. Otherwise suppose that the values are meaningful
         if val[0] == 'ei-mon1-spec':
@@ -1432,16 +1432,16 @@ class RotationAngle(PropDescriptor):
        property value. If set explicitly to some value,
        the value specified is used and stored in NXSPE files.
     """
-    def __init__(self,MotorLogNamesClass,MotorOffset):
-        self._mot_offset = MotorOffset
+    def __init__(self,MotorLogNamesClass,Motor_Offset):
+        self._mot_offset = Motor_Offset
         self._motor_log = MotorLogNamesClass
-       # user may override value derived
-       # from log, by providing its own value
-       # this value would be used instead of
-       # calculations
+        # user may override value derived
+        # from log, by providing its own value
+        # this value would be used instead of
+        # calculations
         self._own_psi_value = None
-       # user should define workspace, which contain rotation logs
-       # Motor log will be read from this workspace
+        # user should define workspace, which contain rotation logs
+        # Motor log will be read from this workspace
         self._log_ws_name = None
 
     #
diff --git a/scripts/Interface/reduction_gui/reduction/scripter.py b/scripts/Interface/reduction_gui/reduction/scripter.py
index 730ac2565df87a1d4ccd83f4eb24da4904b5ceb6..480057d8c3d70a826a8032e513167b4d04dcf7cd 100644
--- a/scripts/Interface/reduction_gui/reduction/scripter.py
+++ b/scripts/Interface/reduction_gui/reduction/scripter.py
@@ -592,7 +592,7 @@ class BaseReductionScripter(object):
         else:
             Logger("scripter").error("Mantid is unavailable to submit a reduction job")
 
-# Disable warning about the use of exec, which we knowingly use to 
+# Disable warning about the use of exec, which we knowingly use to
 # execute generated code.
 # pylint: disable=W0122
     def execute_script(self, script):
diff --git a/scripts/Interface/reduction_gui/widgets/sans/hfir_instrument.py b/scripts/Interface/reduction_gui/widgets/sans/hfir_instrument.py
index 6f5a187faf2dc1b24bfe2caf81a41d42cdc0b2d4..4890b2d8854d5e12f17320b7a4f1e8b7d7379b30 100644
--- a/scripts/Interface/reduction_gui/widgets/sans/hfir_instrument.py
+++ b/scripts/Interface/reduction_gui/widgets/sans/hfir_instrument.py
@@ -77,19 +77,19 @@ class SANSInstrumentWidget(BaseWidget):
             if not self._summary.sample_dist_chk.isChecked():
                 self._summary.sample_dist_edit.setText(str(value))
                 util._check_and_get_float_line_edit(self._summary.sample_dist_edit, min=0.0)
-        
+
         if key == "sample_detector_distance_offset":
             self._sample_detector_distance_offset = value
             if not self._summary.detector_offset_chk.isChecked():
                 self._summary.detector_offset_edit.setText(str(value))
                 util._check_and_get_float_line_edit(self._summary.detector_offset_edit, min=0.0)
-        
+
         if key == "sample_si_window_distance":
             self._sample_si_window_distance = value
             if not self._summary.sample_si_dist_chk.isChecked():
                 self._summary.sample_si_dist_edit.setText(str(value))
                 util._check_and_get_float_line_edit(self._summary.sample_si_dist_edit, min=0.0)
-        
+
         elif key == "wavelength":
             self._wavelength = value
             if not self._summary.wavelength_chk.isChecked():
@@ -183,7 +183,11 @@ class SANSInstrumentWidget(BaseWidget):
     def _mask_plot_clicked(self):
         ws_name = os.path.basename(str(self._summary.mask_edit.text()))
         self.mask_ws = "__mask_%s" % ws_name
-        self.show_instrument(self._summary.mask_edit.text, workspace=self.mask_ws, tab=2, reload=self.mask_reload, mask=self._masked_detectors)
+        self.show_instrument(self._summary.mask_edit.text,
+                             workspace=self.mask_ws,
+                             tab=2,
+                             reload=self.mask_reload,
+                             mask=self._masked_detectors)
         self._masked_detectors = []
         self.mask_reload = False
 
@@ -270,10 +274,10 @@ class SANSInstrumentWidget(BaseWidget):
 #             print '_sample_si_dist_clicked ->', not is_checked
 #             self._summary.sample_si_dist_chk.setChecked(not is_checked)
 #             self._summary.sample_si_dist_edit.setEnabled(not is_checked)
-        
+
     def _total_dist_clicked(self, is_checked):
         self._summary.total_detector_distance_edit.setEnabled(is_checked)
-# 
+#
 #         if is_checked:
 #             self._summary.total_detector_distance_chk.setChecked(not is_checked)
 #             self._summary.total_detector_distance_edit.setEnabled(not is_checked)
@@ -320,7 +324,7 @@ class SANSInstrumentWidget(BaseWidget):
             Populate the UI elements with the data from the given state.
             @param state: InstrumentDescription object
         """
-                
+
         self._summary.instr_name_label.setText(state.instrument_name)
         #npixels = "%d x %d" % (state.nx_pixels, state.ny_pixels)
         #self._summary.n_pixel_label.setText(QtCore.QString(npixels))
@@ -347,13 +351,13 @@ class SANSInstrumentWidget(BaseWidget):
 #                             state.detector_offset,
 #                             self._summary.detector_offset_chk,
 #                             self._summary.detector_offset_edit)
-# 
+#
 #         # Sample-detector distance
 #         self._prepare_field(state.sample_detector_distance != 0,
 #                             state.sample_detector_distance,
 #                             self._summary.sample_dist_chk,
 #                             self._summary.sample_dist_edit)
-#         
+#
         util._check_and_get_float_line_edit(self._summary.sample_dist_edit, min=0)
         util._check_and_get_float_line_edit(self._summary.sample_si_dist_edit, min=0)
         util._check_and_get_float_line_edit(self._summary.detector_offset_edit, min=0)
@@ -361,7 +365,7 @@ class SANSInstrumentWidget(BaseWidget):
 #         if self._sample_detector_distance is None:
 #             self._sample_detector_distance = state.sample_detector_distance
 #         self._sample_detector_distance_supplied = self._summary.sample_dist_chk.isChecked()
-# 
+#
 #         # Sample-detector distance takes precedence over offset if both are non-zero
 #         self._sample_dist_clicked(self._summary.sample_dist_chk.isChecked())
 
@@ -433,7 +437,7 @@ class SANSInstrumentWidget(BaseWidget):
         """
             Returns an object with the state of the interface
         """
-        
+
         m = ReductionOptions()
 
         m.instrument_name = self._summary.instr_name_label.text()
@@ -459,14 +463,14 @@ class SANSInstrumentWidget(BaseWidget):
 #             # Sample-Si-window
 #             if self._summary.sample_si_dist_chk.isChecked():
 #                 m.sample_si_window_distance = util._check_and_get_float_line_edit(self._summary.sample_si_dist_edit)
-        
+
         # Workaround:
         # Offset is not used
         # The detector_distanc will be used as sample_total_distance
         m.sample_detector_distance = util._check_and_get_float_line_edit(self._summary.total_detector_distance_edit)
         m.detector_offset = 0
-        
-        
+
+
         # Wavelength value
         wavelength = util._check_and_get_float_line_edit(self._summary.wavelength_edit, min=0.0)
         if self._summary.wavelength_chk.isChecked():
diff --git a/scripts/Interface/reduction_gui/widgets/sans/hfir_sample_data.py b/scripts/Interface/reduction_gui/widgets/sans/hfir_sample_data.py
index e3a4bf643c9cfacce1083f4ad608f9e5acf41ba0..48a3a701cd715154db1f6d92e4eb9ad2a9f57173 100644
--- a/scripts/Interface/reduction_gui/widgets/sans/hfir_sample_data.py
+++ b/scripts/Interface/reduction_gui/widgets/sans/hfir_sample_data.py
@@ -1,7 +1,7 @@
 #pylint: disable=invalid-name,protected-access
+import os
 from PyQt4 import QtGui, QtCore
 import reduction_gui.widgets.util as util
-import os
 from reduction_gui.reduction.sans.hfir_sample_script import SampleData
 from reduction_gui.widgets.base_widget import BaseWidget
 import ui.sans.ui_trans_direct_beam
@@ -394,16 +394,16 @@ class SampleDataWidget(BaseWidget):
         '''
         sdd = util._check_and_get_float_line_edit(self._content.sample_dist_edit, min=0.0)
         self._settings.emit_key_value("sample_detector_distance", str(sdd))
-        
+
         value  = util._check_and_get_float_line_edit(self._content.sample_dist_offset_edit, min=0.0)
         self._settings.emit_key_value("sample_detector_distance_offset", str(value))
 
         value  = util._check_and_get_float_line_edit(self._content.sample_si_window_dist_edit, min=0.0)
         self._settings.emit_key_value("sample_si_window_distance", str(value))
-        
+
         wavelength = util._check_and_get_float_line_edit(self._content.wavelength_edit, min=0.0)
         self._settings.emit_key_value("wavelength", str(wavelength))
-        
+
         spread = self._content.wavelength_spread_edit.text()
         self._settings.emit_key_value("wavelength_spread", spread)
 
@@ -412,7 +412,6 @@ class SampleDataWidget(BaseWidget):
         """
             Retrieve information from the data file and update the display
             See hfir_data_proxy.py for the attributes parsed from the data file
-            
         """
         if self._data_proxy is None:
             return
@@ -431,15 +430,15 @@ class SampleDataWidget(BaseWidget):
             if dataproxy.sample_detector_distance is not None:
                 self._content.sample_dist_edit.setText(str(dataproxy.sample_detector_distance))
                 util._check_and_get_float_line_edit(self._content.sample_dist_edit, min=0.0)
-            
+
             if dataproxy.sample_detector_distance_offset is not None:
                 self._content.sample_dist_offset_edit.setText(str(dataproxy.sample_detector_distance_offset))
                 util._check_and_get_float_line_edit(self._content.sample_dist_offset_edit, min=0.0)
-            
+
             if dataproxy.sample_si_window_distance is not None:
                 self._content.sample_si_window_dist_edit.setText(str(dataproxy.sample_si_window_distance))
-                util._check_and_get_float_line_edit(self._content.sample_si_window_dist_edit, min=0.0)            
-            
+                util._check_and_get_float_line_edit(self._content.sample_si_window_dist_edit, min=0.0)
+  
             if dataproxy.wavelength is not None:
                 self._content.wavelength_edit.setText(str(dataproxy.wavelength))
                 util._check_and_get_float_line_edit(self._content.wavelength_edit, min=0.0)