From 3c3ac21aa5ad183c9b1d6ca9a173de033c4c74c3 Mon Sep 17 00:00:00 2001 From: Applin Date: Tue, 15 Oct 2024 13:49:20 +0100 Subject: [PATCH 1/5] Allow wild imports in __init__.py files --- Framework/PythonInterface/mantid/__init__.py | 1 + Framework/PythonInterface/mantid/api/__init__.py | 1 + Framework/PythonInterface/mantid/geometry/__init__.py | 1 + Framework/PythonInterface/mantid/kernel/__init__.py | 1 + .../PythonInterface/mantid/py36compat/_dataclasses/__init__.py | 1 + Framework/PythonInterface/mantid/simpleapi.py | 1 + Framework/PythonInterface/mantid/utils/__init__.py | 1 + 7 files changed, 7 insertions(+) diff --git a/Framework/PythonInterface/mantid/__init__.py b/Framework/PythonInterface/mantid/__init__.py index 3c5f1dc3b107..615bfff53c03 100644 --- a/Framework/PythonInterface/mantid/__init__.py +++ b/Framework/PythonInterface/mantid/__init__.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """ Mantid ====== diff --git a/Framework/PythonInterface/mantid/api/__init__.py b/Framework/PythonInterface/mantid/api/__init__.py index 32b170acf6b9..036f49bd2f2c 100644 --- a/Framework/PythonInterface/mantid/api/__init__.py +++ b/Framework/PythonInterface/mantid/api/__init__.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """ api === diff --git a/Framework/PythonInterface/mantid/geometry/__init__.py b/Framework/PythonInterface/mantid/geometry/__init__.py index feb047a8efcd..e3ddc9cd27ac 100644 --- a/Framework/PythonInterface/mantid/geometry/__init__.py +++ b/Framework/PythonInterface/mantid/geometry/__init__.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """ mantid.geometry =============== diff --git a/Framework/PythonInterface/mantid/kernel/__init__.py b/Framework/PythonInterface/mantid/kernel/__init__.py index dc2c13664189..b836d827a124 100644 --- a/Framework/PythonInterface/mantid/kernel/__init__.py +++ b/Framework/PythonInterface/mantid/kernel/__init__.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """ kernel ============= diff --git a/Framework/PythonInterface/mantid/py36compat/_dataclasses/__init__.py b/Framework/PythonInterface/mantid/py36compat/_dataclasses/__init__.py index 5743bce3eb6c..fab76ab63412 100644 --- a/Framework/PythonInterface/mantid/py36compat/_dataclasses/__init__.py +++ b/Framework/PythonInterface/mantid/py36compat/_dataclasses/__init__.py @@ -1 +1,2 @@ +# ruff: noqa: F403 # Allow wild imports from .dataclasses import * diff --git a/Framework/PythonInterface/mantid/simpleapi.py b/Framework/PythonInterface/mantid/simpleapi.py index c9ae96b3216e..9a4907bddc73 100644 --- a/Framework/PythonInterface/mantid/simpleapi.py +++ b/Framework/PythonInterface/mantid/simpleapi.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """ This module defines a function-style API for running Mantid algorithms. Each algorithm within Mantid is mapped to a Python diff --git a/Framework/PythonInterface/mantid/utils/__init__.py b/Framework/PythonInterface/mantid/utils/__init__.py index 1f8a8061be76..8ffa14ca9adc 100644 --- a/Framework/PythonInterface/mantid/utils/__init__.py +++ b/Framework/PythonInterface/mantid/utils/__init__.py @@ -4,4 +4,5 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports from ._utils import * From df09afe2562a98fc7600006972bcd4b710e17463 Mon Sep 17 00:00:00 2001 From: Applin Date: Tue, 15 Oct 2024 14:27:21 +0100 Subject: [PATCH 2/5] Fix wild imports in algorithms --- .../algorithms/NMoldyn4Interpolation.py | 6 +- .../plugins/algorithms/NormaliseSpectra.py | 6 +- .../OptimizeCrystalPlacementByRun.py | 19 ++++-- .../plugins/algorithms/PDToGUDRUN.py | 18 ++++-- .../plugins/algorithms/PearlMCAbsorption.py | 8 +-- .../algorithms/PoldiCreatePeaksFromFile.py | 1 + .../plugins/algorithms/PoldiLoadRuns.py | 16 ++++- .../plugins/algorithms/PoldiMerge.py | 6 +- .../plugins/algorithms/RebinRagged.py | 4 +- .../algorithms/RefinePowderDiffProfileSeq.py | 64 +++++++++++-------- .../ReflectometryReductionOneLiveData.py | 6 +- .../ReflectometrySliceEventWorkspace.py | 6 +- .../plugins/algorithms/ResNorm.py | 2 +- .../plugins/algorithms/RetrieveRunInfo.py | 14 +++- .../plugins/algorithms/SANSSubtract.py | 2 +- .../algorithms/SANSWideAngleCorrection.py | 4 +- .../algorithms/SaveGEMMAUDParamFile.py | 4 +- .../plugins/algorithms/SavePlot1DAsJson.py | 4 +- .../algorithms/SelectNexusFilesByMetadata.py | 5 +- .../plugins/algorithms/SortByQVectors.py | 3 +- .../algorithms/TestWorkspaceGroupProperty.py | 4 +- .../plugins/algorithms/USANSSimulation.py | 6 +- .../algorithms/VelocityAutoCorrelations.py | 6 +- .../algorithms/VelocityCrossCorrelations.py | 6 +- .../plugins/algorithms/VesuvioAnalysis.py | 32 ++++++++-- .../plugins/algorithms/VesuvioCorrections.py | 21 +++++- .../algorithms/VesuvioPeakPrediction.py | 5 +- .../plugins/algorithms/VesuvioPreFit.py | 4 +- .../plugins/algorithms/VesuvioResolution.py | 4 +- .../plugins/algorithms/VesuvioTOFFit.py | 12 +++- .../plugins/algorithms/ViewBOA.py | 5 +- .../plugins/algorithms/VisionReduction.py | 29 +++++++-- 32 files changed, 219 insertions(+), 113 deletions(-) diff --git a/Framework/PythonInterface/plugins/algorithms/NMoldyn4Interpolation.py b/Framework/PythonInterface/plugins/algorithms/NMoldyn4Interpolation.py index e9b471ae172b..14657c581ffc 100644 --- a/Framework/PythonInterface/plugins/algorithms/NMoldyn4Interpolation.py +++ b/Framework/PythonInterface/plugins/algorithms/NMoldyn4Interpolation.py @@ -10,9 +10,9 @@ import numpy as np import scipy as sc -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import Direction, FloatMandatoryValidator +from mantid.simpleapi import CreateWorkspace class NMoldyn4Interpolation(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py b/Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py index f5a41fdd70dd..341a2c488900 100644 --- a/Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py +++ b/Framework/PythonInterface/plugins/algorithms/NormaliseSpectra.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * -from mantid.api import MatrixWorkspaceProperty, DataProcessorAlgorithm, AlgorithmFactory -from mantid.simpleapi import * +from mantid.api import mtd, MatrixWorkspaceProperty, DataProcessorAlgorithm, AlgorithmFactory +from mantid.kernel import Direction +from mantid.simpleapi import CloneWorkspace, DeleteWorkspace, ExtractSpectra, Scale import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py b/Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py index 86a62ec7d197..ee163bf0c850 100644 --- a/Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py +++ b/Framework/PythonInterface/plugins/algorithms/OptimizeCrystalPlacementByRun.py @@ -5,13 +5,18 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init - -from mantid.api import PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty -from mantid.kernel import Direction -from mantid.simpleapi import * -from mantid import mtd - -# Create an empty table workspace to be populated by a python script. +from mantid.api import mtd, AnalysisDataService, PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty +from mantid.kernel import logger, Direction +from mantid.simpleapi import ( + CombinePeaksWorkspaces, + FilterPeaks, + FindUBUsingIndexedPeaks, + GroupWorkspaces, + IndexPeaks, + OptimizeCrystalPlacement, + StatisticsOfTableWorkspace, + RenameWorkspace, +) class OptimizeCrystalPlacementByRun(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/PDToGUDRUN.py b/Framework/PythonInterface/plugins/algorithms/PDToGUDRUN.py index f411c83a6146..812849a1ec9c 100644 --- a/Framework/PythonInterface/plugins/algorithms/PDToGUDRUN.py +++ b/Framework/PythonInterface/plugins/algorithms/PDToGUDRUN.py @@ -5,10 +5,18 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import Direction, FloatArrayProperty, StringListValidator -import mantid +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, FileProperty, PropertyMode, MatrixWorkspaceProperty +from mantid.kernel import ConfigService, Direction, FloatArrayProperty, StringListValidator +from mantid.simpleapi import ( + AlignAndFocusPowder, + LoadDetectorsGroupingFile, + LoadEventAndCompress, + NormaliseByCurrent, + PDDetermineCharacterizations, + PDLoadCharacterizations, + SaveNexusPD, + SetUncertainties, +) COMPRESS_TOL_TOF = 0.01 EVENT_WORKSPACE_ID = "EventWorkspace" @@ -161,7 +169,7 @@ def PyExec(self): groupingFile = self.getProperty("GroupingFile").value if len(groupingFile) > 0: instrumentName = wksp.getInstrument().getName() - instrumentName = mantid.ConfigService.getInstrument(instrumentName).shortName() + instrumentName = ConfigService.getInstrument(instrumentName).shortName() LoadDetectorsGroupingFile(InputFile=groupingFile, OutputWorkspace=instrumentName + "_group") wksp = AlignAndFocusPowder( diff --git a/Framework/PythonInterface/plugins/algorithms/PearlMCAbsorption.py b/Framework/PythonInterface/plugins/algorithms/PearlMCAbsorption.py index 373c14169ce5..0d871b47fcca 100644 --- a/Framework/PythonInterface/plugins/algorithms/PearlMCAbsorption.py +++ b/Framework/PythonInterface/plugins/algorithms/PearlMCAbsorption.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * -from mantid.api import * -import mantid.simpleapi +from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, MatrixWorkspaceProperty +from mantid.kernel import Direction +from mantid.simpleapi import LoadAscii import math @@ -39,7 +39,7 @@ def PyExec(self): wkspace_name = self.getPropertyValue("OutputWorkspace") # Load the file - ascii_wkspace = mantid.simpleapi.LoadAscii(Filename=filename, OutputWorkspace=wkspace_name, Separator="Space", Unit=x_unit) + ascii_wkspace = LoadAscii(Filename=filename, OutputWorkspace=wkspace_name, Separator="Space", Unit=x_unit) if thickness is None: coeffs = ascii_wkspace else: diff --git a/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py b/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py index b46de95e0880..9879eddfd6ca 100644 --- a/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py +++ b/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py @@ -5,6 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-few-public-methods,unused-import +# ruff: noqa: F403 # Allow wild imports from mantid.kernel import * from mantid.simpleapi import * from mantid.api import * diff --git a/Framework/PythonInterface/plugins/algorithms/PoldiLoadRuns.py b/Framework/PythonInterface/plugins/algorithms/PoldiLoadRuns.py index afdf6547579d..d7040cbeabfc 100644 --- a/Framework/PythonInterface/plugins/algorithms/PoldiLoadRuns.py +++ b/Framework/PythonInterface/plugins/algorithms/PoldiLoadRuns.py @@ -5,9 +5,19 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,bare-except -from mantid.kernel import * -from mantid.simpleapi import * -from mantid.api import * +from mantid.api import AnalysisDataService, AlgorithmFactory, PythonAlgorithm, WorkspaceGroup, WorkspaceProperty +from mantid.kernel import CompositeValidator, Direction, IntBoundedValidator, IntMandatoryValidator +from mantid.simpleapi import ( + DeleteWorkspace, + GroupWorkspaces, + Integration, + MaskDetectors, + MedianDetectorTest, + PoldiMerge, + PoldiTruncateData, + LoadInstrument, + LoadSINQ, +) from datetime import date diff --git a/Framework/PythonInterface/plugins/algorithms/PoldiMerge.py b/Framework/PythonInterface/plugins/algorithms/PoldiMerge.py index 27cebb0d7432..a4212907ba97 100644 --- a/Framework/PythonInterface/plugins/algorithms/PoldiMerge.py +++ b/Framework/PythonInterface/plugins/algorithms/PoldiMerge.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.kernel import StringArrayProperty, Direction -from mantid.simpleapi import * -from mantid.api import * +from mantid.api import AlgorithmFactory, AnalysisDataService, MatrixWorkspace, PythonAlgorithm, WorkspaceGroup, WorkspaceProperty +from mantid.kernel import Direction, StringArrayProperty +from mantid.simpleapi import MergeRuns import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/RebinRagged.py b/Framework/PythonInterface/plugins/algorithms/RebinRagged.py index 845be7cd7eca..1ed1b857de22 100644 --- a/Framework/PythonInterface/plugins/algorithms/RebinRagged.py +++ b/Framework/PythonInterface/plugins/algorithms/RebinRagged.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.api import * +from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, MatrixWorkspace, MatrixWorkspaceProperty +from mantid.kernel import Direction, FloatArrayProperty, Property from mantid.simpleapi import ConjoinWorkspaces, Rebin, DeleteWorkspace, ExtractSpectra -from mantid.kernel import * import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/RefinePowderDiffProfileSeq.py b/Framework/PythonInterface/plugins/algorithms/RefinePowderDiffProfileSeq.py index 2f66b6ada677..9042bed7e282 100644 --- a/Framework/PythonInterface/plugins/algorithms/RefinePowderDiffProfileSeq.py +++ b/Framework/PythonInterface/plugins/algorithms/RefinePowderDiffProfileSeq.py @@ -4,17 +4,29 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -# pylint: disable=no-init,invalid-name -from mantid.api import * -import mantid.simpleapi as api -from mantid.kernel import * +# pylint: disable=no-init,invalid-name,too-many-instance-attributes +from mantid.api import ( + mtd, + AlgorithmFactory, + AnalysisDataService, + FileAction, + FileProperty, + ITableWorkspaceProperty, + PythonAlgorithm, + PropertyMode, + MatrixWorkspaceProperty, +) +from mantid.kernel import Direction, StringArrayProperty, StringListValidator +from mantid.simpleapi import ( + CreateEmptyTableWorkspace, + GroupWorkspaces, + LeBailFit, + LoadNexusProcessed, + SaveNexusProcessed, + UpdatePeakParameterTableValue, +) -# from Calibration_ImportInformation import * - - -# -------------------------------------------------------------------------------- -# pylint: disable=too-many-instance-attributes class RefinePowderDiffProfileSeq(PythonAlgorithm): """Refine powder diffractometer profile by Le Bail algorithm sequentially""" @@ -327,7 +339,7 @@ def initSetup(self, dataws, wsindex, peaktype, profilews, braggpeakws, bkgdtype, self._recordPostRefineInfo(runner) # Group the newly generated workspace and do some record - api.GroupWorkspaces( + GroupWorkspaces( InputWorkspaces="%s, %s, %s, %s" % (outwsname, self._profileWS, self._braggpeakws, self._bkgdparws), OutputWorkspace=self._wsgroupName, ) @@ -347,7 +359,7 @@ def initSetup(self, dataws, wsindex, peaktype, profilews, braggpeakws, bkgdtype, def loadProject(self, projectfilename): """Load the project from a saved project file""" # Load workspace group - api.LoadNexusProcessed(Filename=projectfilename, OutputWorkspace=self._wsgroupName) + LoadNexusProcessed(Filename=projectfilename, OutputWorkspace=self._wsgroupName) self._wsgroup = AnalysisDataService.retrieve(self._wsgroupName) if self._wsgroup.__class__.__name__ != "WorkspaceGroup": @@ -418,18 +430,18 @@ def refine(self, dataws, wsindex, parametersToFit, numcycles, startx, endx, last # Group newly generated workspaces and add name to reposiotry if self._wsgroupCreated is True: - api.GroupWorkspaces( + GroupWorkspaces( InputWorkspaces="%s, %s, %s" % (outwsname, outprofilewsname, outbraggpeakwsname), OutputWorkspace=self._wsgroupName ) else: wsgroup = AnalysisDataService.retrieve(self._wsgroupName) hasbkgd = list(wsgroup.getNames()).count(bkgdparamwsname) if hasbkgd == 1: - api.GroupWorkspaces( + GroupWorkspaces( InputWorkspaces="%s, %s, %s" % (outwsname, outprofilewsname, outbraggpeakwsname), OutputWorkspace=self._wsgroupName ) elif hasbkgd == 0: - api.GroupWorkspaces( + GroupWorkspaces( InputWorkspaces="%s, %s, %s, %s" % (outwsname, outprofilewsname, outbraggpeakwsname, bkgdparamwsname), OutputWorkspace=self._wsgroupName, ) @@ -461,20 +473,20 @@ def saveProject(self, datawsname, wsindex, projectfname): except OSError: shutil.rmtree(projectfname) - api.SaveNexusProcessed(InputWorkspace=self._wsgroupName, Filename=projectfname, Append=False) + SaveNexusProcessed(InputWorkspace=self._wsgroupName, Filename=projectfname, Append=False) # Add data workspace, tracking record table to workspaces # api.GroupWorkspaces(InputWorkspaces="%s, %s, %s" % (datawsname, self._recordwsname, self._wsgroupName), # OutputWorkspace=self._wsgroupName) self.glog.notice("Append record workspace %s" % (self._recordwsname)) - api.SaveNexusProcessed(InputWorkspace=self._recordwsname, Filename=projectfname, Append=True) + SaveNexusProcessed(InputWorkspace=self._recordwsname, Filename=projectfname, Append=True) self.glog.notice("Append data workspace %s" % (datawsname)) - api.SaveNexusProcessed(InputWorkspace=datawsname, Filename=projectfname, Append=True) + SaveNexusProcessed(InputWorkspace=datawsname, Filename=projectfname, Append=True) # Create a new README table workspace for some other information readmewsname = "READ_%s" % (self._ID) - readmews = api.CreateEmptyTableWorkspace(OutputWorkspace=readmewsname) + readmews = CreateEmptyTableWorkspace(OutputWorkspace=readmewsname) readmews.addColumn("str", "Function") readmews.addColumn("str", "Type") @@ -485,13 +497,13 @@ def saveProject(self, datawsname, wsindex, projectfname): readmews.addRow(["Data", str(datawsname)]) readmews.addRow(["Spectrum", str(wsindex)]) - api.SaveNexusProcessed(InputWorkspace=readmewsname, Filename=projectfname, Append=True) + SaveNexusProcessed(InputWorkspace=readmewsname, Filename=projectfname, Append=True) return def _genRecordTable(self): """Generate record table""" - tablews = api.CreateEmptyTableWorkspace(OutputWorkspace=self._recordwsname) + tablews = CreateEmptyTableWorkspace(OutputWorkspace=self._recordwsname) tablews.addColumn("int", "Step") tablews.addColumn("str", "OutProfile") @@ -660,7 +672,7 @@ def _genOutputWorkspace(self, datawsname, profilewsname, braggpeakwsname): def generateMCSetupTableProf9(wsname): """Generate a Le Bail fit Monte Carlo random walk setup table""" - tablews = api.CreateEmptyTableWorkspace(OutputWorkspace=str(wsname)) + tablews = CreateEmptyTableWorkspace(OutputWorkspace=str(wsname)) tablews.addColumn("str", "Name") tablews.addColumn("double", "A0") @@ -697,7 +709,7 @@ def generateMCSetupTableProf9(wsname): def generateMCSetupTableProf10(wsname): """Generate a Le Bail fit Monte Carlo random walk setup table""" - tablews = api.CreateEmptyTableWorkspace(OutputWorkspace=str(wsname)) + tablews = CreateEmptyTableWorkspace(OutputWorkspace=str(wsname)) tablews.addColumn("str", "Name") tablews.addColumn("double", "A0") @@ -850,7 +862,7 @@ def calculate(self, startx, endx): self.glog.information("**** Fit range: %f, %f" % (startx, endx)) self.glog.information("**** Profile workspace = %s, Reflection workspace = %s" % (self.inprofilewsname, self.inreflectionwsname)) - api.LeBailFit( + LeBailFit( Function="Calculation", InputWorkspace=self.datawsname, OutputWorkspace=self.outwsname, @@ -885,8 +897,8 @@ def refine(self, numsteps, parameternames, startx, endx): # UpdatePeakParameterTableValue(). It is not a real new table workspace, but a link # to the 'inprofilewsname' # There must be something wrong in AnalysisDataService. - api.UpdatePeakParameterTableValue(InputWorkspace=self.inprofilewsname, Column="FitOrTie", NewStringValue="tie") - api.UpdatePeakParameterTableValue( + UpdatePeakParameterTableValue(InputWorkspace=self.inprofilewsname, Column="FitOrTie", NewStringValue="tie") + UpdatePeakParameterTableValue( InputWorkspace=self.inprofilewsname, Column="FitOrTie", ParameterNames=parameternames, NewStringValue="fit" ) @@ -910,7 +922,7 @@ def refine(self, numsteps, parameternames, startx, endx): else: raise NotImplementedError("Peak type %s is not supported to set up MC table." % (self.peaktype)) - api.LeBailFit( + LeBailFit( InputWorkspace=self.datawsname, OutputWorkspace=self.outwsname, InputParameterWorkspace=self.inprofilewsname, diff --git a/Framework/PythonInterface/plugins/algorithms/ReflectometryReductionOneLiveData.py b/Framework/PythonInterface/plugins/algorithms/ReflectometryReductionOneLiveData.py index 7007d5aed855..f63b44ec2371 100644 --- a/Framework/PythonInterface/plugins/algorithms/ReflectometryReductionOneLiveData.py +++ b/Framework/PythonInterface/plugins/algorithms/ReflectometryReductionOneLiveData.py @@ -4,9 +4,9 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, AnalysisDataService, DataProcessorAlgorithm, MatrixWorkspaceProperty, WorkspaceGroup +from mantid.kernel import config, Direction, Property, StringListValidator +from mantid.simpleapi import AddSampleLogMultiple, CloneWorkspace, LoadInstrument, SetInstrumentParameter class LiveValue: diff --git a/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py b/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py index c62f05828e67..5c15ba28298b 100644 --- a/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py +++ b/Framework/PythonInterface/plugins/algorithms/ReflectometrySliceEventWorkspace.py @@ -4,9 +4,9 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import * -from mantid.kernel import * -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, MatrixWorkspaceProperty, WorkspaceGroupProperty +from mantid.kernel import DateAndTime, Direction +from mantid.simpleapi import AddSampleLog class ReflectometrySliceEventWorkspace(DataProcessorAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/ResNorm.py b/Framework/PythonInterface/plugins/algorithms/ResNorm.py index c3346134beb7..ebbdfee8d324 100644 --- a/Framework/PythonInterface/plugins/algorithms/ResNorm.py +++ b/Framework/PythonInterface/plugins/algorithms/ResNorm.py @@ -7,7 +7,7 @@ # pylint: disable=no-init from mantid.api import PythonAlgorithm, AlgorithmFactory from mantid.kernel import StringListValidator, StringMandatoryValidator -from mantid.simpleapi import * +from mantid.simpleapi import LoadNexusProcessed from mantid import config, logger import os diff --git a/Framework/PythonInterface/plugins/algorithms/RetrieveRunInfo.py b/Framework/PythonInterface/plugins/algorithms/RetrieveRunInfo.py index 3c6d903965f0..4c16292c5604 100644 --- a/Framework/PythonInterface/plugins/algorithms/RetrieveRunInfo.py +++ b/Framework/PythonInterface/plugins/algorithms/RetrieveRunInfo.py @@ -5,10 +5,18 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,no-init -from mantid.api import PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty -from mantid.simpleapi import * +from mantid.api import mtd, PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty +from mantid.simpleapi import ( + CloneWorkspace, + CreateEmptyTableWorkspace, + CreateLogPropertyTable, + DeleteWorkspace, + Load, + LoadRaw, + RenameWorkspace, +) from mantid.kernel import StringMandatoryValidator, Direction -from mantid import config +from mantid import config, FileFinder import os from itertools import filterfalse diff --git a/Framework/PythonInterface/plugins/algorithms/SANSSubtract.py b/Framework/PythonInterface/plugins/algorithms/SANSSubtract.py index 245c4ada1bec..40fda45a15c5 100644 --- a/Framework/PythonInterface/plugins/algorithms/SANSSubtract.py +++ b/Framework/PythonInterface/plugins/algorithms/SANSSubtract.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.api import * +from mantid.api import AlgorithmFactory, AnalysisDataService, FileAction, FileProperty, MatrixWorkspaceProperty, PythonAlgorithm from mantid.kernel import Direction, FloatBoundedValidator import mantid.simpleapi import os diff --git a/Framework/PythonInterface/plugins/algorithms/SANSWideAngleCorrection.py b/Framework/PythonInterface/plugins/algorithms/SANSWideAngleCorrection.py index 424bf0574b8c..88148a0ab0af 100644 --- a/Framework/PythonInterface/plugins/algorithms/SANSWideAngleCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/SANSWideAngleCorrection.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm, Progress, WorkspaceFactory +from mantid.kernel import Direction import sys import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py b/Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py index 13e13504e143..9e660ce97df4 100644 --- a/Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py +++ b/Framework/PythonInterface/plugins/algorithms/SaveGEMMAUDParamFile.py @@ -10,8 +10,8 @@ from collections import defaultdict from string import Formatter -from mantid.api import * -from mantid.kernel import * +from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceGroupProperty +from mantid.kernel import logger, Direction, IntArrayProperty import isis_powder.gem_routines _MAUD_TEMPLATE_PATH = None diff --git a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py index 7e0dd7702f84..0e02d508e9cd 100644 --- a/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py +++ b/Framework/PythonInterface/plugins/algorithms/SavePlot1DAsJson.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,unused-variable,invalid-name,bare-except -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, AnalysisDataService, FileAction, FileProperty, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction # See ticket #10234 diff --git a/Framework/PythonInterface/plugins/algorithms/SelectNexusFilesByMetadata.py b/Framework/PythonInterface/plugins/algorithms/SelectNexusFilesByMetadata.py index fcfe278aa7ea..f07ddea15ddb 100644 --- a/Framework/PythonInterface/plugins/algorithms/SelectNexusFilesByMetadata.py +++ b/Framework/PythonInterface/plugins/algorithms/SelectNexusFilesByMetadata.py @@ -5,9 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=eval-used -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, MultipleFileProperty, PythonAlgorithm +from mantid.kernel import Direction class SelectNexusFilesByMetadata(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/SortByQVectors.py b/Framework/PythonInterface/plugins/algorithms/SortByQVectors.py index db7f6a68b3cd..f41b4d145e95 100644 --- a/Framework/PythonInterface/plugins/algorithms/SortByQVectors.py +++ b/Framework/PythonInterface/plugins/algorithms/SortByQVectors.py @@ -5,8 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.api import * -from mantid.kernel import * +from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, WorkspaceGroup import mantid.simpleapi as ms import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/TestWorkspaceGroupProperty.py b/Framework/PythonInterface/plugins/algorithms/TestWorkspaceGroupProperty.py index 99551b7c93a8..305eb9401d0b 100644 --- a/Framework/PythonInterface/plugins/algorithms/TestWorkspaceGroupProperty.py +++ b/Framework/PythonInterface/plugins/algorithms/TestWorkspaceGroupProperty.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm, WorkspaceGroupProperty +from mantid.kernel import logger, Direction class TestWorkspaceGroupProperty(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/USANSSimulation.py b/Framework/PythonInterface/plugins/algorithms/USANSSimulation.py index 1116b0c07685..516533397ef7 100644 --- a/Framework/PythonInterface/plugins/algorithms/USANSSimulation.py +++ b/Framework/PythonInterface/plugins/algorithms/USANSSimulation.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction, FloatArrayProperty, Logger +from mantid.simpleapi import CreateSimulationWorkspace, CreateWorkspace import math import numpy diff --git a/Framework/PythonInterface/plugins/algorithms/VelocityAutoCorrelations.py b/Framework/PythonInterface/plugins/algorithms/VelocityAutoCorrelations.py index 7911c1a3a281..661134c761ab 100644 --- a/Framework/PythonInterface/plugins/algorithms/VelocityAutoCorrelations.py +++ b/Framework/PythonInterface/plugins/algorithms/VelocityAutoCorrelations.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=too-many-branches,too-many-locals, invalid-name -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction +from mantid.simpleapi import CreateWorkspace from scipy.io import netcdf import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/VelocityCrossCorrelations.py b/Framework/PythonInterface/plugins/algorithms/VelocityCrossCorrelations.py index 9ce0299aa771..cc994064c0a9 100644 --- a/Framework/PythonInterface/plugins/algorithms/VelocityCrossCorrelations.py +++ b/Framework/PythonInterface/plugins/algorithms/VelocityCrossCorrelations.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=too-many-branches,too-many-locals, invalid-name -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction +from mantid.simpleapi import CreateWorkspace from scipy.io import netcdf import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py b/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py index 01f4ea3a576a..25188faa8535 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py @@ -24,11 +24,35 @@ from __future__ import absolute_import, division, print_function, unicode_literals -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import ( + mtd, + AlgorithmFactory, + FileAction, + FileProperty, + ITableWorkspaceProperty, + PropertyMode, + PythonAlgorithm, +) +from mantid.dataobjects import TableWorkspace +from mantid.kernel import logger, FloatArrayProperty, IntArrayProperty +from mantid.simpleapi import CloneWorkspace, Fit, LoadVesuvio, MaskDetectors, Minus, Rebin, RenameWorkspace, Scale, SumSpectra from mantid.kernel import StringListValidator, IntListValidator, FloatBoundedValidator, Direction -from Inelastic.vesuvio.analysisHelpers import * +from Inelastic.vesuvio.analysisHelpers import ( + block_fit_ncp, + final_fit, + calculate_mantid_resolutions, + calculate_mean_widths_and_intensities, + calculate_sample_properties, + cleanNames, + convert_to_y_space_and_symmetrise, + correct_for_gamma_background, + correct_for_multiple_scattering, + create_slab_geometry, + generate_elements, + generate_constraints, + prepare_fit_arguments, + subtract_other_masses, +) ################################################################################################ diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioCorrections.py b/Framework/PythonInterface/plugins/algorithms/VesuvioCorrections.py index 939da680889c..71d8851df55f 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioCorrections.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioCorrections.py @@ -5,8 +5,25 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init, too-many-instance-attributes -from mantid.kernel import * -from mantid.api import * +from mantid.api import ( + AlgorithmFactory, + AlgorithmManager, + ITableWorkspaceProperty, + MatrixWorkspaceProperty, + PropertyMode, + WorkspaceGroupProperty, +) +from mantid.kernel import ( + logger, + Direction, + FloatArrayLengthValidator, + FloatArrayProperty, + MaterialBuilder, + PropertyCriterion, + PropertyManagerProperty, + StringMandatoryValidator, + VisibleWhenProperty, +) from vesuvio.base import VesuvioBase, TableWorkspaceDictionaryFacade from vesuvio.fitting import parse_fit_options from vesuvio.instrument import VESUVIO diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py b/Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py index bfa27c0a3b20..b0d9ea021ca9 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioPeakPrediction.py @@ -4,10 +4,9 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, ITableWorkspaceProperty, WorkspaceFactory +from mantid.kernel import Direction, FloatArrayBoundedValidator, FloatArrayProperty, FloatBoundedValidator, StringListValidator from vesuvio.base import VesuvioBase -from mantid.simpleapi import * import scipy.constants import math diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioPreFit.py b/Framework/PythonInterface/plugins/algorithms/VesuvioPreFit.py index ce6993564b87..c667bfaef422 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioPreFit.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioPreFit.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty +from mantid.kernel import Direction, StringListValidator import numpy as np from vesuvio.base import VesuvioBase diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioResolution.py b/Framework/PythonInterface/plugins/algorithms/VesuvioResolution.py index 1d40420c500a..188777b517d5 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioResolution.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioResolution.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspace, MatrixWorkspaceProperty, PropertyMode, WorkspaceProperty +from mantid.kernel import Direction from vesuvio.base import VesuvioBase diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioTOFFit.py b/Framework/PythonInterface/plugins/algorithms/VesuvioTOFFit.py index 749ea7ca8e82..21b7bb9fa970 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioTOFFit.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioTOFFit.py @@ -5,8 +5,16 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, ITableWorkspaceProperty, MatrixWorkspaceProperty +from mantid.kernel import ( + logger, + Direction, + FloatArrayLengthValidator, + FloatArrayProperty, + IntBoundedValidator, + StringListValidator, + StringMandatoryValidator, +) from vesuvio.base import VesuvioBase, TableWorkspaceDictionaryFacade from vesuvio.fitting import parse_fit_options diff --git a/Framework/PythonInterface/plugins/algorithms/ViewBOA.py b/Framework/PythonInterface/plugins/algorithms/ViewBOA.py index 2c045a1d5fd6..1296f0a7ab58 100644 --- a/Framework/PythonInterface/plugins/algorithms/ViewBOA.py +++ b/Framework/PythonInterface/plugins/algorithms/ViewBOA.py @@ -5,10 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.api import AlgorithmFactory -from mantid.api import PythonAlgorithm +from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm from mantid.kernel import Direction -from mantid.simpleapi import * +from mantid.simpleapi import DeleteWorkspace, GroupDetectors, InvertMDDim, LoadSINQ, MDHistoToWorkspace2D, ProjectMD import datetime diff --git a/Framework/PythonInterface/plugins/algorithms/VisionReduction.py b/Framework/PythonInterface/plugins/algorithms/VisionReduction.py index 8dc19f9e905d..d64bcf1bf69d 100644 --- a/Framework/PythonInterface/plugins/algorithms/VisionReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/VisionReduction.py @@ -5,12 +5,29 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -# from mantid.api import AlgorithmFactory -# from mantid.simpleapi import PythonAlgorithm, WorkspaceProperty -# from mantid.kernel import Direction -from mantid.api import * -from mantid.kernel import * -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction +from mantid.simpleapi import ( + AppendSpectra, + ConvertUnits, + CorrectKiKf, + CropWorkspace, + DeleteWorkspace, + Divide, + GroupDetectors, + InterpolatingRebin, + LoadEventNexus, + LoadInstrument, + LoadNexusProcessed, + MaskDetectors, + NormaliseByCurrent, + Plus, + Rebin, + RemoveLogs, + RemoveWorkspaceHistory, + Scale, + ScaleX, +) import csv import os from string import ascii_letters, digits # pylint: disable=deprecated-module From 75caca2e225a51c2edf69965662d711de6be2553 Mon Sep 17 00:00:00 2001 From: Applin Date: Tue, 15 Oct 2024 16:21:28 +0100 Subject: [PATCH 3/5] Remove wild imports from workflow algorithms --- .../AddSampleLogMultiple.py | 5 +- .../WorkflowAlgorithms/BayesQuasi.py | 14 +++- .../D7AbsoluteCrossSections.py | 25 +++++- .../D7YIGPositionCalibration.py | 29 ++++++- .../DirectILLAutoProcess.py | 38 ++++++++- .../EQSANSAzimuthalAverage1D.py | 4 +- .../EQSANSDirectBeamTransmission.py | 13 ++- .../WorkflowAlgorithms/EQSANSNormalise.py | 12 ++- .../ElasticWindowMultiple.py | 18 ++-- .../WorkflowAlgorithms/EnergyWindowScan.py | 27 +++--- .../FlatPlatePaalmanPingsCorrection.py | 3 +- .../WorkflowAlgorithms/HFIRSANSReduction.py | 4 +- .../ISISIndirectDiffractionReduction.py | 51 +++++++----- .../ISISIndirectEnergyTransfer.py | 72 ++++++++++++---- .../IndirectAnnulusAbsorption.py | 18 +++- .../WorkflowAlgorithms/IndirectCalibration.py | 28 +++++-- .../IndirectCylinderAbsorption.py | 18 +++- .../WorkflowAlgorithms/IndirectDiffScan.py | 9 +- .../IndirectFlatPlateAbsorption.py | 16 +++- .../IndirectILLEnergyTransfer.py | 30 ++++++- .../IndirectILLReductionDIFF.py | 19 ++++- .../IndirectILLReductionFWS.py | 23 ++++- .../IndirectILLReductionQENS.py | 18 +++- .../WorkflowAlgorithms/IndirectResolution.py | 10 +-- .../IndirectTransmissionMonitor.py | 19 ++++- .../WorkflowAlgorithms/IqtFitMultiple.py | 24 ++++-- .../LagrangeILLReduction.py | 25 +++++- .../algorithms/WorkflowAlgorithms/MSDFit.py | 17 +++- .../algorithms/WorkflowAlgorithms/MolDyn.py | 17 +++- .../NormaliseByThickness.py | 8 +- .../OSIRISDiffractionReduction.py | 12 +-- .../WorkflowAlgorithms/PolDiffILLReduction.py | 43 +++++++++- .../WorkflowAlgorithms/PoldiDataAnalysis.py | 25 ++++-- .../PowderILLDetectorScan.py | 24 +++++- .../WorkflowAlgorithms/PowderILLEfficiency.py | 48 ++++++++++- .../PowderILLParameterScan.py | 22 ++++- .../ReactorSANSResolution.py | 4 +- .../algorithms/WorkflowAlgorithms/ResNorm2.py | 19 +++-- .../WorkflowAlgorithms/SANSAbsoluteScale.py | 4 +- .../SANSAzimuthalAverage1D.py | 14 +++- .../SANSBeamSpreaderTransmission.py | 13 ++- .../SANSDarkRunBackgroundCorrection.py | 5 +- .../SANSDirectBeamTransmission.py | 12 ++- .../WorkflowAlgorithms/SANSFitShiftScale.py | 10 ++- .../WorkflowAlgorithms/SANSILLAutoProcess.py | 20 ++++- .../WorkflowAlgorithms/SANSILLIntegration.py | 18 +++- .../WorkflowAlgorithms/SANSILLMultiProcess.py | 25 +++++- .../SANSILLParameterScan.py | 16 +++- .../WorkflowAlgorithms/SANSILLReduction.py | 55 +++++++++++- .../WorkflowAlgorithms/SANSILLReduction2.py | 83 ++++++++++++++++--- .../algorithms/WorkflowAlgorithms/SANSMask.py | 4 +- .../SANSPatchSensitivity.py | 4 +- .../WorkflowAlgorithms/SANSReduction.py | 4 +- .../WorkflowAlgorithms/SANSStitch.py | 4 +- .../SimpleShapeDiscusInelastic.py | 3 +- .../SimulatedDensityOfStates.py | 4 +- .../WorkflowAlgorithms/SofQWMoments.py | 6 +- .../WorkflowAlgorithms/SofQWMomentsScan.py | 22 ++++- .../WorkflowAlgorithms/SwapWidths.py | 4 +- .../WorkflowAlgorithms/TOSCABankCorrection.py | 15 +++- .../WorkflowAlgorithms/TimeSlice.py | 23 +++-- .../WorkflowAlgorithms/TransformToIqt.py | 15 +--- .../WorkflowAlgorithms/TransmissionUtils.py | 4 +- .../WorkflowAlgorithms/USANSReduction.py | 8 +- .../VesuvioDiffractionReduction.py | 48 ++++++----- 65 files changed, 990 insertions(+), 264 deletions(-) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/AddSampleLogMultiple.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/AddSampleLogMultiple.py index 0a22126ad40a..ca445595bd67 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/AddSampleLogMultiple.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/AddSampleLogMultiple.py @@ -5,9 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, AlgorithmManager, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import Direction, StringArrayProperty class AddSampleLogMultiple(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py index bf3fc8b25195..37d5820913eb 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/BayesQuasi.py @@ -7,6 +7,7 @@ # pylint: disable=invalid-name,too-many-instance-attributes,too-many-branches,no-init,redefined-builtin import os +import math import numpy as np from typing import Tuple @@ -22,7 +23,18 @@ from mantid.kernel import StringListValidator, Direction import mantid.simpleapi as s_api from mantid import config, logger -from IndirectCommon import * +from IndirectCommon import ( + check_analysers_or_e_fixed, + check_dimensions_equal, + check_hist_zero, + check_x_range, + extract_float, + extract_int, + get_efixed, + get_two_theta_and_q, + identify_non_zero_bin_range, + pad_array, +) def _calculate_eisf( diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py index cc34b7871ce8..a507fd45db34 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7AbsoluteCrossSections.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import AlgorithmFactory, NumericAxis, PropertyMode, Progress, PythonAlgorithm, WorkspaceGroupProperty, WorkspaceGroup +from mantid.api import mtd, AlgorithmFactory, NumericAxis, PropertyMode, Progress, PythonAlgorithm, WorkspaceGroupProperty, WorkspaceGroup from mantid.kernel import ( Direction, EnabledWhenProperty, @@ -16,8 +16,27 @@ RebinParamsValidator, StringListValidator, ) - -from mantid.simpleapi import * +from mantid.simpleapi import ( + AppendSpectra, + ConvertAxisByFormula, + ConvertSpectrumAxis, + CloneWorkspace, + CreateSingleValuedWorkspace, + CreateWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + GroupWorkspaces, + Minus, + Multiply, + RenameWorkspace, + ReplaceSpecialValues, + SofQWNormalisedPolygon, + SumOverlappingTubes, + Transpose, + UnGroupWorkspace, + WeightedMean, +) from scipy.constants import physical_constants import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py index 5d8cd4042fc4..4c80e2f89ef0 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/D7YIGPositionCalibration.py @@ -5,9 +5,34 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.simpleapi import * -from mantid.kernel import Direction, FloatBoundedValidator, StringListValidator +from mantid.simpleapi import ( + ChangeBinOffset, + ConjoinWorkspaces, + ConjoinXRuns, + ConvertAxisByFormula, + ConvertToPointData, + ClearInstrumentParameters, + CloneWorkspace, + CreateSingleValuedWorkspace, + CreateWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + Fit, + EvaluateFunction, + ExtractSpectra, + GroupWorkspaces, + LoadAndMerge, + LoadParameterFile, + MaskBinsIf, + RemoveSpectra, + RenameWorkspace, + ReplaceSpecialValues, +) +from mantid.kernel import config, ConfigService, Direction, FloatBoundedValidator, StringListValidator from mantid.api import ( + mtd, + AlgorithmFactory, FileAction, FileProperty, MatrixWorkspaceProperty, diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLAutoProcess.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLAutoProcess.py index 369e939f16da..aa413882429b 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLAutoProcess.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLAutoProcess.py @@ -7,6 +7,7 @@ import DirectILL_common as common from mantid.api import ( + mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, @@ -26,7 +27,42 @@ RebinParamsValidator, StringListValidator, ) -from mantid.simpleapi import * +from mantid.simpleapi import ( + ApplyPaalmanPingsCorrection, + ConvertUnits, + CorrectKiKf, + CreateSingleValuedWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + DetectorEfficiencyCorUser, + DirectILLCollectData, + DirectILLDiagnostics, + DirectILLReduction, + DirectILLIntegrateVanadium, + Divide, + GroupDetectors, + GroupWorkspaces, + Load, + LoadEmptyInstrument, + LoadMask, + LoadNexus, + MaskAngle, + MaskBinsIf, + MaskBTP, + MaskDetectors, + MergeRuns, + Minus, + PaalmanPingsAbsorptionCorrection, + PaalmanPingsMonteCarloAbsorption, + Rebin, + RebinToWorkspace, + RenameWorkspace, + SaveMask, + SaveNexus, + SaveNXSPE, + Scale, + SetSample, +) from os import path diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py index 0b3f2520a1f4..12d212049a7d 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSAzimuthalAverage1D.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import math -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, AlgorithmManager, AnalysisDataService, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction, IntBoundedValidator, Logger, PropertyManagerDataService, StringMandatoryValidator class EQSANSAzimuthalAverage1D(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py index 94dbfbeae5d2..796bc0a301aa 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSDirectBeamTransmission.py @@ -6,8 +6,17 @@ # SPDX - License - Identifier: GPL - 3.0 + # Pylint: disable=no-init,invalid-name import os -from mantid.api import * -from mantid.kernel import * +from mantid.api import ( + AlgorithmFactory, + AlgorithmManager, + AnalysisDataService, + FileAction, + FileProperty, + MatrixWorkspaceProperty, + PropertyMode, + PythonAlgorithm, +) +from mantid.kernel import Direction, Logger, PropertyManagerDataService, StringMandatoryValidator class EQSANSDirectBeamTransmission(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py index 9fbffe8f7cfe..87b61714bea8 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EQSANSNormalise.py @@ -6,8 +6,16 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import os -from mantid.api import * -from mantid.kernel import * +from mantid.api import ( + AlgorithmFactory, + AlgorithmManager, + AnalysisDataService, + FileAction, + FileProperty, + MatrixWorkspaceProperty, + PythonAlgorithm, +) +from mantid.kernel import Direction, Logger, StringMandatoryValidator from reduction_workflow.find_data import find_file diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py index 2cafd8ec7184..2c49e00e1555 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py @@ -4,9 +4,19 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +from mantid import FileFinder +from mantid.api import ( + AlgorithmFactory, + DataProcessorAlgorithm, + NumericAxis, + Progress, + PropertyMode, + WorkspaceGroupProperty, + WorkspaceProperty, +) +from mantid.kernel import config, logger, Direction, Property, StringListValidator from mantid.simpleapi import AppendSpectra, CloneWorkspace, ElasticWindow, LoadLog, Logarithm, SortXAxis, Transpose -from mantid.kernel import * -from mantid.api import * +from IndirectCommon import get_instrument_and_run import numpy as np @@ -130,8 +140,6 @@ def _setup(self): self._background_range_end = self.getProperty("BackgroundRangeEnd").value def PyExec(self): - from IndirectCommon import get_instrument_and_run - # Do setup self._setup() @@ -251,8 +259,6 @@ def _get_sample_units(self, workspace): @param workspace The workspace @returns sample in given units or None if not found """ - from IndirectCommon import get_instrument_and_run - instr, run_number = get_instrument_and_run(workspace.name()) pad_num = config.getInstrument(instr).zeroPadding(int(run_number)) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EnergyWindowScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EnergyWindowScan.py index f470e9ca72f8..ded8478c236c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EnergyWindowScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/EnergyWindowScan.py @@ -4,20 +4,22 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import * -from mantid.kernel import * +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, FileProperty, Progress, PropertyMode, WorkspaceProperty +from mantid.kernel import ( + logger, + Direction, + FloatArrayProperty, + IntArrayMandatoryValidator, + IntArrayProperty, + Property, + StringArrayProperty, + StringListValidator, +) from mantid import config import os -def _str_or_none(s): - if s != "": - return s - else: - return None - - def _ws_or_none(s): if s != "": return mtd[s] @@ -25,13 +27,6 @@ def _ws_or_none(s): return None -def _elems_or_none(l): - if len(l) != 0: - return l - else: - return None - - class EnergyWindowScan(DataProcessorAlgorithm): _data_files = None _sum_files = None diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py index 387cf3ab114e..b414755ba409 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/FlatPlatePaalmanPingsCorrection.py @@ -9,8 +9,9 @@ import math import numpy as np -from mantid.simpleapi import * +from mantid.simpleapi import AddSampleLog, CreateWorkspace, DeleteWorkspace, ExtractSingleSpectrum, GroupWorkspaces, SplineInterpolation from mantid.api import ( + mtd, PythonAlgorithm, AlgorithmFactory, PropertyMode, diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py index 522e3f8d6dd1..94e1a9140852 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/HFIRSANSReduction.py @@ -7,8 +7,8 @@ # 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 mantid.api import Algorithm, AlgorithmFactory, AlgorithmManager, AnalysisDataService, PythonAlgorithm +from mantid.kernel import Direction, Logger, PropertyManagerDataService, StringMandatoryValidator from reduction_workflow.find_data import find_data diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py index 4a8817218484..8a27d5becf28 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectDiffractionReduction.py @@ -7,11 +7,38 @@ # pylint: disable=no-init,too-many-instance-attributes import os -from IndirectReductionCommon import calibrate, load_files, load_file_ranges, rebin_logarithmic - -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * +from IndirectReductionCommon import ( + calibrate, + fold_chopped, + get_multi_frame_rebin, + group_spectra, + load_files, + load_file_ranges, + identify_bad_detectors, + mask_detectors, + process_monitor_efficiency, + scale_monitor, + scale_detectors, + rebin_logarithmic, + rebin_reduction, + rename_reduction, + unwrap_monitor, +) + +from mantid.api import ( + mtd, + AlgorithmFactory, + AnalysisDataService, + DataProcessorAlgorithm, + FileAction, + FileProperty, + PropertyMode, + WorkspaceGroup, + WorkspaceGroupProperty, + WorkspaceProperty, +) +from mantid.kernel import logger, Direction, IntArrayProperty, IntBoundedValidator, StringArrayProperty, StringListValidator +from mantid.simpleapi import ConvertUnits, DeleteWorkspace, Divide, GroupWorkspaces, Minus, RebinToWorkspace, ReplaceSpecialValues, Scale from mantid import config @@ -233,20 +260,6 @@ def validateInputs(self): # ------------------------------------------------------------------------------ def PyExec(self): - from IndirectReductionCommon import ( - get_multi_frame_rebin, - identify_bad_detectors, - unwrap_monitor, - process_monitor_efficiency, - scale_monitor, - scale_detectors, - rebin_reduction, - group_spectra, - fold_chopped, - rename_reduction, - mask_detectors, - ) - self._setup() load_opts = dict() diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectEnergyTransfer.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectEnergyTransfer.py index 4c0fe57253aa..e409d9ea0999 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectEnergyTransfer.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ISISIndirectEnergyTransfer.py @@ -5,11 +5,62 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,too-many-instance-attributes,too-many-branches,no-init,deprecated-module -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import ( + mtd, + AlgorithmFactory, + AnalysisDataService, + DataProcessorAlgorithm, + FileAction, + FileProperty, + Progress, + PropertyMode, + WorkspaceGroup, + WorkspaceGroupProperty, + WorkspaceProperty, +) +from mantid.kernel import ( + logger, + Direction, + FloatArrayProperty, + FloatBoundedValidator, + IntArrayMandatoryValidator, + IntArrayProperty, + IntBoundedValidator, + Property, + StringArrayProperty, + StringListValidator, +) +from mantid.simpleapi import ( + CorrectKiKf, + ConvertUnits, + DeleteWorkspace, + Divide, + ExponentialCorrection, + GroupWorkspaces, + Scale, + SetInstrumentParameter, + CalculateFlatBackground, + ConvertFromDistribution, + ConvertToDistribution, + CropWorkspace, +) from mantid import config +from IndirectReductionCommon import ( + load_files, + get_multi_frame_rebin, + get_detectors_to_mask, + unwrap_monitor, + process_monitor_efficiency, + scale_monitor, + scale_detectors, + rebin_reduction, + group_spectra, + fold_chopped, + rename_reduction, + mask_detectors, +) + import os @@ -164,21 +215,6 @@ def PyInit(self): # pylint: disable=too-many-locals def PyExec(self): - from IndirectReductionCommon import ( - load_files, - get_multi_frame_rebin, - get_detectors_to_mask, - unwrap_monitor, - process_monitor_efficiency, - scale_monitor, - scale_detectors, - rebin_reduction, - group_spectra, - fold_chopped, - rename_reduction, - mask_detectors, - ) - self._setup() load_prog = Progress(self, start=0.0, end=0.10, nreports=2) load_prog.report("loading files") diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption.py index 2927da40e1ee..5ef2384bc094 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption.py @@ -6,7 +6,6 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init, too-many-instance-attributes -from mantid.simpleapi import * from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode, Progress, WorkspaceGroupProperty from mantid.kernel import ( StringMandatoryValidator, @@ -17,6 +16,21 @@ StringListValidator, MaterialBuilder, ) +from mantid.simpleapi import ( + AddSampleLogMultiple, + AnnularRingAbsorption, + CloneWorkspace, + ConvertUnits, + DeleteWorkspace, + Divide, + GroupWorkspaces, + Minus, + Multiply, + Scale, + SetSampleMaterial, +) + +from IndirectCommon import get_efixed class IndirectAnnulusAbsorption(DataProcessorAlgorithm): @@ -102,8 +116,6 @@ def PyInit(self): # pylint: disable=too-many-branches def PyExec(self): - from IndirectCommon import get_efixed - self._setup() # Set up progress reporting diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCalibration.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCalibration.py index 19e64447db84..212f083267fa 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCalibration.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCalibration.py @@ -5,10 +5,28 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,too-many-instance-attributes -from mantid.kernel import * -from mantid.simpleapi import * -from mantid.api import * - +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, Progress, WorkspaceProperty +from mantid.kernel import ( + logger, + Direction, + FloatArrayMandatoryValidator, + FloatArrayProperty, + IntArrayMandatoryValidator, + IntArrayProperty, + StringArrayProperty, +) +from mantid.simpleapi import ( + CalculateFlatBackground, + DeleteWorkspace, + FindDetectorsOutsideLimits, + Integration, + Load, + MergeRuns, + Scale, + SumSpectra, +) + +from IndirectCommon import get_run_number import os.path @@ -87,8 +105,6 @@ def _validate_range(self, property_name): return None def PyExec(self): - from IndirectCommon import get_run_number - self._setup() runs = [] self._run_numbers = [] diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCylinderAbsorption.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCylinderAbsorption.py index 2a821216924a..326355108fb5 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCylinderAbsorption.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectCylinderAbsorption.py @@ -5,8 +5,6 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init, too-many-instance-attributes - -from mantid.simpleapi import * from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceGroupProperty, PropertyMode, Progress from mantid.kernel import ( StringMandatoryValidator, @@ -17,6 +15,20 @@ MaterialBuilder, StringListValidator, ) +from mantid.simpleapi import ( + AddSampleLogMultiple, + AnnularRingAbsorption, + ConvertUnits, + CylinderAbsorption, + DeleteWorkspace, + Divide, + GroupWorkspaces, + Minus, + Scale, + SetSampleMaterial, +) + +from IndirectCommon import get_efixed class IndirectCylinderAbsorption(DataProcessorAlgorithm): @@ -97,8 +109,6 @@ def PyInit(self): # pylint: disable=too-many-branches def PyExec(self): - from IndirectCommon import get_efixed - self._setup() # Set up progress reporting diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectDiffScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectDiffScan.py index 1f4074d01c55..4bfa16d66a2f 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectDiffScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectDiffScan.py @@ -4,9 +4,12 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +import re + +from mantid import FileFinder +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, NumericAxis, Progress +from mantid.kernel import logger, IntArrayBoundedValidator, IntArrayProperty, StringArrayProperty, StringListValidator +from mantid.simpleapi import LoadLog from mantid import config from IndirectCommon import format_runs diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption.py index 8f825e9a2da2..1899f593c97c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption.py @@ -5,9 +5,21 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,too-many-instance-attributes,too-many-branches -from mantid.simpleapi import * from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode, Progress, WorkspaceGroupProperty from mantid.kernel import StringMandatoryValidator, Direction, logger, FloatBoundedValidator, MaterialBuilder, StringListValidator +from mantid.simpleapi import ( + AddSampleLogMultiple, + ConvertUnits, + DeleteWorkspace, + Divide, + FlatPlateAbsorption, + GroupWorkspaces, + Minus, + Scale, + SetSampleMaterial, +) + +from IndirectCommon import get_efixed class IndirectFlatPlateAbsorption(DataProcessorAlgorithm): @@ -93,8 +105,6 @@ def PyInit(self): ) def PyExec(self): - from IndirectCommon import get_efixed - self._setup() # Set up progress reporting diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLEnergyTransfer.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLEnergyTransfer.py index ceb521fe82d1..90b6e4d5f0bc 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLEnergyTransfer.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLEnergyTransfer.py @@ -18,6 +18,7 @@ IntBoundedValidator, ) from mantid.api import ( + AlgorithmFactory, PythonAlgorithm, MultipleFileProperty, FileProperty, @@ -27,7 +28,34 @@ WorkspaceProperty, PropertyMode, ) -from mantid.simpleapi import * +from mantid.simpleapi import ( + AddSampleLog, + AddSampleLogMultiple, + ConvertAxisByFormula, + ConvertSpectrumAxis, + ConvertUnits, + CropWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + ExtractMonitors, + ExtractSingleSpectrum, + ExtractSpectra, + FindEPP, + GroupDetectors, + GroupWorkspaces, + Integration, + LoadAndMerge, + LoadParameterFile, + MaskBins, + MoveInstrumentComponent, + Plus, + RebinToWorkspace, + RenameWorkspace, + ReplaceSpecialValues, + Scale, + ScaleX, +) N_TUBES = 16 N_PIXELS_PER_TUBE = 128 diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionDIFF.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionDIFF.py index d61c81b4c663..a078179b5370 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionDIFF.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionDIFF.py @@ -4,9 +4,24 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import PythonAlgorithm, MatrixWorkspaceProperty, MultipleFileProperty, Progress +from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, MatrixWorkspaceProperty, MultipleFileProperty, Progress from mantid.kernel import Direction, IntBoundedValidator -from mantid.simpleapi import * +from mantid.simpleapi import ( + ConjoinXRuns, + ConvertSpectrumAxis, + ConvertToPointData, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + ExtractMonitors, + ExtractUnmaskedSpectra, + Integration, + LoadAndMerge, + MaskDetectors, + RenameWorkspace, + Scale, + Transpose, +) class IndirectILLReductionDIFF(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionFWS.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionFWS.py index 9ca088b6ebb0..dc7c9c560370 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionFWS.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionFWS.py @@ -5,11 +5,30 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import numpy as np +import os import time from mantid import mtd from mantid.kernel import StringListValidator, Direction, FloatBoundedValidator -from mantid.api import PythonAlgorithm, MultipleFileProperty, FileProperty, FileAction, WorkspaceGroupProperty, Progress -from mantid.simpleapi import * +from mantid.api import AlgorithmFactory, PythonAlgorithm, MultipleFileProperty, FileProperty, FileAction, WorkspaceGroupProperty, Progress +from mantid.simpleapi import ( + AddSampleLog, + AddSampleLogMultiple, + ConjoinXRuns, + ConvertToPointData, + DeleteWorkspace, + Divide, + GroupWorkspaces, + IndirectILLEnergyTransfer, + Integration, + Minus, + Plus, + Rebin, + RenameWorkspace, + Scale, + SelectNexusFilesByMetadata, + SortXAxis, + SplineInterpolation, +) class IndirectILLReductionFWS(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionQENS.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionQENS.py index e0d9fd7ddbf9..05adcb297bf6 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionQENS.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectILLReductionQENS.py @@ -8,8 +8,22 @@ import numpy from mantid import mtd from mantid.kernel import StringListValidator, Direction, FloatBoundedValidator, FloatArrayMandatoryValidator, IntBoundedValidator -from mantid.api import PythonAlgorithm, MultipleFileProperty, FileProperty, FileAction, WorkspaceGroupProperty, Progress -from mantid.simpleapi import * +from mantid.api import AlgorithmFactory, PythonAlgorithm, MultipleFileProperty, FileProperty, FileAction, WorkspaceGroupProperty, Progress +from mantid.simpleapi import ( + CloneWorkspace, + DeleteWorkspace, + Divide, + GroupWorkspaces, + IndirectILLEnergyTransfer, + Integration, + MaskBins, + MatchPeaks, + Minus, + Plus, + RenameWorkspace, + Scale, + SelectNexusFilesByMetadata, +) class IndirectILLReductionQENS(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py index 85c36b3cf506..facc8deb49f1 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectResolution.py @@ -4,12 +4,10 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -# pylint: disable=no-init -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * - -# pylint: disable=too-many-instance-attributes +# pylint: disable=no-init,too-many-instance-attributes +from mantid.api import AlgorithmFactory, DataProcessorAlgorithm, Progress, WorkspaceProperty +from mantid.kernel import Direction, FloatArrayProperty, IntArrayProperty, StringArrayProperty, StringListValidator +from mantid.simpleapi import CalculateFlatBackground, Rebin, Scale class IndirectResolution(DataProcessorAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py index ee3fa2d0ef41..1a8cf5290e99 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py @@ -5,10 +5,21 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * -from mantid import logger +from mantid.api import mtd, AlgorithmFactory, Progress, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction +from mantid.simpleapi import ( + AddSampleLog, + ConvertUnits, + CropWorkspace, + DeleteWorkspace, + Divide, + FFTSmooth, + GroupWorkspaces, + RebinToWorkspace, + RemoveBins, + RenameWorkspace, + UnwrapMonitor, +) import numpy diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py index 85860147b63e..ec87cb10ca27 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IqtFitMultiple.py @@ -4,10 +4,20 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid import logger, AlgorithmFactory -from mantid.api import * -from mantid.kernel import * -import mantid.simpleapi as ms +from mantid.api import ( + mtd, + AlgorithmFactory, + FunctionProperty, + ITableWorkspaceProperty, + MatrixWorkspaceProperty, + Progress, + PythonAlgorithm, + WorkspaceGroupProperty, +) +from mantid.kernel import logger, Direction, FloatBoundedValidator, IntBoundedValidator +from mantid.simpleapi import Fit, ExtractQENSMembers + +from IndirectCommon import convert_to_elastic_q, transpose_fit_parameters_table class IqtFitMultiple(PythonAlgorithm): @@ -128,8 +138,6 @@ def _get_properties(self): self._fit_group_name = self.getPropertyValue("OutputWorkspaceGroup") def PyExec(self): - from IndirectCommon import convert_to_elastic_q, transpose_fit_parameters_table - setup_prog = Progress(self, start=0.0, end=0.1, nreports=4) setup_prog.report("generating output name") output_workspace = self._fit_group_name @@ -176,7 +184,7 @@ def PyExec(self): fit_prog = Progress(self, start=0.1, end=0.8, nreports=2) multi_domain_func, kwargs = _create_multi_domain_func(self._function, tmp_fit_workspace) fit_prog.report("Fitting...") - ms.Fit( + Fit( Function=multi_domain_func, InputWorkspace=tmp_fit_workspace, WorkspaceIndex=0, @@ -261,7 +269,7 @@ def PyExec(self): delete_alg.execute() if self._do_extract_members: - ms.ExtractQENSMembers( + ExtractQENSMembers( InputWorkspace=self._input_ws, ResultWorkspace=self._fit_group_name, OutputWorkspace=self._fit_group_name.rsplit("_", 1)[0] + "_Members", diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/LagrangeILLReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/LagrangeILLReduction.py index 0af311476c5d..cdfa3b2a8865 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/LagrangeILLReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/LagrangeILLReduction.py @@ -5,9 +5,30 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import DataProcessorAlgorithm, MultipleFileProperty, FileAction, MatrixWorkspaceProperty, FileProperty +from mantid.api import ( + mtd, + AlgorithmFactory, + DataProcessorAlgorithm, + MultipleFileProperty, + FileAction, + MatrixWorkspaceProperty, + FileProperty, +) from mantid.kernel import Direction, StringListValidator -from mantid.simpleapi import * +from mantid.simpleapi import ( + CloneWorkspace, + ConvertUnits, + CreateWorkspace, + DeleteWorkspace, + Divide, + ExtractMonitors, + GroupWorkspaces, + LoadAndMerge, + Multiply, + SortXAxis, + SplineInterpolation, + Subtract, +) import numpy as np from typing import List, Tuple diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MSDFit.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MSDFit.py index 8536ae2cd171..a2d22b74ef27 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MSDFit.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MSDFit.py @@ -5,9 +5,20 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * +from mantid.api import ( + mtd, + AlgorithmFactory, + DataProcessorAlgorithm, + ITableWorkspaceProperty, + MatrixWorkspace, + MatrixWorkspaceProperty, + NumericAxis, + Progress, + PropertyMode, + WorkspaceGroupProperty, +) +from mantid.kernel import logger, Direction, StringListValidator +from mantid.simpleapi import PlotPeakByLogValue class MSDFit(DataProcessorAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MolDyn.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MolDyn.py index b3745db58746..995227d7c525 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MolDyn.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MolDyn.py @@ -5,9 +5,20 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,no-init -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid import FileFinder +from mantid.api import mtd, AlgorithmFactory, PropertyMode, PythonAlgorithm, WorkspaceGroup, WorkspaceProperty +from mantid.kernel import logger, Direction, Property, StringArrayProperty, StringMandatoryValidator +from mantid.simpleapi import ( + plotSpectrum, + CloneWorkspace, + ConjoinSpectra, + ConvolveWorkspaces, + CropWorkspace, + DeleteWorkspace, + LoadNMoldyn3Ascii, + LoadNMoldyn4Ascii, + Symmetrise, +) import os diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/NormaliseByThickness.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/NormaliseByThickness.py index 56ab5091e63a..43de4632a76d 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/NormaliseByThickness.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/NormaliseByThickness.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -import mantid.simpleapi as api -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction, Logger +from mantid.simpleapi import Scale class NormaliseByThickness(PythonAlgorithm): @@ -52,7 +52,7 @@ def PyExec(self): return output_ws_name = self.getPropertyValue("OutputWorkspace") - api.Scale(InputWorkspace=input_ws, OutputWorkspace=output_ws_name, Factor=1.0 / thickness, Operation="Multiply") + Scale(InputWorkspace=input_ws, OutputWorkspace=output_ws_name, Factor=1.0 / thickness, Operation="Multiply") self.setProperty("OutputWorkspace", output_ws_name) self.setProperty("OutputMessage", "Normalised by thickness [%g cm]" % thickness) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py index 910fc6092cfb..c98839c1804f 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py @@ -4,15 +4,19 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# pylint: disable=too-few-public-methods import itertools from IndirectReductionCommon import calibrate, group_spectra, load_files, rebin_logarithmic -from mantid.kernel import * -from mantid.api import * +from mantid import FileFinder +from mantid.api import mtd, AlgorithmFactory, FileAction, FileProperty, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import logger, Direction, IntBoundedValidator, StringArrayProperty, StringListValidator from mantid.simpleapi import ( AddSampleLog, CloneWorkspace, + ConjoinSpectra, + CreateWorkspace, CropWorkspace, DeleteWorkspace, Divide, @@ -20,13 +24,9 @@ NormaliseByCurrent, RebinToWorkspace, ReplaceSpecialValues, - ConjoinSpectra, - CreateWorkspace, ) import numpy as np -# pylint: disable=too-few-public-methods - def _str_or_none(string): return string if string != "" else None diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py index 648f43c3f9c7..bffde5411862 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PolDiffILLReduction.py @@ -6,6 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + from mantid.api import ( + mtd, AlgorithmFactory, FileAction, FileProperty, @@ -30,7 +31,47 @@ RebinParamsValidator, StringListValidator, ) -from mantid.simpleapi import * +from mantid.simpleapi import ( + AppendSpectra, + ApplyPaalmanPingsCorrection, + BinWidthAtX, + ConjoinXRuns, + CloneWorkspace, + ConvertAxisByFormula, + ConvertSpectrumAxis, + ConvertToHistogram, + ConvertToPointData, + ConvertUnits, + CreateSingleValuedWorkspace, + CreateWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + DetectorEfficiencyCorUser, + Divide, + EditInstrumentGeometry, + ExtractMonitors, + ExtractSpectra, + FindEPP, + GroupWorkspaces, + Integration, + LoadAndMerge, + MaskDetectors, + MergeRuns, + Minus, + Multiply, + PaalmanPingsAbsorptionCorrection, + PaalmanPingsMonteCarloAbsorption, + Plus, + Rebin, + RemoveBins, + RenameWorkspace, + ReplaceSpecialValues, + SetSample, + SortXAxis, + SplineInterpolation, + SumOverlappingTubes, + Transpose, +) from scipy.constants import physical_constants import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py index 7bd66b281c69..9461fdd665b6 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PoldiDataAnalysis.py @@ -5,11 +5,26 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-instance-attributes -from mantid.simpleapi import * -from mantid.api import * - -# the mantid.kernel import is required for Direction.Input and Direction.Output calls -from mantid.kernel import * +from mantid.api import AlgorithmFactory, AnalysisDataService, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import ( + Direction, + StringListValidator, +) +from mantid.simpleapi import ( + plotSpectrum, + DeleteWorkspace, + Integration, + GroupWorkspaces, + Plus, + PoldiAnalyseResiduals, + PoldiFitPeaks1D, + PoldiFitPeaks2D, + PoldiIndexKnownCompounds, + PoldiPeakSearch, + PoldiAutoCorrelation, + RenameWorkspace, + SumSpectra, +) class PoldiDataAnalysis(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLDetectorScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLDetectorScan.py index 7362b211aa26..9169dcf2e20e 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLDetectorScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLDetectorScan.py @@ -4,14 +4,34 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +from mantid.api import ( + AlgorithmFactory, + DataProcessorAlgorithm, + MultipleFileProperty, + Progress, + WorkspaceGroupProperty, + FileProperty, + FileAction, +) from mantid.kernel import ( Direction, FloatArrayOrderedPairsValidator, FloatArrayProperty, StringListValidator, ) -from mantid.api import DataProcessorAlgorithm, MultipleFileProperty, Progress, WorkspaceGroupProperty, FileProperty, FileAction -from mantid.simpleapi import * +from mantid.simpleapi import ( + ApplyDetectorScanEffCorr, + CropToComponent, + DeleteWorkspace, + ExtractMonitors, + GroupWorkspaces, + LoadAndMerge, + LoadNexusProcessed, + MaskDetectors, + NormaliseToMonitor, + Scale, + SumOverlappingTubes, +) class PowderILLDetectorScan(DataProcessorAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLEfficiency.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLEfficiency.py index 938e7ef4edb5..2f340daa2593 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLEfficiency.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLEfficiency.py @@ -22,9 +22,53 @@ StringListValidator, VisibleWhenProperty, ) -from mantid.api import FileAction, FileProperty, MatrixWorkspaceProperty, MultipleFileProperty, Progress, PropertyMode, PythonAlgorithm +from mantid.api import ( + mtd, + AlgorithmFactory, + FileAction, + FileProperty, + MatrixWorkspaceProperty, + MultipleFileProperty, + Progress, + PropertyMode, + PythonAlgorithm, +) -from mantid.simpleapi import * +from mantid.simpleapi import ( + ApplyDetectorScanEffCorr, + CloneWorkspace, + ConjoinXRuns, + ConvertToHistogram, + ConvertSpectrumAxis, + ConvertToPointData, + CopyLogs, + CreateWorkspace, + CropWorkspace, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + ExtractMonitors, + ExtractSingleSpectrum, + ExtractSpectra, + GroupWorkspaces, + LoadAndMerge, + LoadILLDiffraction, + LoadNexusProcessed, + MaskBins, + MaskBinsIf, + MostLikelyMean, + Multiply, + NormaliseToMonitor, + Plus, + Scale, + RenameWorkspace, + ReplaceSpecialValues, + SplineInterpolation, + SortXAxis, + SumOverlappingTubes, + Transpose, + WeightedMean, +) def _crop_bins(ws, bin_min, bin_max, out): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLParameterScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLParameterScan.py index 272ae5a4c0d7..3da34e95cfae 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLParameterScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PowderILLParameterScan.py @@ -15,6 +15,8 @@ FloatBoundedValidator, ) from mantid.api import ( + mtd, + AlgorithmFactory, PythonAlgorithm, MultipleFileProperty, FileProperty, @@ -24,7 +26,25 @@ NumericAxis, WorkspaceGroup, ) -from mantid.simpleapi import * +from mantid.simpleapi import ( + AppendSpectra, + ConjoinXRuns, + ConvertSpectrumAxis, + CropWorkspace, + DeleteWorkspace, + Divide, + ExtractMonitors, + ExtractUnmaskedSpectra, + LoadAndMerge, + LoadNexusProcessed, + MaskDetectors, + Multiply, + RenameWorkspace, + Scale, + SortXAxis, + SumSpectra, + Transpose, +) class PowderILLParameterScan(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReactorSANSResolution.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReactorSANSResolution.py index 3d7ee8651697..bd527261a63c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReactorSANSResolution.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReactorSANSResolution.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction import math diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py index c82cd7c8caac..f11343012e4a 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ResNorm2.py @@ -6,17 +6,26 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init from mantid.api import ( - PythonAlgorithm, + mtd, AlgorithmFactory, - MatrixWorkspaceProperty, - WorkspaceGroup, - WorkspaceGroupProperty, ITableWorkspaceProperty, Progress, PropertyMode, + PythonAlgorithm, + MatrixWorkspaceProperty, + WorkspaceGroup, + WorkspaceGroupProperty, ) from mantid.kernel import Direction -from mantid.simpleapi import * +from mantid.simpleapi import ( + AppendSpectra, + CloneWorkspace, + ConvertSpectrumAxis, + CreateWorkspace, + DeleteWorkspace, + GroupWorkspaces, + NormaliseToUnity, +) class ResNorm(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAbsoluteScale.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAbsoluteScale.py index fce7f0ed5023..091f8f36435a 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAbsoluteScale.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAbsoluteScale.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import os -from mantid.api import * -from mantid.kernel import * +from mantid.api import Algorithm, AlgorithmFactory, AlgorithmManager, FileAction, FileProperty, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction, Logger, PropertyManagerDataService, StringListValidator, StringMandatoryValidator from reduction_workflow.find_data import find_data diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAzimuthalAverage1D.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAzimuthalAverage1D.py index a67ed97ebe38..3e8421992950 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAzimuthalAverage1D.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSAzimuthalAverage1D.py @@ -5,12 +5,18 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-many-branches -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, AlgorithmManager, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import ( + logger, + Direction, + FloatArrayProperty, + IntBoundedValidator, + Logger, + PropertyManagerDataService, + StringMandatoryValidator, +) import math -from mantid.kernel import logger - class SANSAzimuthalAverage1D(PythonAlgorithm): def category(self): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSBeamSpreaderTransmission.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSBeamSpreaderTransmission.py index 7ea41d7adb17..43eea5bfdf26 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSBeamSpreaderTransmission.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSBeamSpreaderTransmission.py @@ -6,8 +6,17 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import mantid.simpleapi as api -from mantid.api import * -from mantid.kernel import * +from mantid.api import ( + Algorithm, + AlgorithmFactory, + AlgorithmManager, + AnalysisDataService, + FileAction, + FileProperty, + MatrixWorkspaceProperty, + PythonAlgorithm, +) +from mantid.kernel import Direction, Logger, PropertyManagerDataService, StringMandatoryValidator import os from reduction_workflow.find_data import find_data diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py index 22f2f7d5a7be..6763b572578c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py @@ -5,9 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-many-branches -from mantid.simpleapi import * -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, AlgorithmManager, IEventWorkspace, MatrixWorkspaceProperty, Progress, PythonAlgorithm +from mantid.kernel import CommonBinsValidator, Direction, IntArrayBoundedValidator, IntArrayProperty, Logger import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDirectBeamTransmission.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDirectBeamTransmission.py index b78a5c992c1e..72a236c45602 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDirectBeamTransmission.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDirectBeamTransmission.py @@ -5,8 +5,16 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.api import * -from mantid.kernel import * +from mantid.api import ( + AlgorithmFactory, + AnalysisDataService, + FileAction, + FileProperty, + MatrixWorkspaceProperty, + PropertyMode, + PythonAlgorithm, +) +from mantid.kernel import Direction, PropertyManagerDataService, StringMandatoryValidator import os diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScale.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScale.py index e8c7d77438ab..605e946c7937 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScale.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScale.py @@ -6,8 +6,14 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-arguments,too-few-public-methods -from mantid.simpleapi import * -from mantid.api import DataProcessorAlgorithm, MatrixWorkspaceProperty, PropertyMode, AnalysisDataService +from mantid.api import ( + AlgorithmFactory, + AlgorithmManager, + DataProcessorAlgorithm, + MatrixWorkspaceProperty, + PropertyMode, + AnalysisDataService, +) from mantid.kernel import Direction, Property, StringListValidator, UnitFactory import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLAutoProcess.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLAutoProcess.py index 37b0b9e51073..1f731c56950b 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLAutoProcess.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLAutoProcess.py @@ -5,6 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + from mantid.api import ( + mtd, + AlgorithmFactory, DataProcessorAlgorithm, MatrixWorkspaceProperty, MultipleFileProperty, @@ -14,8 +16,22 @@ FileAction, WorkspaceGroup, ) -from mantid.kernel import Direction, FloatBoundedValidator, FloatArrayProperty, IntBoundedValidator -from mantid.simpleapi import * +from mantid.kernel import logger, Direction, FloatBoundedValidator, FloatArrayProperty, IntBoundedValidator +from mantid.simpleapi import ( + CalculateEfficiency, + CloneWorkspace, + ConvertToPointData, + CropWorkspace, + DeleteWorkspace, + GroupWorkspaces, + LoadNexusProcessed, + UnGroupWorkspace, + RenameWorkspace, + ReplaceSpecialValues, + SANSILLIntegration, + SANSILLReduction, + Stitch, +) import SANSILLCommon as common import numpy as np from os import path diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLIntegration.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLIntegration.py index b2473b274933..21c093e99a76 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLIntegration.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLIntegration.py @@ -5,6 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + from mantid.api import ( + mtd, + AlgorithmFactory, PythonAlgorithm, MatrixWorkspaceProperty, WorkspaceGroupProperty, @@ -26,9 +28,19 @@ FloatArrayLengthValidator, CompositeValidator, ) -from mantid.simpleapi import * -from MildnerCarpenter import * -from DirectBeamResolution import * +from mantid.simpleapi import ( + CalculateDynamicRange, + ConjoinSpectra, + CropToComponent, + CropWorkspaceRagged, + DeleteWorkspace, + GroupWorkspaces, + ReplaceSpecialValues, + Q1DWeighted, + Qxy, +) +from MildnerCarpenter import MonochromaticScalarQCartesian, MonochromaticScalarQCylindric +from DirectBeamResolution import DirectBeamResolution import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLMultiProcess.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLMultiProcess.py index 7321cf327a10..ced2a4acaca5 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLMultiProcess.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLMultiProcess.py @@ -4,8 +4,16 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from SANSILLCommon import * +from SANSILLCommon import ( + AcqMode, + add_correction_numors, + create_name, + needs_loading, + needs_processing, +) from mantid.api import ( + mtd, + AlgorithmFactory, DataProcessorAlgorithm, WorkspaceGroupProperty, MultipleFileProperty, @@ -24,7 +32,20 @@ IntBoundedValidator, StringListValidator, ) -from mantid.simpleapi import * +from mantid.simpleapi import ( + CalculateDynamicRange, + CalculateEfficiency, + ConvertToPointData, + GroupWorkspaces, + LoadNexusProcessed, + MaskDetectorsIf, + RenameWorkspace, + SANSILLIntegration, + SANSILLReduction, + Stitch, + Transpose, + UnGroupWorkspace, +) N_DISTANCES = 5 # maximum number of distinct distance configurations diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLParameterScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLParameterScan.py index 7a4991f7d803..10b1faa8be87 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLParameterScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLParameterScan.py @@ -5,9 +5,19 @@ # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + -from mantid.api import DataProcessorAlgorithm, FileAction, FileProperty, Progress, PropertyMode, WorkspaceProperty -from mantid.kernel import IntBoundedValidator, Direction -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, FileProperty, Progress, PropertyMode, WorkspaceProperty +from mantid.kernel import logger, IntBoundedValidator, Direction +from mantid.simpleapi import ( + ConvertAxisByFormula, + ConvertSpectrumAxis, + DeleteWorkspace, + GroupDetectors, + Load, + LoadNexusProcessed, + SANSILLReduction, + SortXAxis, + Transpose, +) from SANSILLAutoProcess import needs_loading, needs_processing diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py index f38de08d475e..087699f12166 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py @@ -5,6 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + from mantid.api import ( + mtd, + AlgorithmFactory, DataProcessorAlgorithm, MatrixWorkspaceProperty, MultipleFileProperty, @@ -14,8 +16,57 @@ WorkspaceProperty, FileAction, ) -from mantid.kernel import Direction, EnabledWhenProperty, FloatBoundedValidator, LogicOperator, PropertyCriterion, StringListValidator -from mantid.simpleapi import * +from mantid.kernel import ( + config, + logger, + Direction, + EnabledWhenProperty, + FloatBoundedValidator, + LogicOperator, + PropertyCriterion, + StringListValidator, +) +from mantid.simpleapi import ( + AddSampleLog, + ApplyTransmissionCorrection, + CalculateDynamicRange, + CalculateEfficiency, + CalculateFlux, + CalculateTransmission, + CloneWorkspace, + ConvertSpectrumAxis, + ConvertToHistogram, + CreateWorkspace, + CropToComponent, + CropWorkspace, + DeadTimeCorrection, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + ExtractSpectra, + FindDetectorsInShape, + FindCenterOfMassPosition, + Fit, + GroupDetectors, + GroupWorkspaces, + LoadAndMerge, + MaskAngle, + MaskDetectors, + MaskDetectorsIf, + MergeRuns, + Minus, + MoveInstrumentComponent, + NormaliseByThickness, + ParallaxCorrection, + Rebin, + RebinToWorkspace, + RenameWorkspace, + ReplaceSpecialValues, + RotateInstrumentComponent, + Scale, + SolidAngle, + Transpose, +) import SANSILLCommon as common from math import fabs import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction2.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction2.py index efbce622f100..5e08b2e6fd01 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction2.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction2.py @@ -4,9 +4,24 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from SANSILLCommon import * -import SANSILLCommon as common +from SANSILLCommon import ( + AcqMode, + add_correction_information, + blank_monitor_ws_neg_index, + check_axis_match, + check_distances_match, + check_processed_flag, + check_wavelengths_match, + EMPTY_TOKEN, + get_vertical_grouping_pattern, + main_detector_distance, + monitor_id, + real_monitor_ws_neg_index, + return_numors_from_path, +) from mantid.api import ( + mtd, + AlgorithmFactory, DataProcessorAlgorithm, FileAction, MatrixWorkspace, @@ -18,8 +33,50 @@ WorkspaceProperty, ) from mantid.dataobjects import SpecialWorkspace2D -from mantid.kernel import Direction, EnabledWhenProperty, FloatBoundedValidator, LogicOperator, PropertyCriterion, StringListValidator -from mantid.simpleapi import * +from mantid.kernel import ( + config, + Direction, + EnabledWhenProperty, + FloatBoundedValidator, + LogicOperator, + PropertyCriterion, + StringListValidator, +) +from mantid.simpleapi import ( + AddSampleLog, + AppendSpectra, + ApplyTransmissionCorrection, + CalculateEfficiency, + CalculateFlux, + CloneWorkspace, + ConjoinXRuns, + ConvertSpectrumAxis, + ConvertToPointData, + CreateWorkspace, + DeadTimeCorrection, + DeleteWorkspace, + DeleteWorkspaces, + Divide, + ExtractSpectra, + FindCenterOfMassPosition, + Fit, + GroupDetectors, + GroupWorkspaces, + LoadAndMerge, + MaskAngle, + MaskDetectors, + Minus, + MoveInstrumentComponent, + ParallaxCorrection, + RebinToWorkspace, + RenameWorkspace, + RotateInstrumentComponent, + Scale, + SolidAngle, + SortXAxis, + Transpose, +) +import os import numpy as np @@ -275,16 +332,16 @@ def _add_correction_information(self, ws): """ # first, let's create the dictionary containing all parameters that should be added to the metadata parameters = dict() - parameters["numor_list"] = common.return_numors_from_path(self.getPropertyValue("Runs")) - parameters["sample_transmission_ws"] = common.return_numors_from_path(self.getPropertyValue("TransmissionWorkspace")) - parameters["container_ws"] = common.return_numors_from_path(self.getPropertyValue("EmptyContainerWorkspace")) - parameters["absorber_ws"] = common.return_numors_from_path(self.getPropertyValue("DarkCurrentWorkspace")) - parameters["beam_ws"] = common.return_numors_from_path(self.getPropertyValue("EmptyBeamWorkspace")) - parameters["flux_ws"] = common.return_numors_from_path(self.getPropertyValue("FluxWorkspace")) - parameters["sensitivity_ws"] = common.return_numors_from_path(self.getPropertyValue("SensitivityWorkspace")) - parameters["mask_ws"] = common.return_numors_from_path(self.getPropertyValue("MaskWorkspace")) + parameters["numor_list"] = return_numors_from_path(self.getPropertyValue("Runs")) + parameters["sample_transmission_ws"] = return_numors_from_path(self.getPropertyValue("TransmissionWorkspace")) + parameters["container_ws"] = return_numors_from_path(self.getPropertyValue("EmptyContainerWorkspace")) + parameters["absorber_ws"] = return_numors_from_path(self.getPropertyValue("DarkCurrentWorkspace")) + parameters["beam_ws"] = return_numors_from_path(self.getPropertyValue("EmptyBeamWorkspace")) + parameters["flux_ws"] = return_numors_from_path(self.getPropertyValue("FluxWorkspace")) + parameters["sensitivity_ws"] = return_numors_from_path(self.getPropertyValue("SensitivityWorkspace")) + parameters["mask_ws"] = return_numors_from_path(self.getPropertyValue("MaskWorkspace")) # when all is set, a common function can set them all - common.add_correction_information(ws, parameters) + add_correction_information(ws, parameters) def reset(self): """Resets the class member variables""" diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSMask.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSMask.py index 0b89559ca560..4b81b295d2d2 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSMask.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSMask.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,bare-except import mantid.simpleapi as api -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, MatrixWorkspaceProperty, PropertyMode, PythonAlgorithm +from mantid.kernel import Direction, IntArrayProperty, Logger, StringListValidator from reduction_workflow.instruments.sans import hfir_instrument from reduction_workflow.instruments.sans import sns_instrument import sys diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSPatchSensitivity.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSPatchSensitivity.py index cd5032069bee..2f4e238d9d87 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSPatchSensitivity.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSPatchSensitivity.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,bare-except import mantid.simpleapi as api -from mantid.api import * -from mantid.kernel import * +from mantid.api import AlgorithmFactory, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import Direction, IntBoundedValidator, Logger import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSReduction.py index f378d3b47f8d..0eeaa0fc9be4 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSReduction.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import mantid.simpleapi as api -from mantid.api import * -from mantid.kernel import * +from mantid.api import Algorithm, AlgorithmFactory, AlgorithmManager, AnalysisDataService, PythonAlgorithm +from mantid.kernel import Direction, Logger, PropertyManagerDataService, StringMandatoryValidator from reduction_workflow.find_data import find_data import os diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSStitch.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSStitch.py index 73a0fdb9a4d8..ca2b74e79944 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSStitch.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSStitch.py @@ -5,9 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-arguments,too-few-public-methods - -from mantid.simpleapi import * -from mantid.api import DataProcessorAlgorithm, MatrixWorkspaceProperty, PropertyMode +from mantid.api import AlgorithmFactory, AlgorithmManager, DataProcessorAlgorithm, MatrixWorkspaceProperty, PropertyMode from mantid.kernel import Direction, Property, StringListValidator, UnitFactory, EnabledWhenProperty, PropertyCriterion, Logger import numpy as np from sans.common.general_functions import create_unmanaged_algorithm diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimpleShapeDiscusInelastic.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimpleShapeDiscusInelastic.py index cec8efa37c4f..cabd38c0c4fe 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimpleShapeDiscusInelastic.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimpleShapeDiscusInelastic.py @@ -6,6 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceGroupProperty, PropertyMode, Sample from mantid.kernel import ( + logger, VisibleWhenProperty, Property, PropertyCriterion, @@ -15,7 +16,7 @@ FloatBoundedValidator, Direction, ) -from mantid.simpleapi import * +from mantid.simpleapi import DiscusMultipleScatteringCorrection, SetSample class SimpleShapeDiscusInelastic(PythonAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py index 8b34ecdf555e..87c4bcc1afba 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py @@ -13,8 +13,8 @@ import scipy.constants -from mantid.kernel import * -from mantid.api import * +from mantid.api import AlgorithmFactory, Progress, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction, FileAction, FileProperty, StringArrayProperty, StringListValidator import mantid.simpleapi as s_api diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMoments.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMoments.py index d5be13cfafd1..3e5c2ef68917 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMoments.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMoments.py @@ -5,10 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # Algorithm to start Bayes programs -from mantid.simpleapi import * -from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, NumericAxis, Progress -from mantid.kernel import Direction -from mantid import logger +from mantid.api import mtd, DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, NumericAxis, Progress +from mantid.kernel import logger, Direction import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py index 3ae353bf66fd..cb01a477d230 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py @@ -4,13 +4,27 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * -from mantid import config +from mantid import FileFinder +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, FileProperty, Progress, PropertyMode, WorkspaceProperty +from mantid.kernel import ( + config, + logger, + Direction, + FloatArrayLengthValidator, + FloatArrayProperty, + IntArrayMandatoryValidator, + IntArrayProperty, + Property, + SofQWMoments, + StringArrayProperty, + StringListValidator, + Rebin, +) +from mantid.simpleapi import Fit, LoadLog import os import numpy as np +import re from IndirectCommon import format_runs diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SwapWidths.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SwapWidths.py index b3ee95372a39..dc095cf61e3c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SwapWidths.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SwapWidths.py @@ -5,9 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * from mantid.api import WorkspaceProperty, DataProcessorAlgorithm, AlgorithmFactory, mtd, Progress -from mantid.simpleapi import * +from mantid.kernel import logger, Direction +from mantid.simpleapi import CreateWorkspace import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py index a6241e9204e2..330761e36c98 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TOSCABankCorrection.py @@ -5,9 +5,18 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, MatrixWorkspaceProperty, WorkspaceProperty +from mantid.kernel import logger, Direction, FloatArrayProperty, StringListValidator +from mantid.simpleapi import ( + AppendSpectra, + CropWorkspace, + DeleteWorkspace, + FindPeaks, + GroupDetectors, + RebinToWorkspace, + ScaleX, + SortTableWorkspace, +) class TOSCABankCorrection(DataProcessorAlgorithm): diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py index d3b03e3417d3..634531bd2236 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py @@ -5,9 +5,24 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmFactory, Progress, PropertyMode, PythonAlgorithm, WorkspaceGroupProperty, WorkspaceProperty +from mantid.kernel import ( + logger, + CalculateFlatBackground, + CropWorkspace, + DeleteWorkspace, + Direction, + Divide, + GroupWorkspaces, + Integration, + FloatArrayProperty, + IntArrayProperty, + StringArrayProperty, + Transpose, +) +from mantid.simpleapi import Load + +from IndirectCommon import check_hist_zero import os @@ -221,8 +236,6 @@ def _process_raw_file(self, raw_file): @param raw_file Name of file to process """ - from IndirectCommon import check_hist_zero - # Crop the raw file to use the desired number of spectra # less one because CropWorkspace is zero based CropWorkspace( diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py index 86dbd02efaf9..092d44888155 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py @@ -5,9 +5,11 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,too-many-instance-attributes -from mantid.simpleapi import * -from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, ITableWorkspaceProperty, PropertyMode, Progress +from mantid.api import mtd, AlgorithmFactory, ITableWorkspaceProperty, MatrixWorkspaceProperty, PropertyMode, Progress, PythonAlgorithm from mantid.kernel import Direction, logger, IntBoundedValidator +from mantid.simpleapi import CreateEmptyTableWorkspace, CropWorkspace + +from IndirectCommon import check_analysers_or_e_fixed, check_dimensions_equal, check_hist_zero, get_efixed, get_workspace_name_prefix DEFAULT_ITERATIONS = 50 DEFAULT_SEED = 89631139 @@ -106,9 +108,6 @@ def _setup(self): """ Gets algorithm properties. """ - - from IndirectCommon import get_workspace_name_prefix - self._sample = self.getPropertyValue("SampleWorkspace") self._resolution = self.getPropertyValue("ResolutionWorkspace") @@ -152,8 +151,6 @@ def _calculate_parameters(self): """ Calculates the TransformToIqt parameters and saves in a table workspace. """ - from IndirectCommon import get_efixed - end_prog = 0.3 if self._calculate_errors else 0.9 workflow_prog = Progress(self, start=0.0, end=end_prog, nreports=8) workflow_prog.report("Cropping Workspace") @@ -239,8 +236,6 @@ def _transform(self): """ Run TransformToIqt. """ - from IndirectCommon import check_hist_zero, check_dimensions_equal - # Process resolution data res_number_of_histograms = check_hist_zero(self._resolution)[0] sample_number_of_histograms = check_hist_zero(self._sample)[0] @@ -273,8 +268,6 @@ def _transform(self): return iqt def _check_analysers_and_reflection(self): - from IndirectCommon import check_analysers_or_e_fixed - try: check_analysers_or_e_fixed(self._sample, self._resolution) except ValueError: diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransmissionUtils.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransmissionUtils.py index 9282b8e98b51..8067ed745b65 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransmissionUtils.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransmissionUtils.py @@ -5,8 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name -from mantid.api import * -from mantid.kernel import * +from mantid.api import Algorithm, AlgorithmManager +from mantid.kernel import Logger import os import sys diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/USANSReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/USANSReduction.py index 87f19b06be17..d3e4fa4d7fd0 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/USANSReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/USANSReduction.py @@ -5,9 +5,11 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * +from mantid import FileFinder +from mantid.api import mtd, AlgorithmFactory, AlgorithmManager, MatrixWorkspaceProperty, PythonAlgorithm +from mantid.kernel import Direction, IntArrayBoundedValidator, IntArrayProperty, Logger +from mantid.simpleapi import CreateWorkspace, FilterByLogValue, Load, LoadInstrument + import math import numpy import sys diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/VesuvioDiffractionReduction.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/VesuvioDiffractionReduction.py index dc8572ba1b3b..a0d44b62b92a 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/VesuvioDiffractionReduction.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/VesuvioDiffractionReduction.py @@ -4,10 +4,34 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * -from mantid import config +from mantid.api import ( + mtd, + AlgorithmFactory, + AnalysisDataService, + DataProcessorAlgorithm, + FileAction, + FileProperty, + Progress, + WorkspaceGroup, + WorkspaceGroupProperty, +) +from mantid.kernel import config, logger, Direction, IntArrayProperty, StringArrayProperty, StringListValidator +from mantid.simpleapi import ConvertUnits, DeleteWorkspace, GroupWorkspaces + +from IndirectReductionCommon import ( + load_files, + get_multi_frame_rebin, + identify_bad_detectors, + unwrap_monitor, + process_monitor_efficiency, + scale_monitor, + scale_detectors, + rebin_reduction, + group_spectra, + fold_chopped, + rename_reduction, + mask_detectors, +) import os import warnings @@ -84,22 +108,6 @@ def validateInputs(self): def PyExec(self): warnings.warn("This algorithm is depreciated (April-2017). Please use ISISIndirectDiffractionReduction") - - from IndirectReductionCommon import ( - load_files, - get_multi_frame_rebin, - identify_bad_detectors, - unwrap_monitor, - process_monitor_efficiency, - scale_monitor, - scale_detectors, - rebin_reduction, - group_spectra, - fold_chopped, - rename_reduction, - mask_detectors, - ) - self._setup() load_opts = dict() From f4a355951349d05d8c4440e3d4074937d5962940 Mon Sep 17 00:00:00 2001 From: Applin Date: Wed, 16 Oct 2024 11:38:32 +0100 Subject: [PATCH 4/5] Fix remaining wild imports in Framework folder --- Framework/PythonInterface/plugins/functions/FlatTopPeak.py | 2 +- .../test/ReflectometryBackgroundSubtractionTest.py | 5 +++-- .../Reflectometry/test/ReflectometryReductionOne2Test.py | 3 ++- Framework/WorkflowAlgorithms/test/EQSANSQ2DTest.py | 3 ++- .../WorkflowAlgorithms/test/SANSBeamFluxCorrectionTest.py | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Framework/PythonInterface/plugins/functions/FlatTopPeak.py b/Framework/PythonInterface/plugins/functions/FlatTopPeak.py index 8dd4ff1d8187..367d6e9eafc6 100644 --- a/Framework/PythonInterface/plugins/functions/FlatTopPeak.py +++ b/Framework/PythonInterface/plugins/functions/FlatTopPeak.py @@ -4,7 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from mantid.simpleapi import * +from mantid.api import FunctionFactory, IFunction1D import scipy.special diff --git a/Framework/Reflectometry/test/ReflectometryBackgroundSubtractionTest.py b/Framework/Reflectometry/test/ReflectometryBackgroundSubtractionTest.py index 7e15b2c9d0b8..b7baa543768d 100644 --- a/Framework/Reflectometry/test/ReflectometryBackgroundSubtractionTest.py +++ b/Framework/Reflectometry/test/ReflectometryBackgroundSubtractionTest.py @@ -5,7 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.simpleapi import * +from mantid.api import mtd, WorkspaceGroup +from mantid.simpleapi import CreateWorkspace from testhelpers import assertRaisesNothing, create_algorithm @@ -158,7 +159,7 @@ def test_AveragePixelFit_error_peakRange_two_ranges(self): self._assert_run_algorithm_throws(args) def test_validateInputs(self): - group = mantid.api.WorkspaceGroup() + group = WorkspaceGroup() mtd["group"] = group args = {"InputWorkspace": "group", "BackgroundCalculationMethod": "PerDetectorAverage", "OutputWorkspace": "output"} alg = create_algorithm("ReflectometryBackgroundSubtraction", **args) diff --git a/Framework/Reflectometry/test/ReflectometryReductionOne2Test.py b/Framework/Reflectometry/test/ReflectometryReductionOne2Test.py index 987d8ee8f457..5f22a0c41ced 100644 --- a/Framework/Reflectometry/test/ReflectometryReductionOne2Test.py +++ b/Framework/Reflectometry/test/ReflectometryReductionOne2Test.py @@ -5,7 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CreateSampleWorkspace from testhelpers import assertRaisesNothing, create_algorithm diff --git a/Framework/WorkflowAlgorithms/test/EQSANSQ2DTest.py b/Framework/WorkflowAlgorithms/test/EQSANSQ2DTest.py index d5589c056253..045d118ec29a 100644 --- a/Framework/WorkflowAlgorithms/test/EQSANSQ2DTest.py +++ b/Framework/WorkflowAlgorithms/test/EQSANSQ2DTest.py @@ -5,7 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CreateWorkspace, DeleteWorkspace, EQSANSQ2D, Integration, LoadInstrument, ReplaceSpecialValues, SumSpectra class EQSANSQ2DTest(unittest.TestCase): diff --git a/Framework/WorkflowAlgorithms/test/SANSBeamFluxCorrectionTest.py b/Framework/WorkflowAlgorithms/test/SANSBeamFluxCorrectionTest.py index adc042dc2661..f3f07359a528 100644 --- a/Framework/WorkflowAlgorithms/test/SANSBeamFluxCorrectionTest.py +++ b/Framework/WorkflowAlgorithms/test/SANSBeamFluxCorrectionTest.py @@ -5,7 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.simpleapi import * +from mantid.api import AnalysisDataService +from mantid.simpleapi import CreateWorkspace, LoadInstrument, SANSBeamFluxCorrection, SumSpectra class SANSBeamFluxCorrectionTest(unittest.TestCase): From 9089bad2df62bd72daa5bf2c2a327d18847e36c8 Mon Sep 17 00:00:00 2001 From: Applin Date: Wed, 16 Oct 2024 11:49:30 +0100 Subject: [PATCH 5/5] Fix wild import warnings in system tests --- .../algorithms/PoldiCreatePeaksFromFile.py | 40 ++++++++++++++----- .../plugins/algorithms/VesuvioAnalysis.py | 4 +- .../SANSDarkRunBackgroundCorrection.py | 12 +++++- .../SimulatedDensityOfStates.py | 4 +- .../WorkflowAlgorithms/SofQWMomentsScan.py | 4 +- .../WorkflowAlgorithms/TimeSlice.py | 12 +++--- .../plugins/algorithms/PoldiMergeTest.py | 5 +-- .../SANSFitShiftScaleTest.py | 3 +- .../WorkflowAlgorithms/SANSStitchTest.py | 3 +- .../tests/framework/ARCSReductionTest.py | 4 +- .../AlignAndFocusPowderFromFilesTest.py | 25 ++++++++++-- .../tests/framework/BuildSQWTest.py | 16 +++++++- .../tests/framework/CNCSReductionTest.py | 4 +- .../tests/framework/CRISPLoadingTest.py | 2 +- .../tests/framework/CalMuonDeadTimeTest.py | 2 +- .../tests/framework/CodeConventions.py | 2 +- .../framework/CompareMDWorkspacesTest.py | 3 +- .../tests/framework/CompressEvents.py | 3 +- .../ConvToMDCompareDefaultVsIndexing.py | 3 +- .../framework/ConvertHFIRSCDtoMDETest.py | 3 +- .../tests/framework/ConvertToMDworkflow.py | 3 +- .../tests/framework/ConvertWANDSCDtoQTest.py | 3 +- .../tests/framework/CountReflectionsTest.py | 2 +- .../framework/D7AbsoluteCrossSectionsTest.py | 4 +- .../framework/D7YIGPositionCalibrationTest.py | 5 ++- .../SystemTests/tests/framework/DOSTest.py | 4 +- .../framework/Diffraction_Workflow_Test.py | 17 +++++++- .../framework/DirectILLAutoProcessTest.py | 4 +- .../framework/DirectInelasticDiagnostic2.py | 3 +- .../framework/DistributeProtonChargeTest.py | 3 +- .../tests/framework/DrillProcessTest.py | 6 +-- .../tests/framework/EQSANSBeamCenterAPIv2.py | 16 ++++++-- .../tests/framework/EQSANSDarkCurrentAPIv2.py | 19 +++++++-- .../tests/framework/EQSANSEffAPIv2.py | 17 ++++++-- .../tests/framework/EQSANSFlatTestAPIv2.py | 31 ++++++++++++-- .../tests/framework/EQSANSIQOutputAPIv2.py | 23 +++++++++-- .../framework/EQSANSNormalisationAPIv2.py | 6 +-- .../framework/EQSANSProcessedEffAPIv2.py | 15 ++++++- .../tests/framework/EQSANSSolidAPIv2.py | 20 ++++++++-- .../tests/framework/EQSANSTransAPIv2.py | 27 +++++++++++-- .../FilterEventsWithHighFirstIndexSplitter.py | 3 +- .../framework/FilteredLoadvsLoadThenFilter.py | 2 +- .../FlatPlatePaalmanPingsCorrectionTest.py | 3 +- .../tests/framework/HFIRBackgroundAPIv2.py | 16 ++++++-- .../tests/framework/HFIREffAPIv2.py | 16 ++++++-- .../tests/framework/HFIRReductionAPIv2.py | 19 +++++++-- .../tests/framework/HFIRTestsAPIv2.py | 36 +++++++++++++++-- .../tests/framework/HFIRTransAPIv2.py | 19 +++++++-- .../tests/framework/HYSPECReductionTest.py | 18 ++++++++- .../framework/ILLPowderDetectorScanTest.py | 12 +++++- .../framework/ILLSANSMultiProcessTest.py | 4 +- .../tests/framework/INTERLoadingTest.py | 2 +- .../tests/framework/INTERReductionTest.py | 23 ++++++++++- .../ISIS/SANS/LARMOR/SANSLARMORMultiPeriod.py | 3 +- .../LARMOR/SANSLARMORMultiPeriodAddFiles.py | 5 ++- .../ISIS/SANS/LOQ/LOQReloadWorkspaces.py | 26 +++++++++++- .../ISIS/SANS/LOQ/SANSLOQAddBatch.py | 2 +- .../framework/ISIS/SANS/LOQ/SANSLOQBatch.py | 8 ++-- .../framework/ISIS/SANS/LOQ/SANSLOQCan2D.py | 3 +- .../ISIS/SANS/LOQ/SANSLOQCentreNoGrav.py | 17 +++++++- .../ISIS/SANS/LOQ/SANSLOQReductionGUI.py | 3 +- .../SANS/LOQ/SANSLOQTransFitWorkspace2D.py | 18 ++++++++- .../framework/ISIS/SANS/SANS2D/SANS2DBatch.py | 9 +++-- .../ISIS/SANS/SANS2D/SANS2DFrontNoGrav.py | 2 +- .../ISIS/SANS/SANS2D/SANS2DLimitEventsTime.py | 3 +- .../ISIS/SANS/SANS2D/SANS2DMultiPeriod.py | 5 ++- .../SANS/SANS2D/SANS2DMultiPeriodAddFiles.py | 4 +- .../ISIS/SANS/SANS2D/SANS2DReductionGUI.py | 4 +- .../SANS/SANS2D/SANS2DReductionGUIAdded.py | 5 ++- .../SANS/SANS2D/SANS2DReloadWorkspaces.py | 20 +++++++++- .../ISIS/SANS/SANS2D/SANS2DWaveloops.py | 13 +++++- .../ISIS/SANS/WORKFLOWS/SANSCentreSample.py | 10 ++++- .../WORKFLOWS/SANSDarkRunSubtractionTest.py | 4 +- .../ISIS/SANS/WORKFLOWS/SANSFileChecking.py | 15 ++++++- .../ISIS/SANS/WORKFLOWS/SANSLoadersTest.py | 4 +- .../SANS/WORKFLOWS/SANSQResolutionTest.py | 21 +++++++++- .../ISIS/SANS/WORKFLOWS/SANSUtilityTest.py | 3 +- .../SANS/WORKFLOWS/SANSWorkspaceTypeTest.py | 4 +- .../tests/framework/ISISDirectInelastic.py | 4 +- .../ISISDirectReductionComponents.py | 4 +- .../tests/framework/ISISIndirectBayesTest.py | 4 +- .../tests/framework/ISISIndirectInelastic.py | 25 ++++++++++-- .../tests/framework/ISISMuonAnalysis.py | 3 +- .../framework/ISISMuonAnalysisGrouping.py | 2 +- .../framework/ISISReflInstrumentIDFTest.py | 3 +- .../ISISReflectometryAutoreductionTest.py | 16 ++++++-- .../ISISReflectometryWorkflowBase.py | 16 +++++++- ...SReflectometryWorkflowPreprocessingTest.py | 3 +- .../ISISReflectometryWorkflowSlicingTest.py | 3 +- .../tests/framework/ISIS_LETReduction.py | 7 +++- .../tests/framework/ISIS_MAPS_DGSReduction.py | 5 ++- .../tests/framework/ISIS_MERLINReduction.py | 5 ++- .../tests/framework/ISIS_MariReduction.py | 7 +++- .../tests/framework/L2QScriptTest.py | 4 +- .../tests/framework/LRPrimaryFractionTest.py | 5 ++- .../framework/LRReductionWithReferenceTest.py | 5 +-- .../tests/framework/LRScalingFactorsTest.py | 4 +- .../framework/LagrangeILLReductionTest.py | 4 +- .../tests/framework/LinkedUBs_Test.py | 3 +- ...uidsReflectometryReductionNoScalingTest.py | 5 +-- .../LiquidsReflectometryReductionTest.py | 4 +- ...eflectometryReductionWithBackgroundTest.py | 4 +- .../tests/framework/LoadAndCheckBase.py | 7 ++-- .../framework/LoadEmbeddedInstrumentInfo.py | 3 +- .../tests/framework/LoadLotsOfInstruments.py | 3 +- .../tests/framework/LoadMuonNexusTest.py | 3 +- .../tests/framework/MDNormCORELLITest.py | 22 +++++++--- .../tests/framework/MDNormHYSPECTest.py | 16 +++++++- .../tests/framework/MDWorkspaceTests.py | 19 +++++++-- .../framework/MRFilterCrossSectionsTest.py | 3 +- .../MagnetismReflectometryReductionTest.py | 12 +++++- .../SystemTests/tests/framework/MaxEntTest.py | 2 +- .../tests/framework/MuonFFTTest.py | 2 +- .../tests/framework/MuonKerenFittingTest.py | 3 +- .../framework/MuonLoadersSignatureTest.py | 2 +- .../tests/framework/MuonMaxEntTest.py | 5 ++- .../tests/framework/MuonProcessTest.py | 3 +- .../tests/framework/OFFSPECLoadingTest.py | 2 +- .../framework/POLDIAnalyseResidualsTest.py | 3 +- .../framework/POLDIAutoCorrelationTest.py | 3 +- .../framework/POLDICreatePeaksFromCellTest.py | 2 +- .../tests/framework/POLDIDataAnalysisTest.py | 4 +- .../tests/framework/POLDIFitPeaks1DTest.py | 3 +- .../tests/framework/POLDIFitPeaks2DTest.py | 17 +++++++- .../tests/framework/POLDILoadRunsTest.py | 4 +- .../tests/framework/POLDIMergeTest.py | 3 +- .../tests/framework/POLDIPeakSearchTest.py | 3 +- .../tests/framework/POLDITruncateDataTest.py | 3 +- .../tests/framework/POLREFLoadingTest.py | 2 +- .../tests/framework/Peak2ConvCell_Test.py | 11 ++++- .../framework/PelicanCrystalProcessingTest.py | 4 +- .../tests/framework/PelicanReductionTest.py | 3 +- .../tests/framework/PolrefExample.py | 15 ++++++- .../PowderDiffProfileCalibrateTest.py | 28 ++++++++----- .../tests/framework/PredictPeaksTest.py | 15 ++++++- .../tests/framework/ReduceOneSCD_Run.py | 23 ++++++++++- Testing/SystemTests/tests/framework/RefRoi.py | 3 +- .../tests/framework/ReflectometryISIS.py | 14 ++++++- .../tests/framework/ReflectometryISIS_v2.py | 14 ++++++- .../ReflectometryQuickCombineMulti.py | 4 +- .../ReflectometryQuickMultiDetector.py | 2 +- .../ReflectometryQuickPointDetector.py | 3 +- ...metryQuickPointDetectorMakeTransmission.py | 3 +- .../RelectometryInstrumentSignedThetaTest.py | 3 +- .../framework/SANSILLAbsoluteScale2Test.py | 5 ++- .../framework/SANSILLAbsoluteScaleTest.py | 4 +- .../tests/framework/SANSILLReduction2Test.py | 19 ++++++++- .../tests/framework/SANSILLReductionTest.py | 16 +++++++- .../tests/framework/SEQUOIAreduction.py | 27 ++++++++++++- .../tests/framework/SNSConvertToMDTest.py | 4 +- .../tests/framework/SNSPowderRedux.py | 34 +++++++++++++++- .../tests/framework/SXDAnalysis.py | 14 ++++++- .../tests/framework/SaveLoadNexusProcessed.py | 19 +++++++-- .../tests/framework/SaveNexusTest.py | 3 +- .../tests/framework/SortHKLTest.py | 3 +- .../tests/framework/SpaceGroupFactoryTest.py | 4 +- .../SpaceGroupReflectionConditionsTest.py | 4 +- .../tests/framework/SpaceGroupUnitCellTest.py | 2 +- .../tests/framework/SplineSmoothingTest.py | 4 +- .../SystemTests/tests/framework/StepScan.py | 2 +- .../tests/framework/SurfLoadingTest.py | 2 +- .../tests/framework/TOPAZPeakFinding.py | 3 +- .../framework/UnweightedLeastSquaresTest.py | 3 +- .../tests/framework/VesuvioCommandsTest.py | 6 +-- .../tests/framework/VesuvioCorrectionsTest.py | 3 +- .../tests/framework/VesuvioFittingTest.py | 3 +- .../framework/WeightedLeastSquaresTest.py | 5 ++- .../tests/framework/WishAnalysis.py | 20 +++++++++- .../tests/framework/WishDiffuseScattering.py | 18 ++++++++- .../tests/framework/WishMasking.py | 4 +- .../cxxtest/build_tools/SCons/cxxtest.py | 2 +- .../Tools/cxxtest/python/cxxtest/__init__.py | 1 + 172 files changed, 1146 insertions(+), 298 deletions(-) diff --git a/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py b/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py index 9879eddfd6ca..7234c4a323ee 100644 --- a/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py +++ b/Framework/PythonInterface/plugins/algorithms/PoldiCreatePeaksFromFile.py @@ -5,14 +5,38 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-few-public-methods,unused-import -# ruff: noqa: F403 # Allow wild imports -from mantid.kernel import * -from mantid.simpleapi import * -from mantid.api import * -from mantid.geometry import * +from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty +from mantid.geometry import SpaceGroupFactory +from mantid.kernel import logger, Direction +from mantid.simpleapi import GroupWorkspaces, PoldiCreatePeaksFromCell import os +PYPARSING_AVAILABLE = True +try: + from pyparsing import ( + alphas, + alphanums, + delimitedList, + lineEnd, + nums, + restOfLine, + stringEnd, + CaselessLiteral, + Combine, + Each, + Group, + Literal, + OneOrMore, + Optional, + ParseException, + Suppress, + White, + Word, + ) +except ImportError: + PYPARSING_AVAILABLE = False + class PoldiCompound(object): """Small helper class to handle the results from PoldiCrystalFileParser.""" @@ -225,11 +249,9 @@ def _createPeaksFromCell(self, compound, dMin, dMax): return compound.getName() -try: - from pyparsing import * - +if PYPARSING_AVAILABLE: AlgorithmFactory.subscribe(PoldiCreatePeaksFromFile) -except ImportError: +else: logger.debug( "Failed to subscribe algorithm PoldiCreatePeaksFromFile; Python package pyparsing" "may be missing (https://pypi.python.org/pypi/pyparsing)" diff --git a/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py b/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py index 25188faa8535..759a1f318b8c 100644 --- a/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py +++ b/Framework/PythonInterface/plugins/algorithms/VesuvioAnalysis.py @@ -34,9 +34,8 @@ PythonAlgorithm, ) from mantid.dataobjects import TableWorkspace -from mantid.kernel import logger, FloatArrayProperty, IntArrayProperty +from mantid.kernel import Direction, FloatArrayProperty, FloatBoundedValidator, IntArrayProperty, IntListValidator, StringListValidator from mantid.simpleapi import CloneWorkspace, Fit, LoadVesuvio, MaskDetectors, Minus, Rebin, RenameWorkspace, Scale, SumSpectra -from mantid.kernel import StringListValidator, IntListValidator, FloatBoundedValidator, Direction from Inelastic.vesuvio.analysisHelpers import ( block_fit_ncp, final_fit, @@ -50,6 +49,7 @@ create_slab_geometry, generate_elements, generate_constraints, + logger, prepare_fit_arguments, subtract_other_masses, ) diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py index 6763b572578c..1313f037c4bb 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py @@ -5,8 +5,16 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-many-branches -from mantid.api import AlgorithmFactory, AlgorithmManager, IEventWorkspace, MatrixWorkspaceProperty, Progress, PythonAlgorithm -from mantid.kernel import CommonBinsValidator, Direction, IntArrayBoundedValidator, IntArrayProperty, Logger +from mantid.api import ( + AlgorithmFactory, + AlgorithmManager, + CommonBinsValidator, + IEventWorkspace, + MatrixWorkspaceProperty, + Progress, + PythonAlgorithm, +) +from mantid.kernel import Direction, IntArrayBoundedValidator, IntArrayProperty, Logger import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py index 87c4bcc1afba..deb63b1544b2 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SimulatedDensityOfStates.py @@ -13,8 +13,8 @@ import scipy.constants -from mantid.api import AlgorithmFactory, Progress, PythonAlgorithm, WorkspaceProperty -from mantid.kernel import logger, Direction, FileAction, FileProperty, StringArrayProperty, StringListValidator +from mantid.api import AlgorithmFactory, FileAction, FileProperty, Progress, PythonAlgorithm, WorkspaceProperty +from mantid.kernel import logger, Direction, StringArrayProperty, StringListValidator import mantid.simpleapi as s_api diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py index cb01a477d230..c613bebf0e9a 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SofQWMomentsScan.py @@ -15,12 +15,10 @@ IntArrayMandatoryValidator, IntArrayProperty, Property, - SofQWMoments, StringArrayProperty, StringListValidator, - Rebin, ) -from mantid.simpleapi import Fit, LoadLog +from mantid.simpleapi import Fit, LoadLog, Rebin, SofQWMoments import os import numpy as np diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py index 634531bd2236..9dc6bfcff9c0 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py @@ -8,19 +8,21 @@ from mantid.api import mtd, AlgorithmFactory, Progress, PropertyMode, PythonAlgorithm, WorkspaceGroupProperty, WorkspaceProperty from mantid.kernel import ( logger, + Direction, + FloatArrayProperty, + IntArrayProperty, + StringArrayProperty, +) +from mantid.simpleapi import ( CalculateFlatBackground, CropWorkspace, DeleteWorkspace, - Direction, Divide, GroupWorkspaces, Integration, - FloatArrayProperty, - IntArrayProperty, - StringArrayProperty, + Load, Transpose, ) -from mantid.simpleapi import Load from IndirectCommon import check_hist_zero diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/PoldiMergeTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/PoldiMergeTest.py index cbf091ae9a2e..da4bedd7c57a 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/PoldiMergeTest.py +++ b/Framework/PythonInterface/test/python/plugins/algorithms/PoldiMergeTest.py @@ -6,9 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import AnalysisDataService, MatrixWorkspace +from mantid.simpleapi import CreateWorkspace, DeleteWorkspace, GroupWorkspaces, PoldiMerge import numpy as np diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScaleTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScaleTest.py index f758cd6ebb8b..4fb863cee6b9 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScaleTest.py +++ b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSFitShiftScaleTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.api import AlgorithmManager +from mantid.api import AlgorithmManager, FrameworkManager import numpy as np from SANSFitShiftScale import ErrorTransferFromModelToData @@ -293,4 +293,5 @@ def test_that_error_is_transferred(self): if __name__ == "__main__": + FrameworkManager.Instance() unittest.main() diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSStitchTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSStitchTest.py index 8315e5b54513..e2906752f4c6 100644 --- a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSStitchTest.py +++ b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SANSStitchTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import unittest -from mantid.api import AlgorithmManager, MatrixWorkspace +from mantid.api import AlgorithmManager, FrameworkManager, MatrixWorkspace import numpy as np from SANSStitch import QErrorCorrectionForMergedWorkspaces @@ -890,4 +890,5 @@ def test_correct_x_error_is_produced(self): if __name__ == "__main__": + FrameworkManager.Instance() unittest.main() diff --git a/Testing/SystemTests/tests/framework/ARCSReductionTest.py b/Testing/SystemTests/tests/framework/ARCSReductionTest.py index 816874734248..241385bfabd3 100644 --- a/Testing/SystemTests/tests/framework/ARCSReductionTest.py +++ b/Testing/SystemTests/tests/framework/ARCSReductionTest.py @@ -11,7 +11,9 @@ import os import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import DeleteWorkspace, DgsReduction, ExtractMask, Load, LoadNXSPE, SaveNXSPE class ARCSReductionTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/AlignAndFocusPowderFromFilesTest.py b/Testing/SystemTests/tests/framework/AlignAndFocusPowderFromFilesTest.py index c75e06aed6b6..101d357d605a 100644 --- a/Testing/SystemTests/tests/framework/AlignAndFocusPowderFromFilesTest.py +++ b/Testing/SystemTests/tests/framework/AlignAndFocusPowderFromFilesTest.py @@ -6,8 +6,27 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from mantid.api import WorkspaceFactory +from mantid.api import mtd, AnalysisDataService, WorkspaceFactory +from mantid.kernel import PropertyManagerDataService +from mantid.simpleapi import ( + AlignAndFocusPowder, + AlignAndFocusPowderFromFiles, + ConvertUnits, + CreateGroupingWorkspace, + CylinderAbsorption, + DeleteWorkspace, + Divide, + FilterBadPulses, + LoadDiffCal, + LoadEventAndCompress, + LoadEventNexus, + NormaliseByCurrent, + PDDetermineCharacterizations, + PDLoadCharacterizations, + RebinRagged, + SetSample, + SortEvents, +) import numpy as np import os import time @@ -418,7 +437,7 @@ def runTest(self): for i in range(absorptionWS.getNumberHistograms()): absorptionWS.setX(i, xaxis) absorptionWS.getAxis(0).setUnit("Wavelength") - mantid.api.AnalysisDataService.addOrReplace("V_abs", absorptionWS) + AnalysisDataService.addOrReplace("V_abs", absorptionWS) SetSample( InputWorkspace="V_abs", Material={"ChemicalFormula": "V", "SampleNumberDensity": 0.0721}, diff --git a/Testing/SystemTests/tests/framework/BuildSQWTest.py b/Testing/SystemTests/tests/framework/BuildSQWTest.py index 1fa6d4cb9a7b..81439c929dc4 100644 --- a/Testing/SystemTests/tests/framework/BuildSQWTest.py +++ b/Testing/SystemTests/tests/framework/BuildSQWTest.py @@ -16,7 +16,19 @@ import systemtesting import os -from mantid.simpleapi import * +from mantid.kernel import config, logger +from mantid.simpleapi import ( + CompareMDWorkspaces, + ConvertToMD, + DeleteWorkspace, + LoadMD, + LoadNXSPE, + LoadSQW, + MergeMDFiles, + SaveMD, + SetGoniometer, + SetUB, +) # allow for multiple locations FILE_LOCATIONS = ["/isis/mantid/localtestdata/"] # ,"d:/Data/MantidSystemTests/BigData/Dropbox/LoadSQW"] @@ -109,7 +121,7 @@ def cleanup(self): try: os.remove(filename) except OSError: - mantid.logger.warning("Unable to remove created file '%s'" % filename) + logger.warning("Unable to remove created file '%s'" % filename) class LoadSQW_FileBasedTest(BuildSQWTest): diff --git a/Testing/SystemTests/tests/framework/CNCSReductionTest.py b/Testing/SystemTests/tests/framework/CNCSReductionTest.py index 3f75799a43c5..b06ff12c0f89 100644 --- a/Testing/SystemTests/tests/framework/CNCSReductionTest.py +++ b/Testing/SystemTests/tests/framework/CNCSReductionTest.py @@ -11,7 +11,9 @@ import os import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import CNCSSuggestTIB, DeleteWorkspace, DgsReduction, GenerateGroupingPowder, Load, LoadNXSPE, SaveNXSPE class CNCSReductionTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/CRISPLoadingTest.py b/Testing/SystemTests/tests/framework/CRISPLoadingTest.py index 59ba49d63501..244dba2adc4f 100644 --- a/Testing/SystemTests/tests/framework/CRISPLoadingTest.py +++ b/Testing/SystemTests/tests/framework/CRISPLoadingTest.py @@ -4,7 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from LoadAndCheckBase import * +from LoadAndCheckBase import LoadAndCheckBase class CRISPLoadingTest(LoadAndCheckBase): diff --git a/Testing/SystemTests/tests/framework/CalMuonDeadTimeTest.py b/Testing/SystemTests/tests/framework/CalMuonDeadTimeTest.py index ab6265aeb333..ad97a6023c12 100644 --- a/Testing/SystemTests/tests/framework/CalMuonDeadTimeTest.py +++ b/Testing/SystemTests/tests/framework/CalMuonDeadTimeTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import CalMuonDeadTime, GroupWorkspaces, Load class CalMuonDeadTimeTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/CodeConventions.py b/Testing/SystemTests/tests/framework/CodeConventions.py index 487e44e14048..81bcbe2f1f8f 100644 --- a/Testing/SystemTests/tests/framework/CodeConventions.py +++ b/Testing/SystemTests/tests/framework/CodeConventions.py @@ -8,7 +8,7 @@ import systemtesting import re import mantid -from mantid.simpleapi import * +from mantid.api import AlgorithmFactory MAX_ALG_LEN = 40 # TODO convention says 20 is the maximum diff --git a/Testing/SystemTests/tests/framework/CompareMDWorkspacesTest.py b/Testing/SystemTests/tests/framework/CompareMDWorkspacesTest.py index c3eb7348ae3c..e2fc0aa78542 100644 --- a/Testing/SystemTests/tests/framework/CompareMDWorkspacesTest.py +++ b/Testing/SystemTests/tests/framework/CompareMDWorkspacesTest.py @@ -10,7 +10,8 @@ """ import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ChangeBinOffset, CompareMDWorkspaces, ConvertToMD, CreateSampleWorkspace, MergeMD class CompareMDWorkspacesTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/CompressEvents.py b/Testing/SystemTests/tests/framework/CompressEvents.py index 2d01ac651e64..6cc77a67cbe6 100644 --- a/Testing/SystemTests/tests/framework/CompressEvents.py +++ b/Testing/SystemTests/tests/framework/CompressEvents.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CompressEvents, Integration, LoadEventNexus, SumSpectra class CompressEventsTesting(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/ConvToMDCompareDefaultVsIndexing.py b/Testing/SystemTests/tests/framework/ConvToMDCompareDefaultVsIndexing.py index fd58df51732e..87537a0e5064 100644 --- a/Testing/SystemTests/tests/framework/ConvToMDCompareDefaultVsIndexing.py +++ b/Testing/SystemTests/tests/framework/ConvToMDCompareDefaultVsIndexing.py @@ -7,7 +7,8 @@ # pylint: disable=no-init import sys import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import BinMD, CompareMDWorkspaces, ConvertToMD, CreateSampleWorkspace class ConvToMDCompareDefaultVsIndexing(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/ConvertHFIRSCDtoMDETest.py b/Testing/SystemTests/tests/framework/ConvertHFIRSCDtoMDETest.py index 993ee2544d63..c2631562c4ed 100644 --- a/Testing/SystemTests/tests/framework/ConvertHFIRSCDtoMDETest.py +++ b/Testing/SystemTests/tests/framework/ConvertHFIRSCDtoMDETest.py @@ -7,7 +7,8 @@ import platform import systemtesting import numpy as np -from mantid.simpleapi import * +from mantid.api import AlgorithmManager +from mantid.simpleapi import ConvertHFIRSCDtoMDE, FindPeaksMD, HFIRCalculateGoniometer, IndexPeaks, Load, LoadMD, SaveMD, SetGoniometer def _skip_test(): diff --git a/Testing/SystemTests/tests/framework/ConvertToMDworkflow.py b/Testing/SystemTests/tests/framework/ConvertToMDworkflow.py index 563f4f9d77e5..57f0651419f7 100644 --- a/Testing/SystemTests/tests/framework/ConvertToMDworkflow.py +++ b/Testing/SystemTests/tests/framework/ConvertToMDworkflow.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import AlgorithmManager +from mantid.simpleapi import AddSampleLog, CloneWorkspace, ConvertToMD, DeleteWorkspace, Load, SaveMD, SetGoniometer, SetUB # ---------------------------------------------------------------------- diff --git a/Testing/SystemTests/tests/framework/ConvertWANDSCDtoQTest.py b/Testing/SystemTests/tests/framework/ConvertWANDSCDtoQTest.py index f66bc7943453..dd8eb243f9ff 100644 --- a/Testing/SystemTests/tests/framework/ConvertWANDSCDtoQTest.py +++ b/Testing/SystemTests/tests/framework/ConvertWANDSCDtoQTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + import systemtesting import numpy as np -from mantid.simpleapi import * +from mantid.api import AlgorithmManager +from mantid.simpleapi import ConvertWANDSCDtoQ, FindPeaksMD, IndexPeaks, Load, LoadMD, SaveMD, SetGoniometer, SetUB class ConvertWANDSCDtoQTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/CountReflectionsTest.py b/Testing/SystemTests/tests/framework/CountReflectionsTest.py index f6efa9798ad6..53afb0ea7273 100644 --- a/Testing/SystemTests/tests/framework/CountReflectionsTest.py +++ b/Testing/SystemTests/tests/framework/CountReflectionsTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import CountReflections from SortHKLTest import HKLStatisticsTestMixin diff --git a/Testing/SystemTests/tests/framework/D7AbsoluteCrossSectionsTest.py b/Testing/SystemTests/tests/framework/D7AbsoluteCrossSectionsTest.py index 02d0e4ce9461..9921261d2774 100644 --- a/Testing/SystemTests/tests/framework/D7AbsoluteCrossSectionsTest.py +++ b/Testing/SystemTests/tests/framework/D7AbsoluteCrossSectionsTest.py @@ -5,7 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import AppendSpectra, D7AbsoluteCrossSections, PolDiffILLReduction, RenameWorkspace import numpy as np diff --git a/Testing/SystemTests/tests/framework/D7YIGPositionCalibrationTest.py b/Testing/SystemTests/tests/framework/D7YIGPositionCalibrationTest.py index c10b4229f62c..c7a0e643ac5e 100644 --- a/Testing/SystemTests/tests/framework/D7YIGPositionCalibrationTest.py +++ b/Testing/SystemTests/tests/framework/D7YIGPositionCalibrationTest.py @@ -5,8 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * -from mantid.api import ITableWorkspace +from mantid.api import mtd, ITableWorkspace +from mantid.kernel import config, ConfigService +from mantid.simpleapi import CloneWorkspace, D7YIGPositionCalibration, DeleteWorkspace, Load, LoadILLPolarizedDiffraction import math import os.path diff --git a/Testing/SystemTests/tests/framework/DOSTest.py b/Testing/SystemTests/tests/framework/DOSTest.py index c29347a3b44c..3d43e97b2d60 100644 --- a/Testing/SystemTests/tests/framework/DOSTest.py +++ b/Testing/SystemTests/tests/framework/DOSTest.py @@ -6,9 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.kernel import * -from mantid.api import * -from mantid.simpleapi import * +from mantid.simpleapi import SimulatedDensityOfStates # ------------------------------------------------------------------------------------ diff --git a/Testing/SystemTests/tests/framework/Diffraction_Workflow_Test.py b/Testing/SystemTests/tests/framework/Diffraction_Workflow_Test.py index 5b8e6642b014..56e557fa9fd4 100644 --- a/Testing/SystemTests/tests/framework/Diffraction_Workflow_Test.py +++ b/Testing/SystemTests/tests/framework/Diffraction_Workflow_Test.py @@ -13,7 +13,22 @@ import systemtesting import numpy import os -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + AnvredCorrection, + BinMD, + CentroidPeaksMD, + CopySample, + ConvertToDiffractionMDWorkspace, + FindPeaksMD, + FindUBUsingFFT, + FindUBUsingLatticeParameters, + IndexPeaks, + IntegratePeaksMD, + LoadEventNexus, + LoadHKL, + SaveHKL, +) from mantid.api import FileFinder diff --git a/Testing/SystemTests/tests/framework/DirectILLAutoProcessTest.py b/Testing/SystemTests/tests/framework/DirectILLAutoProcessTest.py index 25fe7376c829..1efb339ceeb0 100644 --- a/Testing/SystemTests/tests/framework/DirectILLAutoProcessTest.py +++ b/Testing/SystemTests/tests/framework/DirectILLAutoProcessTest.py @@ -5,7 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import DirectILLAutoProcess, GroupWorkspaces, Load class DirectILLAuto_PANTHER_Powder_Test(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/DirectInelasticDiagnostic2.py b/Testing/SystemTests/tests/framework/DirectInelasticDiagnostic2.py index 1408bf26a85b..6cc9c1e88437 100644 --- a/Testing/SystemTests/tests/framework/DirectInelasticDiagnostic2.py +++ b/Testing/SystemTests/tests/framework/DirectInelasticDiagnostic2.py @@ -7,7 +7,8 @@ # pylint: disable=invalid-name,no-init import os from systemtesting import MantidSystemTest -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import pmds, DgsDiagnose, Load, MaskDetectors from mantid.kernel import PropertyManager from mantid import config diff --git a/Testing/SystemTests/tests/framework/DistributeProtonChargeTest.py b/Testing/SystemTests/tests/framework/DistributeProtonChargeTest.py index 49682b7e7a57..e1bccc25051a 100644 --- a/Testing/SystemTests/tests/framework/DistributeProtonChargeTest.py +++ b/Testing/SystemTests/tests/framework/DistributeProtonChargeTest.py @@ -9,7 +9,8 @@ System test for distributing proton charge using FilterEvents and FilterByTime """ -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ChangeLogTime, DeleteWorkspace, FilterByTime, FilterEvents, GenerateEventsFilter, LoadEventNexus import systemtesting import numpy as np import mantid.kernel as mk diff --git a/Testing/SystemTests/tests/framework/DrillProcessTest.py b/Testing/SystemTests/tests/framework/DrillProcessTest.py index 3bd5c8bbd2f9..c7008a0b4ddc 100644 --- a/Testing/SystemTests/tests/framework/DrillProcessTest.py +++ b/Testing/SystemTests/tests/framework/DrillProcessTest.py @@ -11,14 +11,14 @@ import sys import time -from qtpy.QtWidgets import QApplication, QFormLayout, QLineEdit, QComboBox +from qtpy.QtWidgets import QApplication, QFormLayout, QLineEdit, QCheckBox, QComboBox from qtpy.QtTest import QTest from qtpy.QtCore import Qt, QPoint from mantid.kernel import config from mantid.simpleapi import mtd, GroupWorkspaces -from mantidqtinterfaces.drill.view.DrillView import * -from mantidqtinterfaces.drill.view.DrillSettingsDialog import * +from mantidqtinterfaces.drill.view.DrillView import DrillView +from mantidqtinterfaces.drill.view.DrillSettingsDialog import DrillSettingsDialog app = QApplication(sys.argv) diff --git a/Testing/SystemTests/tests/framework/EQSANSBeamCenterAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSBeamCenterAPIv2.py index 09841b7c3fd5..f1afd6018a34 100644 --- a/Testing/SystemTests/tests/framework/EQSANSBeamCenterAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSBeamCenterAPIv2.py @@ -6,10 +6,20 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from mantid.api import * +from mantid import FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale -from reduction_workflow.instruments.sans.sns_command_interface import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + EQSANS, + IndependentBinning, + Reduce, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) from reduction_workflow.instruments.sans.hfir_command_interface import DirectBeamCenter, NoSolidAngle, SetTransmission import os diff --git a/Testing/SystemTests/tests/framework/EQSANSDarkCurrentAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSDarkCurrentAPIv2.py index 262fd41f5539..0fce2dec575d 100644 --- a/Testing/SystemTests/tests/framework/EQSANSDarkCurrentAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSDarkCurrentAPIv2.py @@ -6,10 +6,23 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * +from mantid import FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + EQSANS, + PerformFlightPathCorrection, + Reduce1D, + SetBeamCenter, + SetTOFTailsCutoff, + SolidAngle, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) from reduction_workflow.instruments.sans.hfir_command_interface import DarkCurrent, SetTransmission -from mantid.api import * import os diff --git a/Testing/SystemTests/tests/framework/EQSANSEffAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSEffAPIv2.py index 72d051b040bf..752aedb4f2e2 100644 --- a/Testing/SystemTests/tests/framework/EQSANSEffAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSEffAPIv2.py @@ -6,10 +6,21 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + EQSANS, + Reduce1D, + SetBeamCenter, + SolidAngle, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) from reduction_workflow.instruments.sans.hfir_command_interface import SensitivityCorrection, SetTransmission -from mantid.api import FileFinder +from mantid.api import mtd, FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale import os diff --git a/Testing/SystemTests/tests/framework/EQSANSFlatTestAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSFlatTestAPIv2.py index 4571cf828048..629d344fd70b 100644 --- a/Testing/SystemTests/tests/framework/EQSANSFlatTestAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSFlatTestAPIv2.py @@ -6,9 +6,34 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * -from reduction_workflow.instruments.sans.hfir_command_interface import * +from mantid.api import mtd +from mantid.kernel import ConfigService +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + AzimuthalAverage, + BckCombineTransmissionFits, + CombineTransmissionFits, + EQSANS, + PerformFlightPathCorrection, + Reduce1D, + SetBeamCenter, + SolidAngle, + TotalChargeNormalization, + UseConfigMask, + UseConfigTOFTailsCutoff, +) +from reduction_workflow.instruments.sans.hfir_command_interface import ( + Background, + BckDirectBeamTransmission, + BckThetaDependentTransmission, + DarkCurrent, + DirectBeamTransmission, + IQxQy, + SaveIqAscii, + SensitivityCorrection, + SetAbsoluteScale, + ThetaDependentTransmission, +) FILE_LOCATION = "/SNS/EQSANS/IPTS-5636/data/" diff --git a/Testing/SystemTests/tests/framework/EQSANSIQOutputAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSIQOutputAPIv2.py index 96115fee2af3..17d1ead8cb55 100644 --- a/Testing/SystemTests/tests/framework/EQSANSIQOutputAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSIQOutputAPIv2.py @@ -8,10 +8,25 @@ import systemtesting import math import os -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from mantid.api import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + BeamMonitorNormalization, + EQSANS, + NoSolidAngle, + Reduce1D, + Resolution, + SetBeamCenter, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) +from reduction_workflow.instruments.sans.hfir_command_interface import Background, SetTransmission + +from mantid.api import mtd, FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale + from functools import reduce diff --git a/Testing/SystemTests/tests/framework/EQSANSNormalisationAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSNormalisationAPIv2.py index c13960e0ad38..ee598c385ce6 100644 --- a/Testing/SystemTests/tests/framework/EQSANSNormalisationAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSNormalisationAPIv2.py @@ -6,9 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * -from mantid.api import * +from mantid.simpleapi import EQSANSLoad, EQSANSNormalise, SumSpectra +from mantid.api import mtd +from mantid.kernel import ConfigService import os diff --git a/Testing/SystemTests/tests/framework/EQSANSProcessedEffAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSProcessedEffAPIv2.py index a9665dd6371e..7fd342dcf248 100644 --- a/Testing/SystemTests/tests/framework/EQSANSProcessedEffAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSProcessedEffAPIv2.py @@ -6,10 +6,21 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + EQSANS, + Reduce1D, + SetBeamCenter, + SolidAngle, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) from reduction_workflow.instruments.sans.hfir_command_interface import SensitivityCorrection, SetTransmission from mantid.api import FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale import os diff --git a/Testing/SystemTests/tests/framework/EQSANSSolidAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSSolidAPIv2.py index 3f554b3aec7d..67dc6a904e13 100644 --- a/Testing/SystemTests/tests/framework/EQSANSSolidAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSSolidAPIv2.py @@ -6,10 +6,22 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from mantid.api import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + EQSANS, + Reduce1D, + SetBeamCenter, + SetTransmission, + SolidAngle, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) + +from mantid.api import mtd, FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale import os diff --git a/Testing/SystemTests/tests/framework/EQSANSTransAPIv2.py b/Testing/SystemTests/tests/framework/EQSANSTransAPIv2.py index 577099e0201d..842ee59535fc 100644 --- a/Testing/SystemTests/tests/framework/EQSANSTransAPIv2.py +++ b/Testing/SystemTests/tests/framework/EQSANSTransAPIv2.py @@ -6,10 +6,29 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.sns_command_interface import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from mantid.api import * +from reduction_workflow.instruments.sans.sns_command_interface import ( + AppendDataFile, + CombineTransmissionFits, + EQSANS, + Reduce1D, + SetBeamCenter, + SetTOFTailsCutoff, + SetTransmission, + SolidAngle, + TotalChargeNormalization, + UseConfig, + UseConfigMask, + UseConfigTOFTailsCutoff, +) +from reduction_workflow.instruments.sans.hfir_command_interface import ( + DarkCurrent, + DirectBeamTransmission, + NoIQxQy, + ThetaDependentTransmission, +) +from mantid.api import FileFinder +from mantid.kernel import ConfigService +from mantid.simpleapi import Scale import os diff --git a/Testing/SystemTests/tests/framework/FilterEventsWithHighFirstIndexSplitter.py b/Testing/SystemTests/tests/framework/FilterEventsWithHighFirstIndexSplitter.py index 9b11d57b9c70..5fd927b4ff99 100644 --- a/Testing/SystemTests/tests/framework/FilterEventsWithHighFirstIndexSplitter.py +++ b/Testing/SystemTests/tests/framework/FilterEventsWithHighFirstIndexSplitter.py @@ -10,7 +10,8 @@ with a high first target index. FilterEvents then shifts all target indexes down so that the output workspace names start from "_1". """ -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import DeleteWorkspace, FilterEvents, GenerateEventsFilter, LoadEventNexus import systemtesting diff --git a/Testing/SystemTests/tests/framework/FilteredLoadvsLoadThenFilter.py b/Testing/SystemTests/tests/framework/FilteredLoadvsLoadThenFilter.py index 2b7d83f6d8fb..2fb2a52b67a8 100644 --- a/Testing/SystemTests/tests/framework/FilteredLoadvsLoadThenFilter.py +++ b/Testing/SystemTests/tests/framework/FilteredLoadvsLoadThenFilter.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import FilterByTime, LoadEventNexus, RebinToWorkspace class FilteredLoadvsLoadThenFilter(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/FlatPlatePaalmanPingsCorrectionTest.py b/Testing/SystemTests/tests/framework/FlatPlatePaalmanPingsCorrectionTest.py index 003a5bd30916..155618f6dbb2 100644 --- a/Testing/SystemTests/tests/framework/FlatPlatePaalmanPingsCorrectionTest.py +++ b/Testing/SystemTests/tests/framework/FlatPlatePaalmanPingsCorrectionTest.py @@ -5,7 +5,8 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CompareWorkspaces, ConvertUnits, FlatPlatePaalmanPingsCorrection, LoadNexus, LoadNexusProcessed class FlatPlatePaalmanPingsCorrectionTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/HFIRBackgroundAPIv2.py b/Testing/SystemTests/tests/framework/HFIRBackgroundAPIv2.py index f2f96ec854d3..44784b0f015a 100644 --- a/Testing/SystemTests/tests/framework/HFIRBackgroundAPIv2.py +++ b/Testing/SystemTests/tests/framework/HFIRBackgroundAPIv2.py @@ -6,9 +6,19 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from reduction_workflow.command_interface import AppendDataFile, Reduce1D +from reduction_workflow.instruments.sans.hfir_command_interface import ( + AzimuthalAverage, + Background, + BckBeamSpreaderTransmission, + BckDirectBeamTransmission, + BckTransmissionDarkCurrent, + GPSANS, + SetBeamCenter, + SetBckTransmission, + SetSampleDetectorDistance, +) +from reduction_workflow.command_interface import AppendDataFile, DataPath, Reduce1D +from mantid.kernel import ConfigService class HFIRBackground(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/HFIREffAPIv2.py b/Testing/SystemTests/tests/framework/HFIREffAPIv2.py index f254b4ee0664..1e324299e0e7 100644 --- a/Testing/SystemTests/tests/framework/HFIREffAPIv2.py +++ b/Testing/SystemTests/tests/framework/HFIREffAPIv2.py @@ -6,9 +6,19 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from reduction_workflow.command_interface import AppendDataFile, Reduce1D +from reduction_workflow.instruments.sans.hfir_command_interface import ( + AzimuthalAverage, + DirectBeamCenter, + GPSANS, + SensitivityCorrection, + SensitivityDirectBeamCenter, + SensitivityScatteringBeamCenter, + SetSampleDetectorDistance, + SetTransmission, +) +from reduction_workflow.command_interface import AppendDataFile, DataPath, Reduce1D + +from mantid.kernel import ConfigService class HFIREffAPIv2(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/HFIRReductionAPIv2.py b/Testing/SystemTests/tests/framework/HFIRReductionAPIv2.py index 0295df815313..15f1a170285a 100644 --- a/Testing/SystemTests/tests/framework/HFIRReductionAPIv2.py +++ b/Testing/SystemTests/tests/framework/HFIRReductionAPIv2.py @@ -6,9 +6,22 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from reduction_workflow.command_interface import AppendDataFile, Reduce +from reduction_workflow.instruments.sans.hfir_command_interface import ( + AzimuthalAverage, + DirectBeamCenter, + GPSANS, + MonitorNormalization, + SensitivityCorrection, + SetAbsoluteScale, + SetBeamCenter, + SetDirectBeamAbsoluteScale, + SetSampleDetectorDistance, + SetTransmission, + SolidAngle, +) +from reduction_workflow.command_interface import AppendDataFile, DataPath, Reduce + +from mantid.kernel import ConfigService class HFIRReductionAPIv2(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/HFIRTestsAPIv2.py b/Testing/SystemTests/tests/framework/HFIRTestsAPIv2.py index b47d298f1028..b46e0447f057 100644 --- a/Testing/SystemTests/tests/framework/HFIRTestsAPIv2.py +++ b/Testing/SystemTests/tests/framework/HFIRTestsAPIv2.py @@ -17,13 +17,43 @@ from functools import reduce import math from pathlib import PurePath +import sys import traceback import types import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from reduction_workflow.command_interface import AppendDataFile, Reduce, Reduce1D +from reduction_workflow.instruments.sans.hfir_command_interface import ( + AzimuthalAverage, + Background, + BckDirectBeamTransmission, + BckThetaDependentTransmission, + BckTransmissionDirectBeamCenter, + BeamSpreaderTransmission, + BIOSANS, + DarkCurrent, + DirectBeamCenter, + DirectBeamTransmission, + DivideByThickness, + GPSANS, + IQxQy, + MonitorNormalization, + NoSolidAngle, + SensitivityCorrection, + SetBckTransmission, + SetBckTransmissionBeamCenter, + SetBeamCenter, + SetSampleDetectorDistance, + SetSampleDetectorOffset, + SetTransmission, + SetTransmissionBeamCenter, + SetWavelength, + ThetaDependentTransmission, + TimeNormalization, +) +from reduction_workflow.command_interface import AppendDataFile, DataPath, Reduce, Reduce1D, ReductionSingleton + +from mantid.api import mtd, AnalysisDataService, FileFinder +from mantid.kernel import PropertyManagerDataService def _diff_iq(x, y): diff --git a/Testing/SystemTests/tests/framework/HFIRTransAPIv2.py b/Testing/SystemTests/tests/framework/HFIRTransAPIv2.py index 2a0b81442e7e..95849eb96eed 100644 --- a/Testing/SystemTests/tests/framework/HFIRTransAPIv2.py +++ b/Testing/SystemTests/tests/framework/HFIRTransAPIv2.py @@ -6,9 +6,22 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * -from reduction_workflow.instruments.sans.hfir_command_interface import * -from reduction_workflow.command_interface import AppendDataFile, Reduce1D +from reduction_workflow.instruments.sans.hfir_command_interface import ( + AzimuthalAverage, + BeamSpreaderTransmission, + DirectBeamCenter, + DirectBeamTransmission, + GPSANS, + SetSampleDetectorDistance, + SetTransmission, + SetTransmissionBeamCenter, + TimeNormalization, + TransmissionDarkCurrent, + TransmissionDirectBeamCenter, +) +from reduction_workflow.command_interface import AppendDataFile, DataPath, Reduce1D + +from mantid.kernel import ConfigService class HFIRTrans1(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/HYSPECReductionTest.py b/Testing/SystemTests/tests/framework/HYSPECReductionTest.py index 648f6a9a90d4..3b7a0ff27167 100644 --- a/Testing/SystemTests/tests/framework/HYSPECReductionTest.py +++ b/Testing/SystemTests/tests/framework/HYSPECReductionTest.py @@ -9,7 +9,23 @@ System test for HYSPEC reduction """ -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import ( + BinMD, + CompressEvents, + ConvertMDHistoToMatrixWorkspace, + ConvertToMD, + DeleteWorkspace, + DgsReduction, + FilterByLogValue, + FilterEvents, + GenerateEventsFilter, + GenerateGroupingSNSInelastic, + Load, + MergeMD, + SetGoniometer, + SetUB, +) import os import systemtesting diff --git a/Testing/SystemTests/tests/framework/ILLPowderDetectorScanTest.py b/Testing/SystemTests/tests/framework/ILLPowderDetectorScanTest.py index 6bd2a11ba368..c29d2c7f49fb 100644 --- a/Testing/SystemTests/tests/framework/ILLPowderDetectorScanTest.py +++ b/Testing/SystemTests/tests/framework/ILLPowderDetectorScanTest.py @@ -5,7 +5,17 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import ( + CompareWorkspaces, + CropWorkspace, + ExtractSpectra, + LoadILLDiffraction, + MaskDetectors, + PowderILLDetectorScan, + SumOverlappingTubes, +) # A dummy test class to subclass from. diff --git a/Testing/SystemTests/tests/framework/ILLSANSMultiProcessTest.py b/Testing/SystemTests/tests/framework/ILLSANSMultiProcessTest.py index e35558bc2423..51a7daca9814 100644 --- a/Testing/SystemTests/tests/framework/ILLSANSMultiProcessTest.py +++ b/Testing/SystemTests/tests/framework/ILLSANSMultiProcessTest.py @@ -5,7 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import SANSILLMultiProcess class ILL_SANS_D11B_MONO_MULTI_TEST(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/INTERLoadingTest.py b/Testing/SystemTests/tests/framework/INTERLoadingTest.py index 4ef5bcf705ac..708603698baa 100644 --- a/Testing/SystemTests/tests/framework/INTERLoadingTest.py +++ b/Testing/SystemTests/tests/framework/INTERLoadingTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from LoadAndCheckBase import * +from LoadAndCheckBase import LoadAndCheckBase # # Test File loading and basic data integrity checks of INTER data in Mantid. diff --git a/Testing/SystemTests/tests/framework/INTERReductionTest.py b/Testing/SystemTests/tests/framework/INTERReductionTest.py index 942f8d1a1a4c..9e1624835fc6 100644 --- a/Testing/SystemTests/tests/framework/INTERReductionTest.py +++ b/Testing/SystemTests/tests/framework/INTERReductionTest.py @@ -9,7 +9,28 @@ Adapted from scripts provided by Max Skoda. """ -from ISISReflectometryWorkflowBase import * +from ISISReflectometryWorkflowBase import ( + ISISReflectometryWorkflowBase, + removeWorkspaces, + setupInstrument, + stitchTransmissionWorkspaces, + stitchedWorkspaceName, +) +from mantid.api import mtd +from mantid.kernel import logger +from mantid.simpleapi import ( + AppendSpectra, + CloneWorkspace, + DeleteWorkspace, + FilterByTime, + Fit, + NRCalculateSlitResolution, + SaveNexus, + Scale, + Stitch1DMany, + Rebin, + ReflectometryISISLoadAndProcess, +) import systemtesting diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriod.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriod.py index 250ed8300eec..0f03e5020c18 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriod.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriod.py @@ -10,8 +10,7 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest from mantid.api import AnalysisDataService -from ISISCommandInterface import * -from SANSBatchMode import * +from ISISCommandInterface import AssignSample, Detector, LARMOR, MaskFile, Set1D from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriodAddFiles.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriodAddFiles.py index 9cfe0131b27c..1574c76a7eff 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriodAddFiles.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LARMOR/SANSLARMORMultiPeriodAddFiles.py @@ -5,12 +5,15 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init +import os import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest +from mantid.kernel import config from mantid.simpleapi import DeleteWorkspace -from ISISCommandInterface import * +from ISISCommandInterface import AssignSample, DefaultTrans, Detector, Gravity, LARMOR, MaskFile, Set1D, WavRangeReduction from sans.common.enums import SANSInstrument +from SANSadd2 import add_runs @ISISSansSystemTest(SANSInstrument.LARMOR) diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/LOQReloadWorkspaces.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/LOQReloadWorkspaces.py index 75cb6870edb1..6cd51c3b6fef 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/LOQReloadWorkspaces.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/LOQReloadWorkspaces.py @@ -7,8 +7,30 @@ # pylint: disable=invalid-name,no-init import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from ISISCommandInterface import * -from mantid.simpleapi import LoadRaw, MoveInstrumentComponent +from ISISCommandInterface import ( + AssignCan, + AssignSample, + DefaultTrans, + Detector, + FindBeamCentre, + Gravity, + LimitsWav, + LOQ, + MaskFile, + Reduce, + ReductionSingleton, + Set1D, + Set2D, + SetCentre, + SetDetectorOffsets, + TransFit, + TransmissionCan, + TransmissionSample, + WavRangeReduction, +) +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import Load, LoadRaw, MoveInstrumentComponent, RenameWorkspace import unittest from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQAddBatch.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQAddBatch.py index d7095eb490f4..3fbe16220210 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQAddBatch.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQAddBatch.py @@ -7,7 +7,7 @@ # pylint: disable=no-init,invalid-name,attribute-defined-outside-init import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.simpleapi import Load from mantid.api import FileFinder from mantid import config import ISISCommandInterface as ici diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQBatch.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQBatch.py index dee256d8cfab..7d58267556e2 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQBatch.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQBatch.py @@ -8,10 +8,10 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from mantid import config -from ISISCommandInterface import * -from SANSBatchMode import * +from mantid.simpleapi import LoadNexus, Plus +from mantid import config, FileFinder +from ISISCommandInterface import Detector, Gravity, LOQ, MaskFile, Set1D +from SANSBatchMode import BatchReduce import os.path from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCan2D.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCan2D.py index 0be230047268..666ce8d9c8aa 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCan2D.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCan2D.py @@ -8,8 +8,7 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import AssignCan, AssignSample, Detector, Gravity, LOQ, MaskFile, Set2D, SetDetectorOffsets, WavRangeReduction # Test is giving odd results on Linux, but only this 2D one. from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCentreNoGrav.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCentreNoGrav.py index 6c4c80fca6fb..536edefba6ce 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCentreNoGrav.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQCentreNoGrav.py @@ -7,8 +7,21 @@ # pylint: disable=no-init import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import ( + AssignCan, + AssignSample, + DefaultTrans, + Detector, + FindBeamCentre, + Gravity, + LOQ, + MaskFile, + Set1D, + SetCentre, + TransmissionCan, + TransmissionSample, + WavRangeReduction, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQReductionGUI.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQReductionGUI.py index 93fa4572c5c4..47efe78ace60 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQReductionGUI.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQReductionGUI.py @@ -8,7 +8,8 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.kernel import config import ISISCommandInterface as i from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQTransFitWorkspace2D.py b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQTransFitWorkspace2D.py index 1dcccf4285c4..106f600d3461 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQTransFitWorkspace2D.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/LOQ/SANSLOQTransFitWorkspace2D.py @@ -8,8 +8,22 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from mantid.simpleapi import DeleteWorkspace, RenameWorkspace +from ISISCommandInterface import ( + AssignCan, + AssignSample, + Detector, + Gravity, + LimitsWav, + LOQ, + MaskFile, + Set2D, + TransFit, + TransmissionCan, + TransmissionSample, + TransWorkspace, + WavRangeReduction, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DBatch.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DBatch.py index 6b6aff0d9918..11172fabd438 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DBatch.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DBatch.py @@ -8,10 +8,11 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * -from mantid import config -from SANSBatchMode import * +from mantid.api import mtd, FileFinder +from mantid.kernel import config +from mantid.simpleapi import DeleteWorkspace, Load +from ISISCommandInterface import Detector, Gravity, MaskFile, SANS2D, SANS2DTUBES, Set1D +from SANSBatchMode import BatchReduce import os.path # test batch mode with sans2d and selecting a period in batch mode diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DFrontNoGrav.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DFrontNoGrav.py index a556a5fabfee..0eb83eee55ef 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DFrontNoGrav.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DFrontNoGrav.py @@ -8,7 +8,7 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from ISISCommandInterface import * +from ISISCommandInterface import AssignSample, Gravity, MaskFile, SANS2D, Set1D, SetDetectorOffsets, WavRangeReduction from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DLimitEventsTime.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DLimitEventsTime.py index ee47700fa651..3861561288a6 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DLimitEventsTime.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DLimitEventsTime.py @@ -8,8 +8,7 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import AssignSample, MaskFile, SANS2D, WavRangeReduction from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriod.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriod.py index 5102e543e1e0..10815220fb0e 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriod.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriod.py @@ -9,9 +9,10 @@ # test batch mode with sans2d and selecting a period in batch mode import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from ISISCommandInterface import * -from SANSBatchMode import * +from ISISCommandInterface import AssignSample, Detector, Gravity, MaskFile, SANS2D, Set1D, WavRangeReduction +from SANSBatchMode import BatchReduce from sans.common.enums import SANSInstrument +from mantid.api import mtd, FileFinder @ISISSansSystemTest(SANSInstrument.SANS2D) diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriodAddFiles.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriodAddFiles.py index 451da59c7a6e..92ec7d1a4428 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriodAddFiles.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DMultiPeriodAddFiles.py @@ -5,12 +5,14 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init +import os import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest from mantid import config -from ISISCommandInterface import * +from ISISCommandInterface import AssignSample, DefaultTrans, Detector, Gravity, MaskFile, SANS2D, Set1D, WavRangeReduction from sans.common.enums import SANSInstrument +from SANSadd2 import add_runs @ISISSansSystemTest(SANSInstrument.SANS2D) diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUI.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUI.py index 3f95447a0b55..553d7bfd7302 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUI.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUI.py @@ -21,7 +21,9 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.kernel import config +from mantid.simpleapi import RenameWorkspace import isis_reducer import ISISCommandInterface as i import isis_instrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUIAdded.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUIAdded.py index 895a7b78a2c3..89ea19ae4613 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUIAdded.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReductionGUIAdded.py @@ -6,9 +6,12 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import DeleteWorkspace, RenameWorkspace import ISISCommandInterface as i import copy +import os import SANS2DReductionGUI as sansgui from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReloadWorkspaces.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReloadWorkspaces.py index 988612101448..921a65d5b8a4 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReloadWorkspaces.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DReloadWorkspaces.py @@ -7,8 +7,24 @@ # pylint: disable=invalid-name,no-init import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import CloneWorkspace, LoadNexus, MoveInstrumentComponent -from ISISCommandInterface import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import CloneWorkspace, Load, LoadNexus, MoveInstrumentComponent, RenameWorkspace +from ISISCommandInterface import ( + AssignCan, + AssignSample, + CompWavRanges, + Gravity, + MaskFile, + Reduce, + ReductionSingleton, + SANS2D, + Set1D, + SetDetectorOffsets, + TransmissionCan, + TransmissionSample, + WavRangeReduction, +) import unittest from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DWaveloops.py b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DWaveloops.py index 9bc004c87628..1ce287c99c08 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DWaveloops.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/SANS2D/SANS2DWaveloops.py @@ -8,8 +8,17 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import ( + AssignCan, + AssignSample, + CompWavRanges, + Gravity, + MaskFile, + SANS2D, + Set1D, + TransmissionCan, + TransmissionSample, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSCentreSample.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSCentreSample.py index d82138c9babc..887b50a3426f 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSCentreSample.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSCentreSample.py @@ -8,8 +8,14 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import ( + AssignSample, + Detector, + FindBeamCentre, + MaskFile, + SANS2D, + Set1D, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSDarkRunSubtractionTest.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSDarkRunSubtractionTest.py index d5d54ca5a14e..eba4f9a5433e 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSDarkRunSubtractionTest.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSDarkRunSubtractionTest.py @@ -11,11 +11,13 @@ import unittest import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.api import AlgorithmManager +from mantid.kernel import config from isis_reduction_steps import DarkRunSubtraction from SANSUserFileParser import DarkRunSettings from SANSUtility import getFileAndName import numpy as np +import os from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSFileChecking.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSFileChecking.py index 5a37314dfd89..5926d698dfc1 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSFileChecking.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSFileChecking.py @@ -13,10 +13,21 @@ import unittest import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.api import ExperimentInfo +from mantid.kernel import config import SANSUtility as su import os -from ISISCommandInterface import * +from ISISCommandInterface import ( + AssignSample, + Clean, + LARMOR, + LOQ, + MaskFile, + ReductionSingleton, + SANS2D, + SANS2DTUBES, + Set1D, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSLoadersTest.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSLoadersTest.py index 1eed0f3e1ff2..98fe472d5491 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSLoadersTest.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSLoadersTest.py @@ -11,10 +11,12 @@ currently available inside the systemtests. """ +import os import unittest import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import Load import isis_reduction_steps as steps import ISISCommandInterface as ici from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSQResolutionTest.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSQResolutionTest.py index 92b64c096e94..724c665cfff1 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSQResolutionTest.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSQResolutionTest.py @@ -8,8 +8,25 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * -from ISISCommandInterface import * +from ISISCommandInterface import ( + set_q_resolution_a1, + set_q_resolution_a2, + set_q_resolution_collimation_length, + set_q_resolution_delta_r, + set_q_resolution_h1, + set_q_resolution_h2, + set_q_resolution_moderator, + set_q_resolution_use, + set_q_resolution_w1, + set_q_resolution_w2, + AssignSample, + Gravity, + MaskFile, + SANS2D, + Set1D, + SetDetectorOffsets, + WavRangeReduction, +) from sans.common.enums import SANSInstrument diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSUtilityTest.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSUtilityTest.py index 3a0d159973d9..06a2ba979d6f 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSUtilityTest.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSUtilityTest.py @@ -8,7 +8,8 @@ import systemtesting from ISIS.SANS.isis_sans_system_test import ISISSansSystemTest -from mantid.simpleapi import * +from mantid.kernel import logger +from mantid.simpleapi import Load import SANSUtility as su import SANSadd2 as add diff --git a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSWorkspaceTypeTest.py b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSWorkspaceTypeTest.py index f44d228ac341..eb2e61b40d3b 100644 --- a/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSWorkspaceTypeTest.py +++ b/Testing/SystemTests/tests/framework/ISIS/SANS/WORKFLOWS/SANSWorkspaceTypeTest.py @@ -6,7 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import CreateSampleWorkspace, DeleteWorkspace, SaveNexusProcessed from SANSUtility import can_load_as_event_workspace import os diff --git a/Testing/SystemTests/tests/framework/ISISDirectInelastic.py b/Testing/SystemTests/tests/framework/ISISDirectInelastic.py index 699f6da47411..d396e7b5f644 100644 --- a/Testing/SystemTests/tests/framework/ISISDirectInelastic.py +++ b/Testing/SystemTests/tests/framework/ISISDirectInelastic.py @@ -6,7 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.kernel import config +from mantid.simpleapi import RenameWorkspace from mantid.api import Workspace import os import shutil diff --git a/Testing/SystemTests/tests/framework/ISISDirectReductionComponents.py b/Testing/SystemTests/tests/framework/ISISDirectReductionComponents.py index bf729bbedd7e..aa6389ead302 100644 --- a/Testing/SystemTests/tests/framework/ISISDirectReductionComponents.py +++ b/Testing/SystemTests/tests/framework/ISISDirectReductionComponents.py @@ -8,7 +8,9 @@ import os import sys import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd, FileFinder +from mantid.kernel import config +from mantid.simpleapi import DeleteWorkspace, GetAllEi, Load from mantid.api import Workspace, IEventWorkspace from Direct.PropertyManager import PropertyManager diff --git a/Testing/SystemTests/tests/framework/ISISIndirectBayesTest.py b/Testing/SystemTests/tests/framework/ISISIndirectBayesTest.py index 200fd45c6adf..a0109153a5f0 100644 --- a/Testing/SystemTests/tests/framework/ISISIndirectBayesTest.py +++ b/Testing/SystemTests/tests/framework/ISISIndirectBayesTest.py @@ -9,7 +9,9 @@ import os import warnings -from mantid.simpleapi import * +from mantid.api import AnalysisDataService +from mantid.kernel import config +from mantid.simpleapi import BayesStretch, BayesQuasi, ExtractSingleSpectrum, Fit, LoadNexusProcessed, Scale from sys import platform import systemtesting diff --git a/Testing/SystemTests/tests/framework/ISISIndirectInelastic.py b/Testing/SystemTests/tests/framework/ISISIndirectInelastic.py index 908745089ebb..5e2f01b781d5 100644 --- a/Testing/SystemTests/tests/framework/ISISIndirectInelastic.py +++ b/Testing/SystemTests/tests/framework/ISISIndirectInelastic.py @@ -73,12 +73,31 @@ | """ +import os from abc import ABCMeta, abstractmethod -from mantid.simpleapi import * +from mantid.api import mtd, FileFinder +from mantid.kernel import config +from mantid.simpleapi import ( + ConvolutionFitSequential, + DeleteWorkspace, + ElasticWindowMultiple, + GroupWorkspaces, + IndirectCalibration, + IndirectResolution, + IndirectTransmissionMonitor, + ISISIndirectEnergyTransfer, + IqtFitMultiple, + IqtFitSequential, + Load, + LoadNexus, + MSDFit, + SaveNexusProcessed, + SofQWMoments, + TimeSlice, + TransformToIqt, +) -# For debugging only. -from mantid.api import FileFinder from systemtesting import MantidSystemTest, using_gsl_v1 diff --git a/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py b/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py index 0222e1935194..ff370ae98f05 100644 --- a/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py +++ b/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py @@ -7,7 +7,8 @@ # pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import math import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import AsymmetryCalc, CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, LoadMuonNexus, Rebin from abc import ABCMeta, abstractmethod diff --git a/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py b/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py index f6e7cef09128..3fde45c082e1 100644 --- a/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py +++ b/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, LoadMuonNexus, Logarithm, RemoveExpDecay from abc import ABCMeta, abstractmethod diff --git a/Testing/SystemTests/tests/framework/ISISReflInstrumentIDFTest.py b/Testing/SystemTests/tests/framework/ISISReflInstrumentIDFTest.py index 251f0be6c65b..e7ec25209415 100644 --- a/Testing/SystemTests/tests/framework/ISISReflInstrumentIDFTest.py +++ b/Testing/SystemTests/tests/framework/ISISReflInstrumentIDFTest.py @@ -10,7 +10,8 @@ """ import systemtesting -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import LoadEmptyInstrument import os from abc import ABCMeta, abstractmethod diff --git a/Testing/SystemTests/tests/framework/ISISReflectometryAutoreductionTest.py b/Testing/SystemTests/tests/framework/ISISReflectometryAutoreductionTest.py index 6ce00fb50945..2150e4537840 100644 --- a/Testing/SystemTests/tests/framework/ISISReflectometryAutoreductionTest.py +++ b/Testing/SystemTests/tests/framework/ISISReflectometryAutoreductionTest.py @@ -9,13 +9,21 @@ Adapted from scripts provided by Max Skoda. """ -from ISISReflectometryWorkflowBase import * +from ISISReflectometryWorkflowBase import ( + ISISReflectometryWorkflowBase, + setupInstrument, + stitchedTransmissionWorkspaceName, + stitchTransmissionWorkspaces, + transmissionWorkspaceName, +) import re import itertools import math import systemtesting from operator import itemgetter -from mantid.simpleapi import * +from mantid.api import mtd, AnalysisDataService +from mantid.kernel import logger +from mantid.simpleapi import CreateTransmissionWorkspaceAuto, NRCalculateSlitResolution, SaveNexus, ReflectometryISISLoadAndProcess from isis_reflectometry.combineMulti import combineDataMulti, getWorkspace @@ -280,5 +288,5 @@ def SortRuns(tupsort): def CreateTransmissionWorkspaces(run1, run2, scale=False): - CreateTransmissionWorkspaceAuto(run1, OutputWorkspace=TransmissionWorkspaceName(run1), StartOverlap=10, EndOverlap=12) - CreateTransmissionWorkspaceAuto(run2, OutputWorkspace=TransmissionWorkspaceName(run2), StartOverlap=10, EndOverlap=12) + CreateTransmissionWorkspaceAuto(run1, OutputWorkspace=transmissionWorkspaceName(run1), StartOverlap=10, EndOverlap=12) + CreateTransmissionWorkspaceAuto(run2, OutputWorkspace=transmissionWorkspaceName(run2), StartOverlap=10, EndOverlap=12) diff --git a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowBase.py b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowBase.py index 5e3487b7b052..fa52f2ff30f9 100644 --- a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowBase.py +++ b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowBase.py @@ -9,8 +9,20 @@ Adapted from scripts provided by Max Skoda. """ -from mantid.simpleapi import * -from mantid import ConfigService +import os +import re + +from mantid.api import mtd, AlgorithmManager, AnalysisDataService, CatalogManager +from mantid.kernel import ConfigService +from mantid.simpleapi import ( + CreateTransmissionWorkspaceAuto, + DeleteWorkspace, + GroupWorkspaces, + Load, + LoadEventNexus, + ReflectometryISISLoadAndProcess, + SaveNexus, +) class ISISReflectometryWorkflowBase: diff --git a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowPreprocessingTest.py b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowPreprocessingTest.py index d67952c58718..826f58c04d02 100644 --- a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowPreprocessingTest.py +++ b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowPreprocessingTest.py @@ -9,7 +9,8 @@ Adapted from scripts provided by Max Skoda. """ -from ISISReflectometryWorkflowBase import * +from ISISReflectometryWorkflowBase import reduceRun, setupInstrument, ISISReflectometryWorkflowBase +from mantid.simpleapi import SaveNexus import systemtesting diff --git a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowSlicingTest.py b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowSlicingTest.py index 32d95eb125dc..03d9a8d33cf7 100644 --- a/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowSlicingTest.py +++ b/Testing/SystemTests/tests/framework/ISISReflectometryWorkflowSlicingTest.py @@ -4,7 +4,8 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + -from ISISReflectometryWorkflowBase import * +from ISISReflectometryWorkflowBase import reduceRun, setupInstrument, ISISReflectometryWorkflowBase +from mantid.simpleapi import DeleteWorkspace, SaveNexus import systemtesting diff --git a/Testing/SystemTests/tests/framework/ISIS_LETReduction.py b/Testing/SystemTests/tests/framework/ISIS_LETReduction.py index 58182c50025c..dfe82f56bec7 100644 --- a/Testing/SystemTests/tests/framework/ISIS_LETReduction.py +++ b/Testing/SystemTests/tests/framework/ISIS_LETReduction.py @@ -7,7 +7,12 @@ # pylint: disable=invalid-name """Sample LET reduction script""" -from Direct.ReductionWrapper import * +from Direct.AbsorptionShapes import Cylinder +from Direct.DirectEnergyConversion import DirectEnergyConversion +from Direct.ReductionWrapper import AdvancedProperties, iliad, MainProperties, MethodType, ReductionWrapper +from mantid.api import mtd +from mantid.kernel import config, PropertyManager +from mantid.simpleapi import ConjoinWorkspaces, LoadEventNexus, LoadRaw, Rebin, RenameWorkspace try: import reduce_vars as web_var diff --git a/Testing/SystemTests/tests/framework/ISIS_MAPS_DGSReduction.py b/Testing/SystemTests/tests/framework/ISIS_MAPS_DGSReduction.py index 7b4e75523aee..3f421112a2f1 100644 --- a/Testing/SystemTests/tests/framework/ISIS_MAPS_DGSReduction.py +++ b/Testing/SystemTests/tests/framework/ISIS_MAPS_DGSReduction.py @@ -7,7 +7,10 @@ # pylint: disable=invalid-name """Sample MAPS reduction scrip""" -from Direct.ReductionWrapper import * +from Direct.AbsorptionShapes import Cylinder +from Direct.DirectEnergyConversion import DirectEnergyConversion +from Direct.ReductionWrapper import AdvancedProperties, iliad, MainProperties, MethodType, ReductionWrapper +from mantid.kernel import config, PropertyManager try: import reduce_vars as web_var diff --git a/Testing/SystemTests/tests/framework/ISIS_MERLINReduction.py b/Testing/SystemTests/tests/framework/ISIS_MERLINReduction.py index 25a7bb8af0a3..cc011c77c576 100644 --- a/Testing/SystemTests/tests/framework/ISIS_MERLINReduction.py +++ b/Testing/SystemTests/tests/framework/ISIS_MERLINReduction.py @@ -7,7 +7,10 @@ # pylint: disable=invalid-name """Sample MERLIN reduction scrip""" -from Direct.ReductionWrapper import * +from Direct.AbsorptionShapes import Cylinder +from Direct.DirectEnergyConversion import DirectEnergyConversion +from Direct.ReductionWrapper import AdvancedProperties, iliad, MainProperties, MethodType, ReductionWrapper +from mantid.kernel import PropertyManager try: import reduce_vars as web_var diff --git a/Testing/SystemTests/tests/framework/ISIS_MariReduction.py b/Testing/SystemTests/tests/framework/ISIS_MariReduction.py index b72faa1fef33..6b6b3e0ab80d 100644 --- a/Testing/SystemTests/tests/framework/ISIS_MariReduction.py +++ b/Testing/SystemTests/tests/framework/ISIS_MariReduction.py @@ -9,8 +9,11 @@ import os -# -from Direct.ReductionWrapper import * +from Direct.AbsorptionShapes import Cylinder +from Direct.DirectEnergyConversion import DirectEnergyConversion +from Direct.ReductionWrapper import AdvancedProperties, iliad, MainProperties, MethodType, ReductionWrapper +from mantid.kernel import PropertyManager +from mantid.simpleapi import AddTimeSeriesLog, Load try: import reduce_vars as web_var diff --git a/Testing/SystemTests/tests/framework/L2QScriptTest.py b/Testing/SystemTests/tests/framework/L2QScriptTest.py index 5f7a21aab13e..e51ce8f5a1a4 100644 --- a/Testing/SystemTests/tests/framework/L2QScriptTest.py +++ b/Testing/SystemTests/tests/framework/L2QScriptTest.py @@ -7,8 +7,8 @@ # pylint: disable=no-init,invalid-name import systemtesting -from mantid.simpleapi import * -from isis_reflectometry.l2q import * +from mantid.simpleapi import ConvertUnits, Load +from isis_reflectometry.l2q import l2q class L2QScriptTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LRPrimaryFractionTest.py b/Testing/SystemTests/tests/framework/LRPrimaryFractionTest.py index 4a36683b1984..4ce79e92ac07 100644 --- a/Testing/SystemTests/tests/framework/LRPrimaryFractionTest.py +++ b/Testing/SystemTests/tests/framework/LRPrimaryFractionTest.py @@ -6,8 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid import * -from mantid.simpleapi import * +from mantid.api import mtd, FileFinder +from mantid.kernel import logger +from mantid.simpleapi import CreateSingleValuedWorkspace, Divide, LoadEventNexus, LiquidsReflectometryReduction, LRPrimaryFraction class LRPrimaryFractionTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LRReductionWithReferenceTest.py b/Testing/SystemTests/tests/framework/LRReductionWithReferenceTest.py index 7dfeb00ae388..f110d0eaa63e 100644 --- a/Testing/SystemTests/tests/framework/LRReductionWithReferenceTest.py +++ b/Testing/SystemTests/tests/framework/LRReductionWithReferenceTest.py @@ -8,9 +8,8 @@ import json import systemtesting -from mantid import * - -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.simpleapi import LRReductionWithReference class LRReductionWithRefrenceTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LRScalingFactorsTest.py b/Testing/SystemTests/tests/framework/LRScalingFactorsTest.py index f85f0694f532..559ae3ff67c3 100644 --- a/Testing/SystemTests/tests/framework/LRScalingFactorsTest.py +++ b/Testing/SystemTests/tests/framework/LRScalingFactorsTest.py @@ -7,8 +7,8 @@ # pylint: disable=no-init,attribute-defined-outside-init import systemtesting import os -from mantid import * -from mantid.simpleapi import * +from mantid.kernel import config, logger +from mantid.simpleapi import LRScalingFactors class LRPrimaryFractionTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LagrangeILLReductionTest.py b/Testing/SystemTests/tests/framework/LagrangeILLReductionTest.py index 9f74ddbcccbc..ba369347d826 100644 --- a/Testing/SystemTests/tests/framework/LagrangeILLReductionTest.py +++ b/Testing/SystemTests/tests/framework/LagrangeILLReductionTest.py @@ -5,7 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import LagrangeILLReduction class ILL_Lagrange_ASCII_Test(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LinkedUBs_Test.py b/Testing/SystemTests/tests/framework/LinkedUBs_Test.py index 1d0029062fad..95af391b4019 100644 --- a/Testing/SystemTests/tests/framework/LinkedUBs_Test.py +++ b/Testing/SystemTests/tests/framework/LinkedUBs_Test.py @@ -7,7 +7,8 @@ # pylint: disable=invalid-name,no-init # System test that loads short SXD numors and runs LinkedUBs. import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import FindSXPeaks, LinkedUBs, LoadRaw, PredictPeaks, SetGoniometer, SetUB import numpy as np diff --git a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionNoScalingTest.py b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionNoScalingTest.py index 57df51d22b68..d30d63d7b0b5 100644 --- a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionNoScalingTest.py +++ b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionNoScalingTest.py @@ -6,9 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid import * - -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.simpleapi import LiquidsReflectometryReduction class ApplyScalingFactorTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionTest.py b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionTest.py index 8a044434aede..7125d3008840 100644 --- a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionTest.py +++ b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionTest.py @@ -8,8 +8,8 @@ import os import systemtesting import numpy as np -from mantid import * -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmManager, FileFinder +from mantid.simpleapi import LiquidsReflectometryReduction, Load, LRAutoReduction, LRReflectivityOutput def get_file_path(filename): diff --git a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionWithBackgroundTest.py b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionWithBackgroundTest.py index e6d0c23eb3ba..cb3e2264c248 100644 --- a/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionWithBackgroundTest.py +++ b/Testing/SystemTests/tests/framework/LiquidsReflectometryReductionWithBackgroundTest.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid import * -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.simpleapi import LiquidsReflectometryReduction class LiquidsReflectometryReductionWithBackgroundPreciseTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/LoadAndCheckBase.py b/Testing/SystemTests/tests/framework/LoadAndCheckBase.py index cdd4e3cba5c5..fd5893f1a7b1 100644 --- a/Testing/SystemTests/tests/framework/LoadAndCheckBase.py +++ b/Testing/SystemTests/tests/framework/LoadAndCheckBase.py @@ -10,8 +10,8 @@ """ import systemtesting -from mantid.simpleapi import * -import mantid.api +from mantid.api import mtd, WorkspaceGroup +from mantid.simpleapi import Integration, Load from abc import ABCMeta, abstractmethod @@ -69,8 +69,7 @@ def runTest(self): self.assertTrue(isinstance(a, type(b))) - # raise NotImplementedError() - if isinstance(a, mantid.api.WorkspaceGroup): + if isinstance(a, WorkspaceGroup): self.assertEqual(a.size(), b.size()) self.assertEqual(a.size(), n_periods) # Loop through each workspace in the group and apply some simple comaprison checks. diff --git a/Testing/SystemTests/tests/framework/LoadEmbeddedInstrumentInfo.py b/Testing/SystemTests/tests/framework/LoadEmbeddedInstrumentInfo.py index c56cae360c53..8892be312cd6 100644 --- a/Testing/SystemTests/tests/framework/LoadEmbeddedInstrumentInfo.py +++ b/Testing/SystemTests/tests/framework/LoadEmbeddedInstrumentInfo.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import Load # # Here testing against embedded instrument info in different raw file formats diff --git a/Testing/SystemTests/tests/framework/LoadLotsOfInstruments.py b/Testing/SystemTests/tests/framework/LoadLotsOfInstruments.py index 8e6ba2ea2516..083000c4f991 100644 --- a/Testing/SystemTests/tests/framework/LoadLotsOfInstruments.py +++ b/Testing/SystemTests/tests/framework/LoadLotsOfInstruments.py @@ -5,8 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-few-public-methods -from mantid.simpleapi import * from mantid.api import FrameworkManager +from mantid.kernel import config +from mantid.simpleapi import LoadEmptyInstrument import os import glob import systemtesting diff --git a/Testing/SystemTests/tests/framework/LoadMuonNexusTest.py b/Testing/SystemTests/tests/framework/LoadMuonNexusTest.py index ebd59bf58dc2..a7323c4c5ba7 100644 --- a/Testing/SystemTests/tests/framework/LoadMuonNexusTest.py +++ b/Testing/SystemTests/tests/framework/LoadMuonNexusTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import LoadMuonNexus class LoadMuonNexusTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/MDNormCORELLITest.py b/Testing/SystemTests/tests/framework/MDNormCORELLITest.py index 1563b6f7b62d..dc6bcee15971 100644 --- a/Testing/SystemTests/tests/framework/MDNormCORELLITest.py +++ b/Testing/SystemTests/tests/framework/MDNormCORELLITest.py @@ -10,7 +10,19 @@ System test for MDNorm """ -from mantid.simpleapi import * +from mantid.simpleapi import ( + ConvertToMD, + ConvertToMDMinMaxGlobal, + ConvertUnits, + CropWorkspaceForMDNorm, + DeleteWorkspace, + Load, + LoadIsawUB, + MaskDetectors, + MDNorm, + RecalculateTrajectoriesExtents, + SetGoniometer, +) import systemtesting @@ -68,7 +80,7 @@ def runTest(self): # Check that we test these problematic cases self.assertRaises( ValueError, - mantid.simpleapi.MDNorm, + MDNorm, InputWorkspace="md", SolidAngleWorkspace="SolidAngle", FluxWorkspace="Flux", @@ -90,7 +102,7 @@ def runTest(self): ) self.assertRaises( ValueError, - mantid.simpleapi.MDNorm, + MDNorm, InputWorkspace="md", SolidAngleWorkspace="SolidAngle", FluxWorkspace="Flux", @@ -112,7 +124,7 @@ def runTest(self): ) self.assertRaises( RuntimeError, - mantid.simpleapi.MDNorm, + MDNorm, InputWorkspace="md", SolidAngleWorkspace="SolidAngle", FluxWorkspace="Flux", @@ -134,7 +146,7 @@ def runTest(self): ) self.assertRaises( ValueError, - mantid.simpleapi.MDNorm, + MDNorm, InputWorkspace="md", SolidAngleWorkspace="SolidAngle", FluxWorkspace="Flux", diff --git a/Testing/SystemTests/tests/framework/MDNormHYSPECTest.py b/Testing/SystemTests/tests/framework/MDNormHYSPECTest.py index 34e4213bb7df..96f825a00e58 100644 --- a/Testing/SystemTests/tests/framework/MDNormHYSPECTest.py +++ b/Testing/SystemTests/tests/framework/MDNormHYSPECTest.py @@ -10,7 +10,21 @@ System test for MDNorm """ -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import ( + ConvertMDHistoToMatrixWorkspace, + ConvertToMD, + CropWorkspaceForMDNorm, + DeleteWorkspace, + DgsReduction, + FilterEvents, + GenerateEventsFilter, + Load, + MDNorm, + MergeMD, + SetGoniometer, + SetUB, +) import systemtesting diff --git a/Testing/SystemTests/tests/framework/MDWorkspaceTests.py b/Testing/SystemTests/tests/framework/MDWorkspaceTests.py index 5b06e6e5dab1..d6402081d3c6 100644 --- a/Testing/SystemTests/tests/framework/MDWorkspaceTests.py +++ b/Testing/SystemTests/tests/framework/MDWorkspaceTests.py @@ -12,9 +12,22 @@ import systemtesting import os -from mantid.simpleapi import * -from mantid.api import * -from mantid.kernel import * +from mantid.api import mtd, AlgorithmManager +from mantid.kernel import ConfigService, Logger +from mantid.simpleapi import ( + AddSampleLog, + BinMD, + ConvertToDiffractionMDWorkspace, + CreateMDWorkspace, + DeleteWorkspace, + EqualToMD, + LoadEventNexus, + LoadMD, + MergeMDFiles, + PlusMD, + SaveMD, + SetGoniometer, +) ############################################################################### diff --git a/Testing/SystemTests/tests/framework/MRFilterCrossSectionsTest.py b/Testing/SystemTests/tests/framework/MRFilterCrossSectionsTest.py index 4e5e4f649f72..281d496e177a 100644 --- a/Testing/SystemTests/tests/framework/MRFilterCrossSectionsTest.py +++ b/Testing/SystemTests/tests/framework/MRFilterCrossSectionsTest.py @@ -10,7 +10,8 @@ on a big data set comprising ~1.2*10^6 events being split by ~15*10^6 time boundaries """ -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import DeleteWorkspace, MRFilterCrossSections import systemtesting diff --git a/Testing/SystemTests/tests/framework/MagnetismReflectometryReductionTest.py b/Testing/SystemTests/tests/framework/MagnetismReflectometryReductionTest.py index 7912930f81ac..771c22741bfe 100644 --- a/Testing/SystemTests/tests/framework/MagnetismReflectometryReductionTest.py +++ b/Testing/SystemTests/tests/framework/MagnetismReflectometryReductionTest.py @@ -6,8 +6,16 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid import * -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + AddSampleLog, + LoadEventNexus, + LoadNexusProcessed, + MagnetismReflectometryReduction, + MRFilterCrossSections, + MRGetTheta, + MRInspectData, +) import math import numpy as np diff --git a/Testing/SystemTests/tests/framework/MaxEntTest.py b/Testing/SystemTests/tests/framework/MaxEntTest.py index 21fdf81a0b70..5b5cf829f531 100644 --- a/Testing/SystemTests/tests/framework/MaxEntTest.py +++ b/Testing/SystemTests/tests/framework/MaxEntTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import CropWorkspace, GroupWorkspaces, Load, MaxEnt, Rebin, RemoveExpDecay class MaxEntTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/MuonFFTTest.py b/Testing/SystemTests/tests/framework/MuonFFTTest.py index 4a2656a244ed..ae038bdf048b 100644 --- a/Testing/SystemTests/tests/framework/MuonFFTTest.py +++ b/Testing/SystemTests/tests/framework/MuonFFTTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import CompareWorkspaces, CreateEmptyTableWorkspace, CropWorkspace, FFT, Load, PhaseQuad, ScaleX from math import pi diff --git a/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py b/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py index 5dc0a3cb181f..7cfac4a6dce0 100644 --- a/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py +++ b/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init,too-few-public-methods import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import Fit, LoadMuonNexus, MuonProcess class MuonKerenFittingTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/MuonLoadersSignatureTest.py b/Testing/SystemTests/tests/framework/MuonLoadersSignatureTest.py index 5e7a17777afa..a5316133bd25 100644 --- a/Testing/SystemTests/tests/framework/MuonLoadersSignatureTest.py +++ b/Testing/SystemTests/tests/framework/MuonLoadersSignatureTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import AlgorithmManager class MuonLoadersSignatureTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/MuonMaxEntTest.py b/Testing/SystemTests/tests/framework/MuonMaxEntTest.py index 5f8fbd88c433..f654620b1791 100644 --- a/Testing/SystemTests/tests/framework/MuonMaxEntTest.py +++ b/Testing/SystemTests/tests/framework/MuonMaxEntTest.py @@ -7,14 +7,15 @@ # pylint: disable=no-init,attribute-defined-outside-init import systemtesting from math import pi -from mantid.simpleapi import * +from mantid.api import AnalysisDataService +from mantid.simpleapi import CreateEmptyTableWorkspace, GroupWorkspaces, Load, MuonMaxent class MuonMaxEntTest(systemtesting.MantidSystemTest): """Tests the MaxEnt algorithm on a MUSR workspace""" def fixPhasesTest(self, phases0): - MuonMaxEnt( + MuonMaxent( InputWorkspace="MUSR00022725", InputPhaseTable="tab", Npts="16384", diff --git a/Testing/SystemTests/tests/framework/MuonProcessTest.py b/Testing/SystemTests/tests/framework/MuonProcessTest.py index f6465aaa3aa1..f11979dd2b3a 100644 --- a/Testing/SystemTests/tests/framework/MuonProcessTest.py +++ b/Testing/SystemTests/tests/framework/MuonProcessTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd, WorkspaceFactory +from mantid.simpleapi import LoadMuonNexus, MuonProcess class MuonProcessTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/OFFSPECLoadingTest.py b/Testing/SystemTests/tests/framework/OFFSPECLoadingTest.py index 4516922e2d94..2f2254230abc 100644 --- a/Testing/SystemTests/tests/framework/OFFSPECLoadingTest.py +++ b/Testing/SystemTests/tests/framework/OFFSPECLoadingTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from LoadAndCheckBase import * +from LoadAndCheckBase import LoadAndCheckBase class OFFSPECLoadingTest(LoadAndCheckBase): diff --git a/Testing/SystemTests/tests/framework/POLDIAnalyseResidualsTest.py b/Testing/SystemTests/tests/framework/POLDIAnalyseResidualsTest.py index 03df0ebf5332..7c79a06da588 100644 --- a/Testing/SystemTests/tests/framework/POLDIAnalyseResidualsTest.py +++ b/Testing/SystemTests/tests/framework/POLDIAnalyseResidualsTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CreateWorkspace, Fit, Load, LoadInstrument, LoadSINQFile, PoldiAnalyseResiduals, PoldiTruncateData import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDIAutoCorrelationTest.py b/Testing/SystemTests/tests/framework/POLDIAutoCorrelationTest.py index ad8072b3af63..99ac986755f7 100644 --- a/Testing/SystemTests/tests/framework/POLDIAutoCorrelationTest.py +++ b/Testing/SystemTests/tests/framework/POLDIAutoCorrelationTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CreateWorkspace, Fit, Load, LoadInstrument, LoadSINQFile, PoldiAutoCorrelation, PoldiTruncateData import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDICreatePeaksFromCellTest.py b/Testing/SystemTests/tests/framework/POLDICreatePeaksFromCellTest.py index 525b46348b31..b7e18ac24376 100644 --- a/Testing/SystemTests/tests/framework/POLDICreatePeaksFromCellTest.py +++ b/Testing/SystemTests/tests/framework/POLDICreatePeaksFromCellTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-few-public-methods import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import PoldiCreatePeaksFromCell # These tests check the correctness of the structure factor calculation for some common crystal structures. # All structure factors for comparison have been calculated using VESTA 3.2.1, which is described in the following diff --git a/Testing/SystemTests/tests/framework/POLDIDataAnalysisTest.py b/Testing/SystemTests/tests/framework/POLDIDataAnalysisTest.py index c6f692434899..fae2058beaf5 100644 --- a/Testing/SystemTests/tests/framework/POLDIDataAnalysisTest.py +++ b/Testing/SystemTests/tests/framework/POLDIDataAnalysisTest.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-few-public-methods import systemtesting -from mantid.simpleapi import * -from mantid.api import * +from mantid.api import AnalysisDataService, WorkspaceGroup +from mantid.simpleapi import DeleteTableRows, PoldiCreatePeaksFromCell, PoldiDataAnalysis, PoldiLoadRuns import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDIFitPeaks1DTest.py b/Testing/SystemTests/tests/framework/POLDIFitPeaks1DTest.py index cf052aadee29..08c05c85d5d9 100644 --- a/Testing/SystemTests/tests/framework/POLDIFitPeaks1DTest.py +++ b/Testing/SystemTests/tests/framework/POLDIFitPeaks1DTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import DeleteTableRows, Load, PoldiFitPeaks1D, PoldiPeakSearch import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDIFitPeaks2DTest.py b/Testing/SystemTests/tests/framework/POLDIFitPeaks2DTest.py index e58daf68f0fd..0d09c875567f 100644 --- a/Testing/SystemTests/tests/framework/POLDIFitPeaks2DTest.py +++ b/Testing/SystemTests/tests/framework/POLDIFitPeaks2DTest.py @@ -6,7 +6,22 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-many-locals,too-few-public-methods import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + DeleteTableRows, + DeleteWorkspace, + Load, + LoadInstrument, + LoadSINQFile, + PoldiAutoCorrelation, + PoldiCreatePeaksFromCell, + PoldiFitPeaks1D, + PoldiIndexKnownCompounds, + PoldiFitPeaks2D, + PoldiLoadRuns, + PoldiPeakSearch, + PoldiTruncateData, +) import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDILoadRunsTest.py b/Testing/SystemTests/tests/framework/POLDILoadRunsTest.py index b6e68c611d0f..9238a835704f 100644 --- a/Testing/SystemTests/tests/framework/POLDILoadRunsTest.py +++ b/Testing/SystemTests/tests/framework/POLDILoadRunsTest.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,bare-except import systemtesting -from mantid.simpleapi import * -from mantid.api import * +from mantid.api import AnalysisDataService, Workspace, WorkspaceGroup +from mantid.simpleapi import CreateWorkspace, PoldiLoadRuns import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDIMergeTest.py b/Testing/SystemTests/tests/framework/POLDIMergeTest.py index 1970d5545486..c0fd3471fb5a 100644 --- a/Testing/SystemTests/tests/framework/POLDIMergeTest.py +++ b/Testing/SystemTests/tests/framework/POLDIMergeTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import GroupWorkspaces, Load, LoadInstrument, LoadSINQFile, PoldiMerge import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDIPeakSearchTest.py b/Testing/SystemTests/tests/framework/POLDIPeakSearchTest.py index c9a228b18768..c70181e3f838 100644 --- a/Testing/SystemTests/tests/framework/POLDIPeakSearchTest.py +++ b/Testing/SystemTests/tests/framework/POLDIPeakSearchTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import Load, PoldiPeakSearch import numpy as np diff --git a/Testing/SystemTests/tests/framework/POLDITruncateDataTest.py b/Testing/SystemTests/tests/framework/POLDITruncateDataTest.py index bd804bc42c84..b9fb21ee9fee 100644 --- a/Testing/SystemTests/tests/framework/POLDITruncateDataTest.py +++ b/Testing/SystemTests/tests/framework/POLDITruncateDataTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CropWorkspace, LoadInstrument, LoadSINQFile, PoldiTruncateData class POLDITruncateDataTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/POLREFLoadingTest.py b/Testing/SystemTests/tests/framework/POLREFLoadingTest.py index 11a7b8e7a8a9..0e206485f7b4 100644 --- a/Testing/SystemTests/tests/framework/POLREFLoadingTest.py +++ b/Testing/SystemTests/tests/framework/POLREFLoadingTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from LoadAndCheckBase import * +from LoadAndCheckBase import LoadAndCheckBase # Test File loading and basic data integrity checks of POLREF data in Mantid. diff --git a/Testing/SystemTests/tests/framework/Peak2ConvCell_Test.py b/Testing/SystemTests/tests/framework/Peak2ConvCell_Test.py index bde88fa3db92..3a002fc6dbb2 100644 --- a/Testing/SystemTests/tests/framework/Peak2ConvCell_Test.py +++ b/Testing/SystemTests/tests/framework/Peak2ConvCell_Test.py @@ -20,7 +20,16 @@ import math import random import mantid -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + CopySample, + CreatePeaksWorkspace, + CreateSingleValuedWorkspace, + FindUBUsingFFT, + IndexPeaks, + LoadInstrument, + SelectCellWithForm, +) # from mantid.simpleapi import * diff --git a/Testing/SystemTests/tests/framework/PelicanCrystalProcessingTest.py b/Testing/SystemTests/tests/framework/PelicanCrystalProcessingTest.py index 6abe72ac1c06..996c20d626e8 100644 --- a/Testing/SystemTests/tests/framework/PelicanCrystalProcessingTest.py +++ b/Testing/SystemTests/tests/framework/PelicanCrystalProcessingTest.py @@ -7,9 +7,9 @@ import os import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config from mantid.simpleapi import PelicanCrystalProcessing -from mantid import config class PelicanCrystalProcessingSingleTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/PelicanReductionTest.py b/Testing/SystemTests/tests/framework/PelicanReductionTest.py index fc2efee29788..d777c188681a 100644 --- a/Testing/SystemTests/tests/framework/PelicanReductionTest.py +++ b/Testing/SystemTests/tests/framework/PelicanReductionTest.py @@ -6,8 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * -from mantid.api import IEventWorkspace +from mantid.api import mtd, IEventWorkspace from mantid.simpleapi import PelicanReduction diff --git a/Testing/SystemTests/tests/framework/PolrefExample.py b/Testing/SystemTests/tests/framework/PolrefExample.py index 34bd5739367f..e31bcb1a3ba1 100644 --- a/Testing/SystemTests/tests/framework/PolrefExample.py +++ b/Testing/SystemTests/tests/framework/PolrefExample.py @@ -6,7 +6,20 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import ( + CalculateFlatBackground, + ConvertUnits, + CreateSingleValuedWorkspace, + CropWorkspace, + DeleteWorkspace, + Divide, + ExponentialCorrection, + LoadRaw, + OneMinusExponentialCor, + Plus, + PolynomialCorrection, + RebinToWorkspace, +) class PolrefExample(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/PowderDiffProfileCalibrateTest.py b/Testing/SystemTests/tests/framework/PowderDiffProfileCalibrateTest.py index 489f54f5080c..3f0b600293b1 100644 --- a/Testing/SystemTests/tests/framework/PowderDiffProfileCalibrateTest.py +++ b/Testing/SystemTests/tests/framework/PowderDiffProfileCalibrateTest.py @@ -15,8 +15,16 @@ # ######################################################################## import systemtesting -import mantid.simpleapi as api -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + CreateEmptyTableWorkspace, + CreateLeBailFitInput, + ExaminePowderDiffProfile, + Load, + LoadAscii, + LoadNexusProcessed, + RefinePowderDiffProfileSeq, +) class VulcanExamineProfile(systemtesting.MantidSystemTest): @@ -96,7 +104,7 @@ def runTest(self): paramnames = ["Bkpos", "A0", "A1", "A2", "A3", "A4", "A5"] paramvalues = [11000.000, 0.034, 0.027, -0.129, 0.161, -0.083, 0.015] bkgdtablewsname = "VULCAN_22946_Bkgd_Parameter" - api.CreateEmptyTableWorkspace(OutputWorkspace=bkgdtablewsname) + CreateEmptyTableWorkspace(OutputWorkspace=bkgdtablewsname) ws = mtd[bkgdtablewsname] ws.addColumn("str", "Name") ws.addColumn("double", "Value") @@ -121,7 +129,7 @@ def runTest(self): ) # Set up sequential refinement - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="", InputProfileWorkspace="Vulcan_B270_Profile", @@ -139,7 +147,7 @@ def runTest(self): ) # Refine step 1 - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="RecordIDx890Table", InputProfileWorkspace="Vulcan_B270_Profile", @@ -157,7 +165,7 @@ def runTest(self): ) # Refine step 2 - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="RecordIDx890Table", # InputProfileWorkspace = "Vulcan_B270_Profile", @@ -175,7 +183,7 @@ def runTest(self): ) # Refine step 3 (not from previous cycle) - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="RecordIDx890Table", StartX=7000.0, @@ -189,7 +197,7 @@ def runTest(self): ) # Save - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="RecordIDx890Table", FunctionOption="Save", @@ -220,10 +228,10 @@ def requiredFiles(self): def runTest(self): # Load - api.RefinePowderDiffProfileSeq(FunctionOption="Load", InputProjectFilename=self.seqfile, ProjectID="IDx890") + RefinePowderDiffProfileSeq(FunctionOption="Load", InputProjectFilename=self.seqfile, ProjectID="IDx890") # Refine step 4 - api.RefinePowderDiffProfileSeq( + RefinePowderDiffProfileSeq( InputWorkspace="VULCAN_22946_NOM", SeqControlInfoWorkspace="RecordIDx890Table", startx=7000.0, diff --git a/Testing/SystemTests/tests/framework/PredictPeaksTest.py b/Testing/SystemTests/tests/framework/PredictPeaksTest.py index 8c07a34cd6c2..882ab26d37c5 100644 --- a/Testing/SystemTests/tests/framework/PredictPeaksTest.py +++ b/Testing/SystemTests/tests/framework/PredictPeaksTest.py @@ -5,8 +5,21 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,too-few-public-methods +import os import systemtesting -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import ( + CompareWorkspaces, + CreateSimulationWorkspace, + FilterPeaks, + HB3AAdjustSampleNorm, + HFIRCalculateGoniometer, + IntegratePeaksMD, + LoadNexus, + PredictPeaks, + SetGoniometer, + SetUB, +) from mantid.geometry import CrystalStructure, Goniometer diff --git a/Testing/SystemTests/tests/framework/ReduceOneSCD_Run.py b/Testing/SystemTests/tests/framework/ReduceOneSCD_Run.py index edeb25be56b6..d84ace198627 100644 --- a/Testing/SystemTests/tests/framework/ReduceOneSCD_Run.py +++ b/Testing/SystemTests/tests/framework/ReduceOneSCD_Run.py @@ -24,8 +24,27 @@ import systemtesting import os -from mantid.api import * -from mantid.simpleapi import * +from mantid.api import mtd, AnalysisDataService +from mantid.simpleapi import ( + ConvertToDiffractionMDWorkspace, + ConvertToMD, + CreateSingleValuedWorkspace, + FindPeaksMD, + FindUBUsingFFT, + IndexPeaks, + IntegratePeaksMD, + Integration, + LoadEventNexus, + LoadIsawDetCal, + LoadIsawUB, + LoadNexus, + LoadNexusMonitors, + PeakIntegration, + PredictPeaks, + SaveIsawUB, + SelectCellOfType, + Rebin, +) from mantid import config diff --git a/Testing/SystemTests/tests/framework/RefRoi.py b/Testing/SystemTests/tests/framework/RefRoi.py index e2a545a4bf5c..26f50db3b43f 100644 --- a/Testing/SystemTests/tests/framework/RefRoi.py +++ b/Testing/SystemTests/tests/framework/RefRoi.py @@ -6,8 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid import * -from mantid.simpleapi import * +from mantid.simpleapi import Integration, Load, RefRoi, Transpose class RefRoiTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/ReflectometryISIS.py b/Testing/SystemTests/tests/framework/ReflectometryISIS.py index 837fe6fd220e..6bb0d5ee2a48 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryISIS.py +++ b/Testing/SystemTests/tests/framework/ReflectometryISIS.py @@ -10,7 +10,19 @@ """ import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + BinMD, + CompareMDWorkspaces, + ConvertSpectrumAxis, + ConvertToReflectometryQ, + ConvertUnits, + CropWorkspace, + Divide, + Load, + LoadMD, + MoveInstrumentComponent, +) from abc import ABCMeta, abstractmethod diff --git a/Testing/SystemTests/tests/framework/ReflectometryISIS_v2.py b/Testing/SystemTests/tests/framework/ReflectometryISIS_v2.py index b4262319f367..7ad0768819df 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryISIS_v2.py +++ b/Testing/SystemTests/tests/framework/ReflectometryISIS_v2.py @@ -10,7 +10,19 @@ """ import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + BinMD, + CompareMDWorkspaces, + ConvertSpectrumAxis, + ConvertToReflectometryQ, + ConvertUnits, + CropWorkspace, + Divide, + Load, + LoadMD, + MoveInstrumentComponent, +) from abc import ABCMeta, abstractmethod diff --git a/Testing/SystemTests/tests/framework/ReflectometryQuickCombineMulti.py b/Testing/SystemTests/tests/framework/ReflectometryQuickCombineMulti.py index 806b9c38dd6d..9867988d6ae6 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryQuickCombineMulti.py +++ b/Testing/SystemTests/tests/framework/ReflectometryQuickCombineMulti.py @@ -6,7 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import LoadISISNexus, Rebin from isis_reflectometry import quick from isis_reflectometry import combineMulti diff --git a/Testing/SystemTests/tests/framework/ReflectometryQuickMultiDetector.py b/Testing/SystemTests/tests/framework/ReflectometryQuickMultiDetector.py index b7f000c8ff05..394b36c37a02 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryQuickMultiDetector.py +++ b/Testing/SystemTests/tests/framework/ReflectometryQuickMultiDetector.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import Load from isis_reflectometry import quick diff --git a/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetector.py b/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetector.py index be13ca7a0b3d..48f7603946cc 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetector.py +++ b/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetector.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import LoadISISNexus from isis_reflectometry import quick diff --git a/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetectorMakeTransmission.py b/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetectorMakeTransmission.py index 5ea484187a0a..40b19af47d1b 100644 --- a/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetectorMakeTransmission.py +++ b/Testing/SystemTests/tests/framework/ReflectometryQuickPointDetectorMakeTransmission.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import LoadISISNexus from isis_reflectometry import quick diff --git a/Testing/SystemTests/tests/framework/RelectometryInstrumentSignedThetaTest.py b/Testing/SystemTests/tests/framework/RelectometryInstrumentSignedThetaTest.py index 499dcd26215a..c00c5780de2e 100644 --- a/Testing/SystemTests/tests/framework/RelectometryInstrumentSignedThetaTest.py +++ b/Testing/SystemTests/tests/framework/RelectometryInstrumentSignedThetaTest.py @@ -11,7 +11,8 @@ """ import os -from mantid.simpleapi import * +from mantid.kernel import config +from mantid.simpleapi import ConvertSpectrumAxis, LoadEmptyInstrument, MoveInstrumentComponent import systemtesting diff --git a/Testing/SystemTests/tests/framework/SANSILLAbsoluteScale2Test.py b/Testing/SystemTests/tests/framework/SANSILLAbsoluteScale2Test.py index 7ce2ba5d2c85..258363c2f31d 100644 --- a/Testing/SystemTests/tests/framework/SANSILLAbsoluteScale2Test.py +++ b/Testing/SystemTests/tests/framework/SANSILLAbsoluteScale2Test.py @@ -4,8 +4,11 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +import numpy as np import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import CompareWorkspaces, ConvertToHistogram, GroupWorkspaces, LoadNexusProcessed, SANSILLReduction, Scale class D11_AbsoluteScale_Test(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SANSILLAbsoluteScaleTest.py b/Testing/SystemTests/tests/framework/SANSILLAbsoluteScaleTest.py index e757d42175b7..f44f81c6282d 100644 --- a/Testing/SystemTests/tests/framework/SANSILLAbsoluteScaleTest.py +++ b/Testing/SystemTests/tests/framework/SANSILLAbsoluteScaleTest.py @@ -5,7 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import CompareWorkspaces, GroupWorkspaces, LoadNexusProcessed, SANSILLReduction, Scale class D11_AbsoluteScale_Test(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SANSILLReduction2Test.py b/Testing/SystemTests/tests/framework/SANSILLReduction2Test.py index 901aeb10342f..a7e817d8449f 100644 --- a/Testing/SystemTests/tests/framework/SANSILLReduction2Test.py +++ b/Testing/SystemTests/tests/framework/SANSILLReduction2Test.py @@ -5,7 +5,24 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import ( + AddSampleLog, + CalculateDynamicRange, + CalculateEfficiency, + CreateSingleValuedWorkspace, + CropToComponent, + GroupWorkspaces, + Load, + LoadNexusProcessed, + MaskBTP, + Plus, + SANSILLIntegration, + SANSILLReduction, + RenameWorkspace, + Q1DWeighted, +) class ILL_SANS_D11_MONO_TEST(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SANSILLReductionTest.py b/Testing/SystemTests/tests/framework/SANSILLReductionTest.py index 50b955da2e40..60b2b7f37ed4 100644 --- a/Testing/SystemTests/tests/framework/SANSILLReductionTest.py +++ b/Testing/SystemTests/tests/framework/SANSILLReductionTest.py @@ -5,7 +5,21 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import ( + AddSampleLog, + CalculateEfficiency, + CreateSingleValuedWorkspace, + CreateWorkspace, + GroupWorkspaces, + LoadNexusProcessed, + MaskBTP, + Plus, + SANSILLIntegration, + SANSILLReduction, + RenameWorkspace, +) class ILL_D11_Test(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SEQUOIAreduction.py b/Testing/SystemTests/tests/framework/SEQUOIAreduction.py index 559b46f5ebba..0fc406470cee 100644 --- a/Testing/SystemTests/tests/framework/SEQUOIAreduction.py +++ b/Testing/SystemTests/tests/framework/SEQUOIAreduction.py @@ -15,7 +15,32 @@ import glob import numpy as np import mantid -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + ChangeBinOffset, + ConvertToDistribution, + ConvertUnits, + CorrectKiKf, + DeleteWorkspace, + Divide, + FilterBadPulses, + GetEi, + GroupDetectors, + He3TubeEfficiency, + LoadEventNexus, + LoadNexus, + LoadNexusMonitors, + MaskDetectors, + MedianDetectorTest, + NormaliseByCurrent, + Plus, + SaveNexus, + SaveNXSPE, + SavePHX, + SaveSPE, + SolidAngle, + Rebin, +) class DirectInelaticSNSTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SNSConvertToMDTest.py b/Testing/SystemTests/tests/framework/SNSConvertToMDTest.py index 0040cc6cfcd6..42b91a8a66ef 100644 --- a/Testing/SystemTests/tests/framework/SNSConvertToMDTest.py +++ b/Testing/SystemTests/tests/framework/SNSConvertToMDTest.py @@ -6,7 +6,9 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,no-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd, AlgorithmManager +from mantid.kernel import config +from mantid.simpleapi import ConvertToMD, DeleteWorkspace, DgsReduction, Load, LoadMD, SaveMD, SetGoniometer, SetUB ###################################################################### # Common configuration diff --git a/Testing/SystemTests/tests/framework/SNSPowderRedux.py b/Testing/SystemTests/tests/framework/SNSPowderRedux.py index 78892095d201..cff6a25d8e25 100644 --- a/Testing/SystemTests/tests/framework/SNSPowderRedux.py +++ b/Testing/SystemTests/tests/framework/SNSPowderRedux.py @@ -7,8 +7,38 @@ # pylint: disable=no-init,invalid-name,attribute-defined-outside-init import numpy as np import systemtesting -from mantid.simpleapi import * -from mantid.api import FileFinder +from mantid.api import mtd, FileFinder +from mantid.kernel import config +from mantid.simpleapi import ( + AlignAndFocusPowderFromFiles, + ApplyDiffCal, + CompressEvents, + ConjoinFiles, + ConvertUnits, + CropWorkspace, + DiffractionFocussing, + Divide, + EditInstrumentGeometry, + FilterBadPulses, + Integration, + LoadCalFile, + LoadEventNexus, + LoadGSS, + LoadNexus, + MaskDetectors, + PDLoadCharacterizations, + PDToPDFgetN, + Power, + Rebin, + RemoveLowResTOF, + RemovePromptPulse, + SaveGSS, + SNSPowderReduction, + SortEvents, + StripVanadiumPeaks, + Subtract, + UnwrapSNS, +) import os diff --git a/Testing/SystemTests/tests/framework/SXDAnalysis.py b/Testing/SystemTests/tests/framework/SXDAnalysis.py index 26dec6553db4..6e6c5fab9b66 100644 --- a/Testing/SystemTests/tests/framework/SXDAnalysis.py +++ b/Testing/SystemTests/tests/framework/SXDAnalysis.py @@ -9,8 +9,20 @@ import tempfile import shutil import os +import numpy as np from mantid.api import AnalysisDataService as ADS -from mantid.simpleapi import * +from mantid.simpleapi import ( + AddPeak, + CalculateUMatrix, + CreatePeaksWorkspace, + FindUBUsingFFT, + IndexPeaks, + Load, + LoadEmptyInstrument, + LoadNexus, + OptimizeLatticeForCellType, + SelectCellOfType, +) from Diffraction.single_crystal.sxd import SXD from Diffraction.single_crystal.base_sx import PEAK_TYPE, INTEGRATION_TYPE diff --git a/Testing/SystemTests/tests/framework/SaveLoadNexusProcessed.py b/Testing/SystemTests/tests/framework/SaveLoadNexusProcessed.py index 0e719f2a8277..873bab216694 100644 --- a/Testing/SystemTests/tests/framework/SaveLoadNexusProcessed.py +++ b/Testing/SystemTests/tests/framework/SaveLoadNexusProcessed.py @@ -7,8 +7,21 @@ from abc import ABCMeta, abstractmethod import os import systemtesting -from mantid.simpleapi import * -from mantid import config +from mantid.api import mtd, AnalysisDataService +from mantid.kernel import config +from mantid.simpleapi import ( + CompareWorkspaces, + CreateGroupingWorkspace, + CreateSampleWorkspace, + CreateWorkspace, + ExtractMask, + ExtractSingleSpectrum, + LoadInstrument, + LoadNexusProcessed, + MaskBins, + MaskDetectors, + SaveNexusProcessed, +) from mantid.dataobjects import MaskWorkspace @@ -54,7 +67,7 @@ def cleanup(self): os.remove(self.filename) except OSError as ex: # can't really do much - print("Error removing {}: {}".format(str(ex), filename)) + print("Error removing {}: {}".format(str(ex), self.filename)) class SaveLoadNexusProcessedBasicTest(SaveLoadNexusProcessedTestBase): diff --git a/Testing/SystemTests/tests/framework/SaveNexusTest.py b/Testing/SystemTests/tests/framework/SaveNexusTest.py index 7daa61dda67a..d460c36d2b47 100644 --- a/Testing/SystemTests/tests/framework/SaveNexusTest.py +++ b/Testing/SystemTests/tests/framework/SaveNexusTest.py @@ -5,8 +5,9 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name,too-few-public-methods -from mantid.simpleapi import * from mantid.api import FrameworkManager +from mantid.kernel import config +from mantid.simpleapi import LoadEmptyInstrument, SaveNexusGeometry import os import glob import tempfile diff --git a/Testing/SystemTests/tests/framework/SortHKLTest.py b/Testing/SystemTests/tests/framework/SortHKLTest.py index 3b416e438c21..af4a448fcc08 100644 --- a/Testing/SystemTests/tests/framework/SortHKLTest.py +++ b/Testing/SystemTests/tests/framework/SortHKLTest.py @@ -7,7 +7,8 @@ # pylint: disable=no-init,attribute-defined-outside-init import systemtesting import json -from mantid.simpleapi import * +from mantid.api import FileFinder +from mantid.simpleapi import CreatePeaksWorkspace, CreateSimulationWorkspace, LoadHKL, SetUB, SortHKL from mantid.geometry import PointGroupFactory diff --git a/Testing/SystemTests/tests/framework/SpaceGroupFactoryTest.py b/Testing/SystemTests/tests/framework/SpaceGroupFactoryTest.py index 6bb44fcde61a..f43ed3278b3f 100644 --- a/Testing/SystemTests/tests/framework/SpaceGroupFactoryTest.py +++ b/Testing/SystemTests/tests/framework/SpaceGroupFactoryTest.py @@ -7,8 +7,8 @@ # pylint: disable=no-init import systemtesting import re -from mantid.simpleapi import * -from mantid.geometry import * +from mantid.api import FileFinder +from mantid.geometry import Group, SpaceGroupFactory, SymmetryOperationFactory class SpaceGroupFactoryTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SpaceGroupReflectionConditionsTest.py b/Testing/SystemTests/tests/framework/SpaceGroupReflectionConditionsTest.py index 4587bad3ad01..029e6c5949fb 100644 --- a/Testing/SystemTests/tests/framework/SpaceGroupReflectionConditionsTest.py +++ b/Testing/SystemTests/tests/framework/SpaceGroupReflectionConditionsTest.py @@ -6,8 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import systemtesting -from mantid.simpleapi import * -from mantid.geometry import * +from mantid.simpleapi import PoldiCreatePeaksFromCell +from mantid.geometry import SpaceGroupFactory class SpaceGroupReflectionConditionsTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SpaceGroupUnitCellTest.py b/Testing/SystemTests/tests/framework/SpaceGroupUnitCellTest.py index dc45a9bba819..08bc1e0cf35b 100644 --- a/Testing/SystemTests/tests/framework/SpaceGroupUnitCellTest.py +++ b/Testing/SystemTests/tests/framework/SpaceGroupUnitCellTest.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,invalid-name import systemtesting -from mantid.geometry import * +from mantid.geometry import PointGroup, SpaceGroupFactory, UnitCell class SpaceGroupUnitCellTest(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SplineSmoothingTest.py b/Testing/SystemTests/tests/framework/SplineSmoothingTest.py index 197dec0e21ef..eb6ee1341e45 100644 --- a/Testing/SystemTests/tests/framework/SplineSmoothingTest.py +++ b/Testing/SystemTests/tests/framework/SplineSmoothingTest.py @@ -7,8 +7,8 @@ # pylint: disable=no-init,attribute-defined-outside-init,too-many-public-methods import systemtesting -from mantid.simpleapi import * -from mantid.api import * +from mantid.api import mtd, AnalysisDataService +from mantid.simpleapi import Load, SplineSmoothing import unittest DIFF_PLACES = 7 diff --git a/Testing/SystemTests/tests/framework/StepScan.py b/Testing/SystemTests/tests/framework/StepScan.py index b45e6f966e24..213b976b4049 100644 --- a/Testing/SystemTests/tests/framework/StepScan.py +++ b/Testing/SystemTests/tests/framework/StepScan.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import Load, LoadMask, StepScan class StepScanWorkflowAlgorithm(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/SurfLoadingTest.py b/Testing/SystemTests/tests/framework/SurfLoadingTest.py index 52b0cc91229f..3abd1be45022 100644 --- a/Testing/SystemTests/tests/framework/SurfLoadingTest.py +++ b/Testing/SystemTests/tests/framework/SurfLoadingTest.py @@ -5,7 +5,7 @@ # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init -from LoadAndCheckBase import * +from LoadAndCheckBase import LoadAndCheckBase class SurfLoadingTest(LoadAndCheckBase): diff --git a/Testing/SystemTests/tests/framework/TOPAZPeakFinding.py b/Testing/SystemTests/tests/framework/TOPAZPeakFinding.py index f100b8879121..1a6507c9b544 100644 --- a/Testing/SystemTests/tests/framework/TOPAZPeakFinding.py +++ b/Testing/SystemTests/tests/framework/TOPAZPeakFinding.py @@ -13,7 +13,8 @@ import systemtesting import numpy -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import BinMD, ConvertToDiffractionMDWorkspace, CopySample, FindPeaksMD, FindUBUsingFFT, IndexPeaks, LoadEventNexus from mantid.dataobjects import PeaksWorkspace, LeanElasticPeaksWorkspace from mantid.geometry import UnitCell diff --git a/Testing/SystemTests/tests/framework/UnweightedLeastSquaresTest.py b/Testing/SystemTests/tests/framework/UnweightedLeastSquaresTest.py index 59c0a78b3bd5..b031e7a54546 100644 --- a/Testing/SystemTests/tests/framework/UnweightedLeastSquaresTest.py +++ b/Testing/SystemTests/tests/framework/UnweightedLeastSquaresTest.py @@ -10,7 +10,8 @@ # least square systems that can be found here: # http://www.itl.nist.gov/div898/strd/nls/nls_main.shtml import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CreateWorkspace, Fit def runFit(x, y, fn): diff --git a/Testing/SystemTests/tests/framework/VesuvioCommandsTest.py b/Testing/SystemTests/tests/framework/VesuvioCommandsTest.py index c67cf57f570c..a2ddc23728c8 100644 --- a/Testing/SystemTests/tests/framework/VesuvioCommandsTest.py +++ b/Testing/SystemTests/tests/framework/VesuvioCommandsTest.py @@ -12,10 +12,10 @@ import systemtesting import numpy as np -from mantid.api import WorkspaceGroup, MatrixWorkspace -from mantid.simpleapi import * +from mantid.api import mtd, WorkspaceGroup, MatrixWorkspace +from mantid.simpleapi import CropWorkspace, LoadVesuvio, Rebin from vesuvio.commands import fit_tof -from vesuvio.instrument import * +from vesuvio.instrument import VESUVIO # =====================================Helper Function================================= diff --git a/Testing/SystemTests/tests/framework/VesuvioCorrectionsTest.py b/Testing/SystemTests/tests/framework/VesuvioCorrectionsTest.py index 92730388c104..34d27bccd7c0 100644 --- a/Testing/SystemTests/tests/framework/VesuvioCorrectionsTest.py +++ b/Testing/SystemTests/tests/framework/VesuvioCorrectionsTest.py @@ -16,9 +16,8 @@ import systemtesting import numpy as np -from mantid.api import * +from mantid.api import mtd, AlgorithmManager, ITableWorkspace, MatrixWorkspace, WorkspaceGroup import mantid.simpleapi as ms -from mantid import * # ====================================Helper Functions======================================= diff --git a/Testing/SystemTests/tests/framework/VesuvioFittingTest.py b/Testing/SystemTests/tests/framework/VesuvioFittingTest.py index a7687f4539a1..ad3c16f9bb3f 100644 --- a/Testing/SystemTests/tests/framework/VesuvioFittingTest.py +++ b/Testing/SystemTests/tests/framework/VesuvioFittingTest.py @@ -6,7 +6,8 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=invalid-name,no-init,attribute-defined-outside-init import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import CropWorkspace, Fit, LoadVesuvio, ScaleX import platform diff --git a/Testing/SystemTests/tests/framework/WeightedLeastSquaresTest.py b/Testing/SystemTests/tests/framework/WeightedLeastSquaresTest.py index b4a626b1650c..4f10313f9028 100644 --- a/Testing/SystemTests/tests/framework/WeightedLeastSquaresTest.py +++ b/Testing/SystemTests/tests/framework/WeightedLeastSquaresTest.py @@ -25,8 +25,9 @@ # import systemtesting -from mantid.simpleapi import * -from mantid.api import MatrixWorkspace +from mantid.api import mtd, MatrixWorkspace +from mantid.kernel import logger +from mantid.simpleapi import Fit, LoadAscii import unittest diff --git a/Testing/SystemTests/tests/framework/WishAnalysis.py b/Testing/SystemTests/tests/framework/WishAnalysis.py index c30ae75c1363..29ed81441cd0 100644 --- a/Testing/SystemTests/tests/framework/WishAnalysis.py +++ b/Testing/SystemTests/tests/framework/WishAnalysis.py @@ -6,7 +6,25 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init import systemtesting -from mantid.simpleapi import * +from mantid.simpleapi import ( + AlignDetectors, + ConvertFromDistribution, + ConvertToDistribution, + ConvertUnits, + CropWorkspace, + DeleteWorkspace, + DiffractionFocussing, + Divide, + LoadNexusProcessed, + LoadRaw, + MaskBins, + Minus, + NormaliseToMonitor, + SmoothData, + SplineBackground, + RebinToWorkspace, + ReplaceSpecialValues, +) class WishAnalysis(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/WishDiffuseScattering.py b/Testing/SystemTests/tests/framework/WishDiffuseScattering.py index 24cd9220d302..5f6f3d4884e3 100644 --- a/Testing/SystemTests/tests/framework/WishDiffuseScattering.py +++ b/Testing/SystemTests/tests/framework/WishDiffuseScattering.py @@ -12,7 +12,23 @@ """ import systemtesting -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.simpleapi import ( + AddSampleLog, + BinMD, + ConvertToDiffractionMDWorkspace, + CropWorkspace, + Divide, + Load, + LoadIsawUB, + Minus, + NormaliseByCurrent, + Rebin, + ReplaceSpecialValues, + SetGoniometer, + SmoothData, + SmoothNeighbours, +) class WishDiffuseScattering(systemtesting.MantidSystemTest): diff --git a/Testing/SystemTests/tests/framework/WishMasking.py b/Testing/SystemTests/tests/framework/WishMasking.py index ea10113641db..46244a0201e8 100644 --- a/Testing/SystemTests/tests/framework/WishMasking.py +++ b/Testing/SystemTests/tests/framework/WishMasking.py @@ -12,7 +12,9 @@ import systemtesting import os -from mantid.simpleapi import * +from mantid.api import mtd +from mantid.kernel import config +from mantid.simpleapi import ExtractMask, MaskDetectors, MaskWorkspaceToCalFile, MergeCalFiles, Load, SaveMask class WishMasking(systemtesting.MantidSystemTest): diff --git a/Testing/Tools/cxxtest/build_tools/SCons/cxxtest.py b/Testing/Tools/cxxtest/build_tools/SCons/cxxtest.py index b20ad570c968..e994b601e50e 100644 --- a/Testing/Tools/cxxtest/build_tools/SCons/cxxtest.py +++ b/Testing/Tools/cxxtest/build_tools/SCons/cxxtest.py @@ -61,7 +61,7 @@ # the 1st argument to the function. This will result in the end executable # called that. Normal Program builder rules apply. # - +# ruff: noqa: F403 # Allow wild imports from SCons.Script import * from SCons.Builder import Builder import os diff --git a/Testing/Tools/cxxtest/python/cxxtest/__init__.py b/Testing/Tools/cxxtest/python/cxxtest/__init__.py index 49e2367381a1..caa03c0bc74a 100644 --- a/Testing/Tools/cxxtest/python/cxxtest/__init__.py +++ b/Testing/Tools/cxxtest/python/cxxtest/__init__.py @@ -4,6 +4,7 @@ # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + +# ruff: noqa: F403 # Allow wild imports """cxxtest: A Python package that supports the CxxTest test framework for C/C++. .. _CxxTest: http://cxxtest.tigris.org/