diff --git a/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py b/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py index 1263a445f903f1d298ec96d51925b3006352bdec..57037d6af2e581c29387657ce8674f746f5f1769 100644 --- a/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py @@ -1,7 +1,7 @@ +import os from mantid.api import * # PythonAlgorithm, registerAlgorithm, WorkspaceProperty from mantid.simpleapi import * from mantid.kernel import * -import os #pylint: disable=no-init, too-many-arguments class ApplyNegMuCorrection(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/BASISReduction.py b/Framework/PythonInterface/plugins/algorithms/BASISReduction.py index 68c6b8ca2fba69d86330b978cc66cd4551b62338..c354ca0759cc7161b3de20af6993c0b21451333f 100644 --- a/Framework/PythonInterface/plugins/algorithms/BASISReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/BASISReduction.py @@ -120,7 +120,6 @@ class BASISReduction(PythonAlgorithm): self._maskFile = self.getProperty("MaskFile").value self._groupDetOpt = self.getProperty("GroupDetectors").value self._normalizeToFirst = self.getProperty("NormalizeToFirst").value - self._normalizeToVanadium = self.getProperty("GroupDetectors").value self._doNorm = self.getProperty("DivideByVanadium").value datasearch = config["datasearch.searcharchive"] diff --git a/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py b/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py index 94046c3ab67e551620f483646c6d4de4e5801460..19017dea380143fcbe251e2c0cb652e2f9a1f148 100644 --- a/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py +++ b/Framework/PythonInterface/plugins/algorithms/ComputeIncoherentDOS.py @@ -1,9 +1,9 @@ #pylint: disable = no-init, invalid-name, line-too-long, eval-used, unused-argument, too-many-locals, too-many-branches, too-many-statements +import numpy as np +from scipy import constants from mantid.kernel import CompositeValidator, Direction, FloatBoundedValidator from mantid.api import mtd, AlgorithmFactory, CommonBinsValidator, HistogramValidator, MatrixWorkspaceProperty, PythonAlgorithm from mantid.simpleapi import * -import numpy as np -from scipy import constants def evaluateEbin(Emin, Emax, Ei, strn): return [eval(estr) for estr in strn.split(',')] @@ -71,7 +71,7 @@ class ComputeIncoherentDOS(PythonAlgorithm): QSumRange = self.getPropertyValue('QSumRange') EnergyBinning = self.getPropertyValue('EnergyBinning') cm = int(self.getPropertyValue('Wavenumbers')) - absunits = int(self.getPropertyValue('StatesPerEnergy')) + absunits = bool(self.getPropertyValue('StatesPerEnergy')) # Checks if the input workspace is valid, and which way around it is (Q along x or Q along y). u0 = inws.getAxis(0).getUnit().unitID() @@ -172,9 +172,9 @@ class ComputeIncoherentDOS(PythonAlgorithm): if cm: y = y/mev2cm e = e/mev2cm - yunit = 'DeltaE_inWavenumber' + #yunit = 'DeltaE_inWavenumber' else: - yunit = 'DeltaE' + #yunit = 'DeltaE' # Outputs the calculated density of states to another workspace dos2d = CloneWorkspace(inws) diff --git a/Framework/PythonInterface/plugins/algorithms/GetNegMuMuonicXRD.py b/Framework/PythonInterface/plugins/algorithms/GetNegMuMuonicXRD.py index 01588cb2b047b02d0234bfaca267de6abd11b8a0..d4d6d742ab9fcd6c8f8d52f8875f38926350a66e 100644 --- a/Framework/PythonInterface/plugins/algorithms/GetNegMuMuonicXRD.py +++ b/Framework/PythonInterface/plugins/algorithms/GetNegMuMuonicXRD.py @@ -8,26 +8,25 @@ class GetNegMuMuonicXRD(PythonAlgorithm): muonic_xr ={'Au' :[8135.2,8090.6,8105.4,8069.4,5764.89,5594.97,3360.2, 3206.8,2474.22,2341.21,2304.44,1436.05,1391.58,1104.9, 899.14,869.98,405.654,400.143], - 'Ag': [3184.7,3147.7,901.2,869.2,308.428,304.759], - 'Cu' :[1512.78,1506.61,334.8,330.26], - 'Zn' :[1600.15,1592.97,360.75,354.29], - 'Pb' :[8523.3,8442.11,5966.0,5780.1,2641.8,2499.7, - 2459.7,1511.63,1214.12,1028.83,972.3,938.4, - 437.687,431.285], - 'As' :[1866.9,1855.8,436.6,427.5], - 'Sn' :[3457.3,3412.8,1022.6,982.5,349.953,345.226]} + 'Ag': [3184.7,3147.7,901.2,869.2,308.428,304.759], + 'Cu' :[1512.78,1506.61,334.8,330.26], + 'Zn' :[1600.15,1592.97,360.75,354.29], + 'Pb' :[8523.3,8442.11,5966.0,5780.1,2641.8,2499.7, + 2459.7,1511.63,1214.12,1028.83,972.3,938.4, + 437.687,431.285], + 'As' :[1866.9,1855.8,436.6,427.5], + 'Sn' :[3457.3,3412.8,1022.6,982.5,349.953,345.226]} def PyInit(self): self.declareProperty(StringArrayProperty("Elements", values=[], - direction=Direction.Input - )) + direction=Direction.Input)) self.declareProperty(name="YAxisPosition", - defaultValue=-0.001, - doc="Position for Markers on the y-axis") + defaultValue=-0.001, + doc="Position for Markers on the y-axis") self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '', direction=Direction.Output), - doc='The output workspace will always be a GroupWorkspaces ' - 'that will have the workspaces of each' - ' muonicXR workspace created') + doc='The output workspace will always be a GroupWorkspaces ' + 'that will have the workspaces of each' + ' muonicXR workspace created') #We sort the lists of x-values from the dictionary here #so that mantid can plot the workspaces it produces. for key in self.muonic_xr: diff --git a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py index 2d73e52ceb60f6f049da81f75bbd3cfd04305a92..911dbeacb13788326e0734c3ab012375df6262e2 100644 --- a/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py @@ -1,6 +1,5 @@ #pylint: disable=invalid-name,no-init,too-many-lines import os -import numpy import mantid import mantid.api @@ -244,7 +243,7 @@ class SNSPowderReduction(DataProcessorAlgorithm): self._determineInstrument(samRuns[0]) preserveEvents = self.getProperty("PreserveEvents").value - if HAVE_MPI and preserveEvents == True: + if HAVE_MPI and preserveEvents: self.log().warning("preserveEvents set to False for MPI tasks.") preserveEvents = False self._info = None @@ -572,7 +571,7 @@ class SNSPowderReduction(DataProcessorAlgorithm): if donorLogfilename is not None and len(donorLogfilename) > 0: api.Load(Filename=donorLogfilename, MetaDataOnly=True, OutputWorkspace='temp_log_donor') api.CopyLogs(InputWorkspace='temp_log_donor', OutputWorkspace=wksp, - MergeStrategy='MergeKeepExisting') + MergeStrategy='MergeKeepExisting') api.DeleteWorkspace('temp_log_donor') wksp = mtd[str(wksp)] # convert back to a pointer print wksp @@ -1222,7 +1221,7 @@ class SNSPowderReduction(DataProcessorAlgorithm): return can_run_ws_name - def _process_vanadium_runs(self, van_run_number_list, timeFilterWall, samRunIndex, calib, **focuspos): + def _process_vanadium_runs(self, van_run_number_list, timeFilterWall, samRunIndex, calib, **dummy_focuspos): """ Purpose: process vanadium runs Requirements: if more than 1 run in given run number list, then samRunIndex must be given. @@ -1403,7 +1402,7 @@ class SNSPowderReduction(DataProcessorAlgorithm): # Splitting workspace self.log().information("SplitterWorkspace = %s, Information Workspace = %s. " % ( - split_ws_name, str(self._splitinfotablews))) + split_ws_name, str(self._splitinfotablews))) base_name = raw_ws_name if self._splitinfotablews is None: diff --git a/Framework/PythonInterface/plugins/algorithms/SaveNexusPD.py b/Framework/PythonInterface/plugins/algorithms/SaveNexusPD.py index 13232ff279bdf65080a09719622e24616a81edfc..7fe72e0817b4f1094d1b7c6686f49c1cce2b2a71 100644 --- a/Framework/PythonInterface/plugins/algorithms/SaveNexusPD.py +++ b/Framework/PythonInterface/plugins/algorithms/SaveNexusPD.py @@ -1,8 +1,8 @@ #pylint: disable=no-init,invalid-name +import numpy as np import mantid import mantid.simpleapi as api from mantid.kernel import StringListValidator -import numpy as np try: import h5py # http://www.h5py.org/ @@ -43,7 +43,7 @@ class SaveNexusPD(mantid.api.PythonAlgorithm): def _determineCompression(self): compression = self.getProperty('Compression').value - if not str(compression) == "None": + if str(compression) != "None": self._compressArgs['compression'] = compression def PyInit(self): @@ -125,6 +125,7 @@ class SaveNexusPD(mantid.api.PythonAlgorithm): dtype=self._dtype, **self._compressArgs) + #pylint: disable=too-many-arguments def _writeX(self, nxdata, name, wksp, index, writeDx): units = wksp.getAxis(0).getUnit().symbol().ascii() reverse = (name == 'Q') # reverse the array diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py index cbf87232fa86168b4b5dbcc23e48a40a0e37a102..10975948623a87549cb83478a64739894334d718 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py @@ -1,10 +1,9 @@ +import itertools + from mantid.kernel import * from mantid.api import * from mantid.simpleapi import * -import itertools - - #pylint: disable=too-few-public-methods class DRange(object): """ @@ -22,18 +21,18 @@ class DRange(object): TIME_REGIME_TO_DRANGE = { - 1.17e4: DRange( 0.7, 2.5), - 2.94e4: DRange( 2.1, 3.3), - 4.71e4: DRange( 3.1, 4.3), - 6.48e4: DRange( 4.1, 5.3), - 8.25e4: DRange( 5.2, 6.2), - 10.02e4: DRange( 6.2, 7.3), - 11.79e4: DRange( 7.3, 8.3), - 13.55e4: DRange( 8.3, 9.5), - 15.32e4: DRange( 9.4, 10.6), - 17.09e4: DRange(10.4, 11.6), - 18.86e4: DRange(11.0, 12.5), - 20.63e4: DRange(12.2, 13.8) + 1.17e4: DRange( 0.7, 2.5), + 2.94e4: DRange( 2.1, 3.3), + 4.71e4: DRange( 3.1, 4.3), + 6.48e4: DRange( 4.1, 5.3), + 8.25e4: DRange( 5.2, 6.2), + 10.02e4: DRange( 6.2, 7.3), + 11.79e4: DRange( 7.3, 8.3), + 13.55e4: DRange( 8.3, 9.5), + 15.32e4: DRange( 9.4, 10.6), + 17.09e4: DRange(10.4, 11.6), + 18.86e4: DRange(11.0, 12.5), + 20.63e4: DRange(12.2, 13.8) } class DRangeToWorkspaceMap(object): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py index e8cb3fc2cb2ee00affd85824aaf150c106f562e4..b349c4454a6cc21cb99f29477ee5e13013e27212 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py @@ -1,13 +1,13 @@ #pylint: disable=no-init,invalid-name,too-many-locals,too-many-lines -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * - import numpy as np import re import os.path import math +from mantid.kernel import * +from mantid.api import * +from mantid.simpleapi import * + PEAK_WIDTH_ENERGY_FLAG = 'energy' #pylint: disable=too-many-instance-attributes @@ -840,13 +840,13 @@ class SimulatedDensityOfStates(PythonAlgorithm): warray = np.repeat(weights, self._num_branches) file_data.update({ - 'frequencies': frequencies, - 'ir_intensities': ir_intensities, - 'raman_intensities': raman_intensities, - 'weights': warray, - 'q_vectors':q_vectors, - 'eigenvectors': eigenvectors - }) + 'frequencies': frequencies, + 'ir_intensities': ir_intensities, + 'raman_intensities': raman_intensities, + 'weights': warray, + 'q_vectors':q_vectors, + 'eigenvectors': eigenvectors + }) return file_data @@ -1006,12 +1006,12 @@ class SimulatedDensityOfStates(PythonAlgorithm): warray = np.repeat(weights, self._num_branches) file_data = { - 'frequencies': frequencies, - 'ir_intensities': ir_intensities, - 'raman_intensities': raman_intensities, - 'weights': warray, - 'q_vectors':q_vectors - } + 'frequencies': frequencies, + 'ir_intensities': ir_intensities, + 'raman_intensities': raman_intensities, + 'weights': warray, + 'q_vectors':q_vectors + } if len(bonds) > 0: file_data['bonds'] = bonds diff --git a/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py b/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py index b45fc1f9ee8b9b98480891195cc3d2bcfa18e147..a609ba43a092d3b4b6a760b74e65c24f45b7eb98 100644 --- a/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py +++ b/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py @@ -371,7 +371,7 @@ class Peak2ConvCell_Test(object): # (stresstesting.MantidStressTest): M = matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) M1 = matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) G = UB.T * UB - G.I + #G.I if G[0, 1] > 0: if G[0, 2] > 0: @@ -403,7 +403,7 @@ class Peak2ConvCell_Test(object): # (stresstesting.MantidStressTest): while done == 1: done = 0 X = UB.T * UB - X.I + #X.I print "B1", X if X[0, 0] > X[1, 1] or (math.fabs(X[0, 0] - X[1, 1]) < tolerance / 10 and math.fabs(X[1, 2]) > math.fabs( diff --git a/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py b/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py index 58daad2feee932d3a7ff289d5cb6666012fa9a40..481e0dac39c5b3f29c8c5241e59b447caf2f1099 100644 --- a/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py +++ b/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py @@ -79,8 +79,8 @@ class DirectInelaticSNSTest(stresstesting.MantidStressTest): # par file f = open(os.path.join(self.customDataDir,"group.par"),'w') print >>f,len(ang_list) - for i in ang_list: - print >>f,5.5,ang_list[i],0.0,1.0,1.0,1 + for angi in ang_list: + print >>f,5.5,angi,0.0,1.0,1.0,1 f.close() return [ang_list,detIDlist] diff --git a/tools/DOI/authors.py b/tools/DOI/authors.py index 4a0ec2489d8e99beb2800b1c3d08d3ddeb7d9111..044a88d66a4acb316fd390bcdc5261bb6c093682 100644 --- a/tools/DOI/authors.py +++ b/tools/DOI/authors.py @@ -2,6 +2,7 @@ from itertools import ifilterfalse import os import re +import subprocess # Authors in Git that do not have a translation listed here or that have not # been blacklisted will cause the DOI script to fail. @@ -12,7 +13,7 @@ import re # prefer multiple translations over blacklist entries in case users log back on # to machines and start using old aliases again. _translations = { -# Name in Git. : Preffered name for DOI. + #Name in Git. : Preffered name for DOI. 'Freddie Akeroyd' : 'Akeroyd, Freddie', 'Stuart Ansell' : 'Ansell, Stuart', 'Sofia Antony' : 'Antony, Sofia', @@ -158,8 +159,6 @@ whitelist = [ 'Granroth, Garrett' ] -import subprocess - def run_from_script_dir(func): '''Decorator that changes the working directory to the directory of this script for the duration of the decorated function. Basically it means we