diff --git a/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat new file mode 100755 index 0000000000000000000000000000000000000000..066b0a23b3556713734ebae3f6d559555fed69e3 --- /dev/null +++ b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat @@ -0,0 +1,35 @@ +@echo off +setlocal enableextensions +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Launch script for MantidPlot +:: +:: Sets the required environment variables for MantidPlot to run correctly. +:: All variables that are passed to this script are passed directly to +:: MantidPlot.exe +:: +:: It is not advised to start MantidPlot.exe directly as this is unlikely +:: to work. +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Set base paths +set _BIN_DIR=%~dp0 +:: Strip the trailing slash so that the ~dp expansion works as expected +set _BIN_DIR=%_BIN_DIR:~,-1% +for /f "delims=" %%I in ("%_BIN_DIR%") do ( + set _INSTALL_DIR=%%~dpI +) +set _INSTALL_DIR=%_INSTALL_DIR:~,-1% +set _EXTRA_PATH_DIRS=%_INSTALL_DIR%\bin;%_INSTALL_DIR%\PVPlugins;%_INSTALL_DIR%\plugins + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Required environment variables for Mantid +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +set MANTIDPATH=%_BIN_DIR% +set PATH=%_EXTRA_PATH_DIRS%;%PATH% +set PV_PLUGIN_PATH=%_INSTALL_DIR%\PVPlugins\PVPlugins + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Start MantidPlot +:: The working directory is whatever is set by the caller +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +start "MantidPlot" /B /WAIT %_BIN_DIR%\MantidPlot.exe %* diff --git a/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs new file mode 100644 index 0000000000000000000000000000000000000000..7d7f62d7fbf9927f9f916eaff0f4c76aad79c8b6 --- /dev/null +++ b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs @@ -0,0 +1,37 @@ +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +' Launch script for launch_mantidplot.bat +' +' This is primarily used when launching via an icon. It ensures that the main +' launch_mantiplot.bat script is started with a hidden cmd window and only the +' MantidPlot application is visible. +' +' When launched via a shell all output from this is captured and discarded. +' For that reason most work is done in the main .bat file that can be used +' to get output and check error codes. +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +Set WshShell = CreateObject("WScript.Shell") + +' Location of this script +Set fso = CreateObject("Scripting.FileSystemObject") +binDir = fso.GetParentFolderName(WScript.ScriptFullName) + +' Arguments - build a string. A straight join on Arguments is not possible +Set scriptArgs = WScript.Arguments +If scriptArgs.Count > 0 Then + ReDim argsArray(scriptArgs.Count-1) + For i = 0 To scriptArgs.Count-1 + argsArray(i) = scriptArgs(i) + Next + argStr = Join(argsArray) +Else + argStr = "" +End If + +' Assume that the launch bat file is alongside this one. +cmd = binDir & "\launch_mantidplot.bat" & chr(32) & argStr +WshShell.Run cmd, 0, false + +' Cleanup +Set fso = Nothing +Set scriptArgs = Nothing +Set WshShell = Nothing \ No newline at end of file diff --git a/Code/Mantid/Build/CMake/Packaging/mantidpython.bat b/Code/Mantid/Build/CMake/Packaging/mantidpython.bat new file mode 100755 index 0000000000000000000000000000000000000000..bf1beff97abb5b44d67eae709d1a8669c78ab4b5 --- /dev/null +++ b/Code/Mantid/Build/CMake/Packaging/mantidpython.bat @@ -0,0 +1,32 @@ +@echo off +setlocal enableextensions +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Launch script for command line python +:: +:: Sets the required environment variables for the Python to run correctly. +:: All variables that are passed to this script are passed directly to +:: python.exe +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Set base paths +set _BIN_DIR=%~dp0 +:: Strip the trailing slash so that the ~dp expansion works as expected +set _BIN_DIR=%_BIN_DIR:~,-1% +for /f "delims=" %%I in ("%_BIN_DIR%") do ( + set _INSTALL_DIR=%%~dpI +) +set _INSTALL_DIR=%_INSTALL_DIR:~,-1% +set _EXTRA_PATH_DIRS=%_INSTALL_DIR%\bin;%_INSTALL_DIR%\PVPlugins;%_INSTALL_DIR%\plugins + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Required environment variables for Mantid +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +set MANTIDPATH=%_BIN_DIR% +set PYTHONPATH=%MANTIDPATH%;%PYTHONPATH% +set PATH=%_EXTRA_PATH_DIRS%;%PATH% + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Start python +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +start "Mantid Python" /B /WAIT %_BIN_DIR%\python.exe %* + diff --git a/Code/Mantid/Build/CMake/WindowsNSIS.cmake b/Code/Mantid/Build/CMake/WindowsNSIS.cmake index a66bd3a8a273b4f3300e8124fb25d8d64acbba7c..db698b33d8b5d84c0a51de96318de584be0b5ffb 100644 --- a/Code/Mantid/Build/CMake/WindowsNSIS.cmake +++ b/Code/Mantid/Build/CMake/WindowsNSIS.cmake @@ -11,8 +11,6 @@ set( CPACK_NSIS_DISPLAY_NAME "Mantid${CPACK_PACKAGE_SUFFIX}") set( CPACK_PACKAGE_NAME "mantid${CPACK_PACKAGE_SUFFIX}" ) set( CPACK_PACKAGE_INSTALL_DIRECTORY "MantidInstall${CPACK_PACKAGE_SUFFIX}") set( CPACK_NSIS_INSTALL_ROOT "C:") -set( CPACK_PACKAGE_EXECUTABLES "MantidPlot;MantidPlot") -set( CPACK_NSIS_MENU_LINKS "bin\\\\MantidPlot.exe" "MantidPlot") set( CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Images\\\\MantidPlot_Icon_32offset.png" ) set( CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Images\\\\MantidPlot_Icon_32offset.ico" ) set( CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/Images\\\\MantidPlot_Icon_32offset.ico" ) @@ -163,114 +161,41 @@ install ( FILES ${CMAKE_LIBRARY_PATH}/PocoFoundation.lib ${CMAKE_LIBRARY_PATH}/P install ( FILES ${CMAKE_LIBRARY_PATH}/boost_date_time-vc110-mt-1_52.lib DESTINATION UserAlgorithms ) ########################################################################### -# Environment variables +# Startup files ########################################################################### -# Release deployments do modify environmental variables, other deployments do not. -if ( CPACK_PACKAGE_SUFFIX STREQUAL "" ) - # On install - set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS "Push \\\"MANTIDPATH\\\" - Push \\\"A\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\bin\\\" - Call EnvVarUpdate - Pop \\\$0 +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Build/CMake/Packaging/launch_mantidplot.bat DESTINATION bin ) +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Build/CMake/Packaging/launch_mantidplot.vbs DESTINATION bin ) +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Build/CMake/Packaging/mantidpython.bat DESTINATION bin ) - Push \\\"PATH\\\" - Push \\\"A\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\bin\\\" - Call EnvVarUpdate - Pop \\\$0 - - Push \\\"PATH\\\" - Push \\\"A\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PVPLUGINS_DIR}\\\" - Call EnvVarUpdate - Pop \\\$0 - - Push \\\"PATH\\\" - Push \\\"A\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PLUGINS_DIR}\\\" - Call EnvVarUpdate - Pop \\\$0 - - Push \\\"PV_PLUGIN_PATH\\\" - Push \\\"A\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PVPLUGINS_DIR}\\\\${PVPLUGINS_DIR}\\\" - Call EnvVarUpdate - Pop \\\$0 - - CreateShortCut \\\"$DESKTOP\\\\MantidPlot.lnk\\\" \\\"$INSTDIR\\\\bin\\\\MantidPlot.exe\\\" - - CreateDirectory \\\"$INSTDIR\\\\logs\\\" - - CreateDirectory \\\"$INSTDIR\\\\docs\\\" - ") - # On unistall reverse stages listed above. - set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - "Push \\\"PATH\\\" - Push \\\"R\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\bin\\\" - Call un.EnvVarUpdate - Pop \\\$0 - - Push \\\"PATH\\\" - Push \\\"R\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PVPLUGINS_DIR}\\\" - Call un.EnvVarUpdate - Pop \\\$0 - - Push \\\"PATH\\\" - Push \\\"R\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PLUGINS_DIR}\\\" - Call un.EnvVarUpdate - Pop \\\$0 - - Push \\\"MANTIDPATH\\\" - Push \\\"R\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\bin\\\" - Call un.EnvVarUpdate - Pop \\\$0 - - Push \\\"PV_PLUGIN_PATH\\\" - Push \\\"R\\\" - Push \\\"HKCU\\\" - Push \\\"$INSTDIR\\\\${PVPLUGINS_DIR}\\\\${PVPLUGINS_DIR}\\\" - Call un.EnvVarUpdate - Pop \\\$0 - - Delete \\\"$DESKTOP\\\\MantidPlot.lnk\\\" - - RMDir \\\"$INSTDIR\\\\logs\\\" - - RMDir \\\"$INSTDIR\\\\docs\\\" - ") -else () - set( CPACK_PACKAGE_INSTALL_DIRECTORY "MantidInstall${CPACK_PACKAGE_SUFFIX}") - set( CPACK_NSIS_INSTALL_ROOT "C:") - # On install - set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS - "CreateShortCut \\\"$DESKTOP\\\\MantidPlot.lnk\\\" \\\"$INSTDIR\\\\bin\\\\MantidPlot.exe\\\" - - CreateDirectory \\\"$INSTDIR\\\\logs\\\" - - CreateDirectory \\\"$INSTDIR\\\\docs\\\" - " - ) - # On unistall reverse stages listed above. - set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - "Delete \\\"$DESKTOP\\\\MantidPlot.lnk\\\" - - RMDir \\\"$INSTDIR\\\\logs\\\" - - RMDir \\\"$INSTDIR\\\\docs\\\" - " - ) -endif() +########################################################################### +# Extra NSIS commands for shortcuts, start menu items etc +# Three backward slashes are required to escape a character to get the +# character through to NSIS. +########################################################################### +# On install. The blank lines seem to be required or it doesn't create the shortcut +set (CPACK_NSIS_CREATE_ICONS_EXTRA " + CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\MantidPlot.lnk\\\" \\\"$INSTDIR\\\\bin\\\\launch_mantidplot.vbs\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\MantidPlot.exe\\\" 0 + + CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\MantidPython.lnk\\\" \\\"$INSTDIR\\\\bin\\\\mantidpython.bat\\\" +") +set (CPACK_NSIS_DELETE_ICONS_EXTRA " + Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\MantidPlot.lnk\\\" + Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\MantidPython.lnk\\\" +") +# The blank lines seem to be required or it doesn't create the shortcut +set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS " + CreateShortCut \\\"$DESKTOP\\\\MantidPlot.lnk\\\" \\\"$INSTDIR\\\\bin\\\\launch_mantidplot.vbs\\\" \\\"\\\" \\\"$INSTDIR\\\\bin\\\\MantidPlot.exe\\\" 0 + + CreateShortCut \\\"$DESKTOP\\\\MantidPython.lnk\\\" \\\"$INSTDIR\\\\bin\\\\mantidpython.bat\\\" + + CreateDirectory \\\"$INSTDIR\\\\logs\\\" + + CreateDirectory \\\"$INSTDIR\\\\docs\\\" +") +# On uninstall reverse stages listed above. +set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " + Delete \\\"$DESKTOP\\\\MantidPlot.lnk\\\" + Delete \\\"$DESKTOP\\\\MantidPython.lnk\\\" + RMDir \\\"$INSTDIR\\\\logs\\\" + RMDir \\\"$INSTDIR\\\\docs\\\" +") diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h index 06c2d99e773de45c0c6a9264d644e61618da3514..e4dad97580ddaa1d31c2a63add10fecba1f79cdc 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h @@ -18,6 +18,7 @@ namespace API { /// version. struct Algorithm_descriptor { std::string name; ///< name + std::string alias; ///< alias std::string category; ///< category int version; ///< version }; diff --git a/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp b/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp index 2148a8b52d6e6dd855383a7ea8d64c3eabdc5b0b..d2dda0b8c35f4007940444c9a964223f88d4584e 100644 --- a/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp +++ b/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp @@ -350,6 +350,7 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const { boost::shared_ptr<IAlgorithm> alg = create(desc.name, desc.version); std::vector<std::string> categories = alg->categories(); + desc.alias = alg->alias(); // For each category auto itCategoriesEnd = categories.end(); diff --git a/Code/Mantid/Framework/API/test/AlgorithmFactoryTest.h b/Code/Mantid/Framework/API/test/AlgorithmFactoryTest.h index 1314ee8fc8fa2eedb5f9f9a769910e90499f4d62..540c2555904325212c2d7ade23e28d4ee1860f72 100644 --- a/Code/Mantid/Framework/API/test/AlgorithmFactoryTest.h +++ b/Code/Mantid/Framework/API/test/AlgorithmFactoryTest.h @@ -25,7 +25,7 @@ public: { Mantid::Kernel::Instantiator<ToyAlgorithmTwo, Algorithm>* newTwo = new Mantid::Kernel::Instantiator<ToyAlgorithmTwo, Algorithm>; - //get the nubmer of algorithms it already has + //get the number of algorithms it already has std::vector<std::string> keys = AlgorithmFactory::Instance().getKeys(); size_t noOfAlgs = keys.size(); @@ -34,7 +34,7 @@ public: TS_ASSERT_THROWS_ANYTHING(AlgorithmFactory::Instance().subscribe<ToyAlgorithm>()); - //get the nubmer of algorithms it has now + //get the number of algorithms it has now keys = AlgorithmFactory::Instance().getKeys(); size_t noOfAlgsAfter = keys.size(); TS_ASSERT_EQUALS(noOfAlgsAfter, noOfAlgs + 2); @@ -160,7 +160,10 @@ public: bool foundAlg = false; while (descItr != descriptors.end() && !foundAlg) { - foundAlg = ("Cat" == descItr->category)&&("ToyAlgorithm" == descItr->name)&&(1 == descItr->version); + foundAlg = ("Cat" == descItr->category) && + ("ToyAlgorithm" == descItr->name) && + ("Dog" == descItr->alias) && + (1 == descItr->version); descItr++; } TS_ASSERT(foundAlg); @@ -170,7 +173,7 @@ public: TS_ASSERT_THROWS_NOTHING(descriptors = AlgorithmFactory::Instance().getDescriptors(true)); TS_ASSERT_EQUALS(noOfAlgs - 1, descriptors.size()); - } + } void testGetCategories() { diff --git a/Code/Mantid/Framework/CMakeLists.txt b/Code/Mantid/Framework/CMakeLists.txt index 078f61da42f3a515c4e648e7e5b33be3e21d6c8f..32aab9ba99148be845b9e6e429da3841cd658686 100644 --- a/Code/Mantid/Framework/CMakeLists.txt +++ b/Code/Mantid/Framework/CMakeLists.txt @@ -156,7 +156,8 @@ install ( DIRECTORY ../instrument/ DESTINATION ${INBUNDLE}instrument DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE GROUP_WRITE WORLD_READ WORLD_EXECUTE WORLD_WRITE - PATTERN "*UNIT_TESTING*" EXCLUDE + PATTERN "*UNIT_TESTING*" EXCLUDE + PATTERN ".gitignore" EXCLUDE ) # Ships .py files but only ship compiled pyd files for supported platforms. diff --git a/Code/Mantid/Framework/DataObjects/CMakeLists.txt b/Code/Mantid/Framework/DataObjects/CMakeLists.txt index 847b0ae0f677cec8c60591485c86f6a7f269990c..205cbd846eac75d780f5068054cd6d2889fcf120 100644 --- a/Code/Mantid/Framework/DataObjects/CMakeLists.txt +++ b/Code/Mantid/Framework/DataObjects/CMakeLists.txt @@ -220,10 +220,5 @@ add_subdirectory ( test ) # Installation settings ########################################################################### -if ( WIN32 ) - install ( TARGETS DataObjects ${SYSTEM_PACKAGE_TARGET} DESTINATION ${PLUGINS_DIR} ) -else() - install ( TARGETS DataObjects DESTINATION ${LIB_DIR} ) -endif () - +install ( TARGETS DataObjects ${SYSTEM_PACKAGE_TARGET} DESTINATION ${LIB_DIR} ) diff --git a/Code/Mantid/Framework/PostInstall/CMakeLists.txt b/Code/Mantid/Framework/PostInstall/CMakeLists.txt index 676eb6bf5ecab7ee9c88707c93bece64e36cd6ac..46d87820397732d53bdd9b394f9cebe443e11e9b 100644 --- a/Code/Mantid/Framework/PostInstall/CMakeLists.txt +++ b/Code/Mantid/Framework/PostInstall/CMakeLists.txt @@ -18,6 +18,6 @@ set ( PACKAGE_ROOT \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX} ) set ( EXCLUDE_REGEX ".*_template|.*port_v3" ) set ( COMPILE_SCRIPT "message ( \"Byte-compiling Python in ${PACKAGE_ROOT}\")" ) -set ( COMPILE_SCRIPT "${COMPILE_SCRIPT}\n execute_process ( COMMAND ${PYTHON_EXECUTABLE} -m compileall -q -x \"${EXCLUDE_REGEX}\" \"${PACKAGE_ROOT}\")" ) +set ( COMPILE_SCRIPT "${COMPILE_SCRIPT}\n execute_process ( COMMAND ${PYTHON_EXECUTABLE} -m compileall -q -x \"${EXCLUDE_REGEX}\" \"${PACKAGE_ROOT}\" OUTPUT_QUIET ERROR_QUIET )" ) install ( CODE ${COMPILE_SCRIPT} ) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py new file mode 100644 index 0000000000000000000000000000000000000000..eee7a42a9a76c7ad0a73461c8704bb6ffb6d809f --- /dev/null +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/ApplyNegMuCorrection.py @@ -0,0 +1,96 @@ +from mantid.api import * # PythonAlgorithm, registerAlgorithm, WorkspaceProperty + +#pylint: disable=no-init, too-many-arguments +class ApplyNegMuCorrection(PythonAlgorithm): + + #Combining work spaces and normalising the correction. + #_OILE and _OIHE are unused parameters for now to make PyLint happy + def combine(self,dataDir,runno,A2000,B2000,A3000,B3000,_OILE,_OIHE,spec): + if spec<10: + specNo='0'+str(spec) + else: + specNo=str(spec) + print dataDir+'ral0'+runno+'.rooth30'+specNo+'.dat' + #loading data + rooth30_filename = dataDir+r'\ral0'+runno+'.rooth30'+specNo+'.dat' + rooth20_filename = dataDir+r'\ral0'+runno+'.rooth20'+specNo+'.dat' + try: + ws3000=Load(Filename=rooth30_filename, OutputWorkspace='ws3000') + except RuntimeError: + raise RuntimeError('could not find file: ' + rooth30_filename) + try: + ws2000=Load(Filename=rooth20_filename, OutputWorkspace='ws2000') + except RuntimeError: + raise RuntimeError('could not find file: ' + rooth20_filename) + + #Correcting for Gain and offset of the detectors + ws2000_corr=CreateWorkspace(A2000*ws2000.readX(0)[:]+B2000,ws2000.readY(0)[:]) + ws3000_corr=CreateWorkspace(A3000*ws3000.readX(0)[:]+B3000,ws3000.readY(0)[:]) + + #Summing total counts for normalisation + ws2000_total=0 + ws3000_total=0 + for count in range (0,8000): + ws2000_total=ws2000_corr.readY(0)[count]+ws2000_total + ws3000_total=ws3000_corr.readY(0)[count]+ws3000_total + print ws2000_total + print ws3000_total + #normalising + ws2000_corr=ws2000_corr/ws2000_total + ws3000_corr=ws3000_corr/ws3000_total + + #rebinning to adataDir detectors together + data =[100,ws2000.readX(0)[2]-ws2000.readX(0)[1],8000] + + ws2000_corr_rebin=Rebin(ws2000_corr,data) + ws3000_corr_rebin=Rebin(ws3000_corr,data) + + ws_ral=Plus(ws2000_corr_rebin,ws3000_corr_rebin) + + suf='_'+str(spec)+'_'+runno + + RenameWorkspaces(ws_ral,Suffix=suf) + RenameWorkspaces(ws2000_corr,Suffix=suf) + RenameWorkspaces(ws3000_corr,Suffix=suf) + + DeleteWorkspace(ws2000) + DeleteWorkspace(ws3000) + DeleteWorkspace(ws2000_corr_rebin) + DeleteWorkspace(ws3000_corr_rebin) + + def PyInit(self): + self.declareProperty(name="DataDirectory",defaultValue=r'M:\Data\Negative Muons\forMantid',doc="Data directory") + self.declareProperty(name="FirstRunNumber",defaultValue=1718,doc="First Run Number") + self.declareProperty(name="LastRunNumber",defaultValue=1719,doc="Last Run Number") + self.declareProperty(name="GainRIKENHighE",defaultValue=1.077,doc="Gain RIKEN High E") + self.declareProperty(name="OffsetRIKENHighE",defaultValue=-1,doc="OffSet RIKEN High E") + self.declareProperty(name="GainISISHighE",defaultValue=1.278,doc="Gain ISIS High E") + self.declareProperty(name="OffsetISISHighE",defaultValue=-12,doc="OffSet ISIS High E") + self.declareProperty(name="GainISISLowE",defaultValue=1.2,doc="Gain ISIS Low E") + self.declareProperty(name="OffsetISISLowE",defaultValue=0.0,doc="OffSet ISIS Low E") + + def category(self): + return "CorrectionFunctions;Muon" + + def PyExec(self): + + spec=1 + dataDir = self.getProperty("DataDirectory").value + first = self.getProperty("FirstRunNumber").value + last = self.getProperty("LastRunNumber").value+1 + GRHE=self.getProperty("GainRIKENHighE").value + ORHE=self.getProperty("OffsetRIKENHighE").value + GIHE=self.getProperty("GainISISHighE").value + OIHE=self.getProperty("OffsetISISHighE").value + GILE=self.getProperty("GainISISLowE").value + OILE=self.getProperty("OffsetISISLowE").value + + for run in range(first,last): + for spec in range(0,3): + runno=str(run) + self.combine(dataDir,runno,GRHE,ORHE,GIHE,OIHE,GILE,OILE,spec) + self.combine(dataDir,runno,GRHE,ORHE,GIHE,OIHE,GILE,OILE,10) + + + +AlgorithmFactory.subscribe(ApplyNegMuCorrection) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CollectHB3AExperimentInfo.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CollectHB3AExperimentInfo.py index c8b34a5ff82fc3b792e09d7fb411f9b636c9b18e..34a60e2a87299e75f0ee8c13a76521599723d0d8 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CollectHB3AExperimentInfo.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CollectHB3AExperimentInfo.py @@ -307,7 +307,7 @@ class CollectHB3AExperimentInfo(PythonAlgorithm): self.log().notice("[DB] Load SPICE file %s to %s." % (xmlfilename, outwsname)) dataws = api.LoadSpiceXML2DDet(Filename=xmlfilename, LoadInstrument=True, - OutputWorkspace=outwsname, DetectorGeometry='256,256') + OutputWorkspace=outwsname, DetectorGeometry='256,256') return dataws diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py index e56af5905cef796d38848bcd9072d859590517d6..5470e2a9f315bd13bd86ea881799b284fb131491 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection.py @@ -50,8 +50,8 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()]) self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', - direction=Direction.Input, - validator=ws_validator), + direction=Direction.Input, + validator=ws_validator), doc='Name for the input sample workspace') self.declareProperty(name='SampleChemicalFormula', defaultValue='', @@ -66,9 +66,9 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): doc='Sample outer radius') self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', - direction=Direction.Input, - optional=PropertyMode.Optional, - validator=ws_validator), + direction=Direction.Input, + optional=PropertyMode.Optional, + validator=ws_validator), doc="Name for the input container workspace") self.declareProperty(name='CanChemicalFormula', defaultValue='', @@ -96,7 +96,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): doc='Analyser energy') self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '', - direction=Direction.Output), + direction=Direction.Output), doc='The output corrections workspace group') #------------------------------------------------------------------------------ @@ -165,8 +165,8 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): for angle_idx in range(number_angles): kill, ass, assc, acsc, acc = cylabs.cylabs(self._step_size, beam, ncan, radii, - density, sigs, siga, self._angles[angle_idx], self._elastic, self._waves, angle_idx, wrk, 0) - + density, sigs, siga, self._angles[angle_idx], + self._elastic, self._waves, angle_idx, wrk, 0) if kill == 0: logger.information('Angle %d: %f successful' % (angle_idx+1, self._angles[angle_idx])) @@ -179,7 +179,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): raise ValueError('Angle ' + str(angle_idx) + ' : ' + str(self._angles[angle_idx]) + ' *** failed : Error code ' + str(kill)) sample_logs = {'sample_shape': 'cylinder', 'sample_filename': self._sample_ws_name, - 'sample_inner_radius': self._sample_inner_radius, 'sample_outer_radius': self._sample_outer_radius} + 'sample_inner_radius': self._sample_inner_radius, 'sample_outer_radius': self._sample_outer_radius} dataX = self._waves * number_angles # Create the output workspaces diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py index d400bb18af0edeb170ed6db9d4332d662e4c77a5..778c1c979806f2612571956a87b588871a81f989 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/CylinderPaalmanPingsCorrection2.py @@ -55,8 +55,8 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): ws_validator = CompositeValidator([WorkspaceUnitValidator('Wavelength'), InstrumentValidator()]) self.declareProperty(MatrixWorkspaceProperty('SampleWorkspace', '', - validator=ws_validator, - direction=Direction.Input), + validator=ws_validator, + direction=Direction.Input), doc="Name for the input Sample workspace.") self.declareProperty(name='SampleChemicalFormula', defaultValue='', @@ -73,9 +73,9 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): doc='Sample outer radius') self.declareProperty(MatrixWorkspaceProperty('CanWorkspace', '', - optional=PropertyMode.Optional, - validator=ws_validator, - direction=Direction.Input), + optional=PropertyMode.Optional, + validator=ws_validator, + direction=Direction.Input), doc="Name for the input Can workspace.") self.declareProperty(name='CanChemicalFormula', defaultValue='', @@ -110,7 +110,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): doc='Analyser energy') self.declareProperty(WorkspaceGroupProperty('OutputWorkspace', '', - direction=Direction.Output), + direction=Direction.Output), doc='The output corrections workspace group') #------------------------------------------------------------------------------ @@ -241,8 +241,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): if (self._radii[1] - self._radii[0]) < 1e-4: raise ValueError('Sample outer radius not > inner radius') else: - logger.information('Sample : inner radius = %f ; outer radius = %f' % ( - self._radii[0], self._radii[1])) + logger.information('Sample : inner radius = %f ; outer radius = %f' % (self._radii[0], self._radii[1])) self._ms = int((self._radii[1] - self._radii[0] + 0.0001)/self._step_size) if self._ms < 20: raise ValueError('Number of steps ( %i ) should be >= 20' % (self._ms)) @@ -255,8 +254,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): if (self._radii[2] - self._radii[1]) < 1e-4: raise ValueError('Can outer radius not > sample outer radius') else: - logger.information('Can : inner radius = %f ; outer radius = %f' % ( - self._radii[1], self._radii[2])) + logger.information('Can : inner radius = %f ; outer radius = %f' % (self._radii[1], self._radii[2])) beam_width = self.getProperty('BeamWidth').value beam_height = self.getProperty('BeamHeight').value @@ -316,8 +314,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): detector = mtd[self._sample_ws_name].getDetector(index) two_theta = detector.getTwoTheta(sample_pos, beam_pos) * 180.0 / math.pi self._angles.append(two_theta) - logger.information('Detector angles : %i from %f to %f ' % ( - len(self._angles), self._angles[0], self._angles[-1])) + logger.information('Detector angles : %i from %f to %f ' % (len(self._angles), self._angles[0], self._angles[-1])) #------------------------------------------------------------------------------ @@ -344,8 +341,7 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): self._elastic = math.sqrt(81.787/self._efixed) # elastic wavelength logger.information('Elastic lambda : %f' % (self._elastic)) - logger.information('Lambda : %i values from %f to %f' % ( - len(self._waves), self._waves[0], self._waves[-1])) + logger.information('Lambda : %i values from %f to %f' % (len(self._waves), self._waves[0], self._waves[-1])) #------------------------------------------------------------------------------ @@ -436,9 +432,9 @@ class CylinderPaalmanPingsCorrection(PythonAlgorithm): # No. STEPS ARE CHOSEN SO THAT STEP WIDTH IS THE SAME FOR ALL ANNULI # AAAA, BBBA, Area_A = self._sum_rom(0, 0, A, self._radii[0], self._radii[1], self._ms, - theta, amu_scat, amu_tot_i, amu_tot_s) + theta, amu_scat, amu_tot_i, amu_tot_s) AAAB, BBBB, Area_B = self._sum_rom(0, 0, -A, self._radii[0], self._radii[1], self._ms, - theta, amu_scat, amu_tot_i, amu_tot_s) + theta, amu_scat, amu_tot_i, amu_tot_s) Area_s += Area_A + Area_B Ass += AAAA + AAAB Ass = Ass/Area_s diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py index a398b8e381146ffbce9bb7459d8e946897962486..1125fff13be22ee5d468dd1769f928ae60873931 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/EnggVanadiumCorrections.py @@ -32,7 +32,7 @@ class EnggVanadiumCorrections(PythonAlgorithm): "Workspace with the reference Vanadium diffraction data.") self.declareProperty(ITableWorkspaceProperty("OutIntegrationWorkspace", "", Direction.Output, - PropertyMode.Optional), + PropertyMode.Optional), 'Output integration workspace produced when given an input Vanadium workspace') self.declareProperty(MatrixWorkspaceProperty("OutCurvesWorkspace", "", Direction.Output, @@ -40,7 +40,7 @@ class EnggVanadiumCorrections(PythonAlgorithm): 'Output curves workspace produced when given an input Vanadium workspace') self.declareProperty(ITableWorkspaceProperty("IntegrationWorkspace", "", Direction.Input, - PropertyMode.Optional), + PropertyMode.Optional), "Workspace with the integrated values for every spectra of the reference " "Vanadium diffraction data. One row per spectrum.") diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/GetNuMegMuonicXRD.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/GetNuMegMuonicXRD.py index bdac92be1a4cf02891362271bb6e06cd8aa7747d..fc6876d6d85f99da66dd38b95cf16800e8de6985 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/GetNuMegMuonicXRD.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/GetNuMegMuonicXRD.py @@ -5,27 +5,25 @@ from mantid.kernel import * class GetNegMuMuonicXRD(PythonAlgorithm): #Dictionary of <element>:<peaks> easily extendible by user. Muonic_XR={'Au' :[8135.2,8090.6,8105.4,8069.4,5764.89,5594.97,3360.2, - 3206.8,2474.22,2341.21,2304.44,1436.05,1391.58,1104.9, - 899.14,869.98,405.654,400.143], - 'Ag': [3184.7,3147.7,901.2,869.2,308.428,304.759], + 3206.8,2474.22,2341.21,2304.44,1436.05,1391.58,1104.9, + 899.14,869.98,405.654,400.143], + 'Ag' :[3184.7,3147.7,901.2,869.2,308.428,304.759], 'Cu' :[1512.78,1506.61,334.8,330.26], 'Zn' :[1600.15,1592.97,360.75,354.29], 'Pb' :[8523.3,8442.11,5966.0,5780.1,2641.8,2499.7, - 2459.7,1511.63,1214.12,1028.83,972.3,938.4, - 437.687,431.285], - 'As' : [1866.9,1855.8,436.6,427.5], - 'Sn' : [3457.3,3412.8,1022.6,982.5,349.953,345.226]} + 2459.7,1511.63,1214.12,1028.83,972.3,938.4, + 437.687,431.285], + 'As' :[1866.9,1855.8,436.6,427.5], + 'Sn' :[3457.3,3412.8,1022.6,982.5,349.953,345.226]} def PyInit(self): element_type = self.Muonic_XR.keys() self.declareProperty("ElementList", "None", StringListValidator(element_type), doc="List of available elements") - self.declareProperty(StringArrayProperty("Elements", values=[], - direction=Direction.Input - )) + self.declareProperty(StringArrayProperty("Elements", values=[],direction=Direction.Input)) self.declareProperty(name="YAxisPosition", - defaultValue=-0.001, - doc="Position for Markers on the y-axis") + defaultValue=-0.001, + doc="Position for Markers on the y-axis") def get_Muonic_XR(self, element): #retrieve peak values from dictionary Muonic_XR diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/MuscatSofQW.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/MuscatSofQW.py index a2e755b52a5011ce6c15cb422a3199b17f39b3ce..ba2ba8f585e53e36e347ba5acb038605150fc2f6 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/MuscatSofQW.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/MuscatSofQW.py @@ -86,8 +86,7 @@ class MuscatSofQW(DataProcessorAlgorithm): pk_1 = '(composite=Convolution,FixResolution=true,NumDeriv=true;name=Resolution, Workspace="{0}"'.format(self._res_rebin) if self._lor >= 1: - lor_fun = 'composite=ProductFunction,NumDeriv=false;name=Lorentzian,Amplitude={0},PeakCentre=0.0,FWHM={1}'.format( - l_height_1[peak_idx], l_width_1[peak_idx]) + lor_fun = 'composite=ProductFunction,NumDeriv=false;name=Lorentzian,Amplitude={0},PeakCentre=0.0,FWHM={1}'.format(l_height_1[peak_idx], l_width_1[peak_idx]) elif self._lor == 2: funcIndex = 1 if self._delta else 0 lor_2 = 'name=Lorentzian,Amplitude='+str(l_height_2[peak_idx])+',PeakCentre=0.0,FWHM='+str(l_width_2[peak_idx]) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py index 6dad626d2e4b59868a087603f13ac5cc20e28276..fc52059afd2a3e5add103dc01d5c6b43e00c54af 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ElasticWindowMultiple.py @@ -338,7 +338,7 @@ class ElasticWindowMultiple(DataProcessorAlgorithm): tmp = run[self._sample_log_name].value value_action = {'last_value': lambda x: x[len(x)-1], 'average': lambda x: x.mean() - } + } temp = value_action[self._sample_log_value](tmp) logger.debug('Temperature %d K found for run: %s' % (temp, run_name)) return temp diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py index e37bc82f11c195edd6ec9a46c3befc085d3bf9e7..0078c24b00e7f701b4e0f6b45165aa2d4720f356 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/OSIRISDiffractionReduction.py @@ -22,17 +22,17 @@ class DRange(object): TIME_REGIME_TO_DRANGE = { - 1.17e4: DRange( 0.7, 2.5), - 2.94e4: DRange( 2.1, 3.3), - 4.71e4: DRange( 3.1, 4.3), - 6.48e4: DRange( 4.1, 5.3), - 8.25e4: DRange( 5.2, 6.2), - 10.02e4: DRange( 6.2, 7.3), - 11.79e4: DRange( 7.3, 8.3), - 13.55e4: DRange( 8.3, 9.5), - 15.32e4: DRange( 9.4, 10.6), - 17.09e4: DRange(10.4, 11.6), - 18.86e4: DRange(11.0, 12.5) + 1.17e4: DRange( 0.7, 2.5), + 2.94e4: DRange( 2.1, 3.3), + 4.71e4: DRange( 3.1, 4.3), + 6.48e4: DRange( 4.1, 5.3), + 8.25e4: DRange( 5.2, 6.2), + 10.02e4: DRange( 6.2, 7.3), + 11.79e4: DRange( 7.3, 8.3), + 13.55e4: DRange( 8.3, 9.5), + 15.32e4: DRange( 9.4, 10.6), + 17.09e4: DRange(10.4, 11.6), + 18.86e4: DRange(11.0, 12.5) } diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt b/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt index 8c536b09c7e34ea631e17ab2fb8a7622d8f76b3f..afe702eeb7b06de641e8a1a4185c71997428c3ad 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt @@ -9,6 +9,7 @@ set ( SRC_FILES src/DgsReduction.cpp src/DgsRemap.cpp src/EQSANSDarkCurrentSubtraction.cpp + src/EQSANSDarkCurrentSubtraction2.cpp src/EQSANSInstrument.cpp src/EQSANSLoad.cpp src/EQSANSMonitorTOF.cpp @@ -49,6 +50,7 @@ set ( INC_FILES inc/MantidWorkflowAlgorithms/DgsReduction.h inc/MantidWorkflowAlgorithms/DgsRemap.h inc/MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction.h + inc/MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction2.h inc/MantidWorkflowAlgorithms/EQSANSInstrument.h inc/MantidWorkflowAlgorithms/EQSANSLoad.h inc/MantidWorkflowAlgorithms/EQSANSMonitorTOF.h diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction2.h b/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction2.h new file mode 100644 index 0000000000000000000000000000000000000000..3dc5d31e67411786c7498e2531de8a0b0118c333 --- /dev/null +++ b/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction2.h @@ -0,0 +1,65 @@ +#ifndef MANTID_ALGORITHMS_EQSANSDarkCurrentSubtraction2_H_ +#define MANTID_ALGORITHMS_EQSANSDarkCurrentSubtraction2_H_ + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#include "MantidAPI/Algorithm.h" + +namespace Mantid { +namespace WorkflowAlgorithms { +/** + + Subtract dark current for EQSANS. + + Required Properties: + <UL> + <LI> InputWorkspace - The name of the workspace to take as input </LI> + <LI> OutputWorkspace - The name of the workspace in which to store the + result </LI> + </UL> + + Optional Properties: + <UL> + <LI> Filename - Data file to use as dark current</LI> + <LI> ReductionTableWorkspace - Table workspace to use to keep track of the + reduction</LI> + <LI> OutputDarkCurrentWorkspace - Name of dark current workspace</LI> + <LI> OutputMessage - Human readable output message</LI> + </UL> + + File change history is stored at: <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class DLLExport EQSANSDarkCurrentSubtraction2 : public API::Algorithm { +public: + /// (Empty) Constructor + EQSANSDarkCurrentSubtraction2() : API::Algorithm() {} + /// Virtual destructor + virtual ~EQSANSDarkCurrentSubtraction2() {} + /// Algorithm's name + virtual const std::string name() const { + return "EQSANSDarkCurrentSubtraction"; + } + /// Summary of algorithms purpose + virtual const std::string summary() const { + return "Perform EQSANS dark current subtraction."; + } + /// Algorithm's version + virtual int version() const { return (2); } + /// Algorithm's category for identification + virtual const std::string category() const { + return "Workflow\\SANS\\UsesPropertyManager"; + } + +private: + /// Initialisation code + void init(); + /// Execution code + void exec(); +}; + +} // namespace Algorithms +} // namespace Mantid + +#endif /*MANTID_ALGORITHMS_EQSANSDarkCurrentSubtraction2_H_*/ diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/LoadEventAndCompress.h b/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/LoadEventAndCompress.h index 10768255f19289093c85887e3d7e880601097ab8..ddb195308a36fd6aadc9a88adcf89d4c7ed2cc04 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/LoadEventAndCompress.h +++ b/Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/LoadEventAndCompress.h @@ -44,7 +44,7 @@ public: protected: API::ITableWorkspace_sptr determineChunk(const std::string &filename); API::MatrixWorkspace_sptr loadChunk(const size_t rowIndex); - void processChunk(API::MatrixWorkspace_sptr wksp); + API::MatrixWorkspace_sptr processChunk(API::MatrixWorkspace_sptr wksp); private: void init(); diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..53a441cd5e8065b6eea6afbcf16ef5d238f18d8d --- /dev/null +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp @@ -0,0 +1,218 @@ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#include "MantidWorkflowAlgorithms/EQSANSDarkCurrentSubtraction2.h" +#include "MantidDataObjects/EventWorkspace.h" +#include "MantidAPI/WorkspaceValidators.h" +#include "MantidKernel/TimeSeriesProperty.h" +#include "MantidAPI/FileProperty.h" +#include "Poco/Path.h" +#include "Poco/String.h" +#include "MantidAPI/AlgorithmProperty.h" +#include "MantidAPI/PropertyManagerDataService.h" +#include "MantidKernel/PropertyManager.h" + +namespace Mantid { +namespace WorkflowAlgorithms { + +// Register the algorithm into the AlgorithmFactory +DECLARE_ALGORITHM(EQSANSDarkCurrentSubtraction2) + +using namespace Kernel; +using namespace API; +using namespace Geometry; +using namespace DataObjects; + +void EQSANSDarkCurrentSubtraction2::init() { + auto wsValidator = boost::make_shared<CompositeValidator>(); + wsValidator->add<WorkspaceUnitValidator>("Wavelength"); + declareProperty(new WorkspaceProperty<>("InputWorkspace", "", + Direction::Input, wsValidator)); + + declareProperty( + new API::FileProperty("Filename", "", API::FileProperty::Load, + "_event.nxs"), + "The name of the input event Nexus file to load as dark current."); + + declareProperty( + new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output)); + declareProperty("PersistentCorrection", true, + "If true, the algorithm will be persistent and re-used when " + "other data sets are processed"); + declareProperty("ReductionProperties", "__sans_reduction_properties", + Direction::Input); + declareProperty(new WorkspaceProperty<MatrixWorkspace>( + "OutputDarkCurrentWorkspace", "", Direction::Output, + PropertyMode::Optional)); + declareProperty("OutputMessage", "", Direction::Output); +} + +void EQSANSDarkCurrentSubtraction2::exec() { + std::string output_message = ""; + // Reduction property manager + const std::string reductionManagerName = getProperty("ReductionProperties"); + boost::shared_ptr<PropertyManager> reductionManager; + if (PropertyManagerDataService::Instance().doesExist(reductionManagerName)) { + reductionManager = + PropertyManagerDataService::Instance().retrieve(reductionManagerName); + } else { + reductionManager = boost::make_shared<PropertyManager>(); + PropertyManagerDataService::Instance().addOrReplace(reductionManagerName, + reductionManager); + } + + // If the load algorithm isn't in the reduction properties, add it + const bool persistent = getProperty("PersistentCorrection"); + if (!reductionManager->existsProperty("DarkCurrentAlgorithm") && persistent) { + AlgorithmProperty *algProp = new AlgorithmProperty("DarkCurrentAlgorithm"); + algProp->setValue(toString()); + reductionManager->declareProperty(algProp); + } + + Progress progress(this, 0.0, 1.0, 10); + + MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace"); + + const std::string fileName = getPropertyValue("Filename"); + MatrixWorkspace_sptr darkWS; + + progress.report("Subtracting dark current"); + + // Look for an entry for the dark current in the reduction table + Poco::Path path(fileName); + const std::string entryName = "DarkCurrent" + path.getBaseName(); + std::string darkWSName = "__dark_current_" + path.getBaseName(); + + if (reductionManager->existsProperty(entryName)) { + darkWS = reductionManager->getProperty(entryName); + darkWSName = reductionManager->getPropertyValue(entryName); + output_message += darkWSName + '\n'; + } else { + // Load the dark current if we don't have it already + IAlgorithm_sptr loadAlg; + if (!reductionManager->existsProperty("LoadAlgorithm")) { + loadAlg = createChildAlgorithm("EQSANSLoad", 0.1, 0.3); + loadAlg->setProperty("Filename", fileName); + if (loadAlg->existsProperty("LoadMonitors")) + loadAlg->setProperty("LoadMonitors", false); + loadAlg->executeAsChildAlg(); + darkWS = loadAlg->getProperty("OutputWorkspace"); + } else { + // Get load algorithm as a string so that we can create a completely + // new proxy and ensure that we don't overwrite existing properties + IAlgorithm_sptr loadAlg0 = reductionManager->getProperty("LoadAlgorithm"); + const std::string loadString = loadAlg0->toString(); + loadAlg = Algorithm::fromString(loadString); + loadAlg->setChild(true); + loadAlg->setProperty("Filename", fileName); + if (loadAlg->existsProperty("LoadMonitors")) + loadAlg->setProperty("LoadMonitors", false); + loadAlg->setPropertyValue("OutputWorkspace", darkWSName); + loadAlg->execute(); + darkWS = loadAlg->getProperty("OutputWorkspace"); + } + + output_message += "\n Loaded " + fileName + "\n"; + if (loadAlg->existsProperty("OutputMessage")) { + std::string msg = loadAlg->getPropertyValue("OutputMessage"); + output_message += " |" + Poco::replace(msg, "\n", "\n |") + "\n"; + } + + std::string darkWSOutputName = + getPropertyValue("OutputDarkCurrentWorkspace"); + if (!(darkWSOutputName.size() == 0)) + setProperty("OutputDarkCurrentWorkspace", darkWS); + AnalysisDataService::Instance().addOrReplace(darkWSName, darkWS); + reductionManager->declareProperty( + new WorkspaceProperty<>(entryName, "", Direction::Output)); + reductionManager->setPropertyValue(entryName, darkWSName); + reductionManager->setProperty(entryName, darkWS); + } + progress.report(3, "Loaded dark current"); + + // Normalize the dark current and data to counting time + double scaling_factor = 1.0; + if (inputWS->run().hasProperty("duration")) { + double duration = inputWS->run().getPropertyValueAsType<double>("duration"); + double dark_duration = darkWS->run().getPropertyValueAsType<double>("duration");; + scaling_factor = duration / dark_duration; + } else if (inputWS->run().hasProperty("proton_charge")) { + auto dp = inputWS->run().getTimeSeriesProperty<double>("proton_charge"); + double duration = dp->getStatistics().duration; + + dp = darkWS->run().getTimeSeriesProperty<double>("proton_charge"); + double dark_duration = dp->getStatistics().duration; + scaling_factor = duration / dark_duration; + } else if (inputWS->run().hasProperty("timer")) { + double duration = inputWS->run().getPropertyValueAsType<double>("timer"); + double dark_duration = darkWS->run().getPropertyValueAsType<double>("timer");; + scaling_factor = duration / dark_duration; + } else { + output_message += + "\n Could not find proton charge or duration in sample logs"; + g_log.error() + << "ERROR: Could not find proton charge or duration in sample logs" + << std::endl; + }; + // The scaling factor should account for the TOF cuts on each side of a frame + // The EQSANSLoad algorithm cuts the beginning and end of the TOF distribution + // so we don't need to correct the scaling factor here. When using LoadEventNexus + // we have to scale by (t_frame-t_low_cut-t_high_cut)/t_frame. + + progress.report("Scaling dark current"); + + // Get the dark current counts per pixel + IAlgorithm_sptr rebinAlg = createChildAlgorithm("Integration", 0.4, 0.5); + rebinAlg->setProperty("InputWorkspace", darkWS); + rebinAlg->setProperty("OutputWorkspace", darkWS); + rebinAlg->executeAsChildAlg(); + MatrixWorkspace_sptr scaledDarkWS = rebinAlg->getProperty("OutputWorkspace"); + + // Scale the dark current + IAlgorithm_sptr scaleAlg = createChildAlgorithm("Scale", 0.5, 0.6); + scaleAlg->setProperty("InputWorkspace", scaledDarkWS); + scaleAlg->setProperty("Factor", scaling_factor); + scaleAlg->setProperty("OutputWorkspace", scaledDarkWS); + scaleAlg->setProperty("Operation", "Multiply"); + scaleAlg->executeAsChildAlg(); + scaledDarkWS = rebinAlg->getProperty("OutputWorkspace"); + + // Scale the dark counts to the bin width and perform subtraction + const int numberOfSpectra = static_cast<int>(inputWS->getNumberHistograms()); + const int numberOfDarkSpectra = static_cast<int>(scaledDarkWS->getNumberHistograms()); + if (numberOfSpectra != numberOfDarkSpectra) { + g_log.error() << "Incompatible number of pixels between sample run and dark current" << std::endl; + } + const int nBins = static_cast<int>(inputWS->readY(0).size()); + const int xLength = static_cast<int>(inputWS->readX(0).size()); + if (xLength != nBins + 1) { + g_log.error() << "The input workspaces are expected to be histograms" << std::endl; + } + + progress.report("Subtracting dark current"); + // Loop over all tubes and patch as necessary + for (int i = 0; i < numberOfSpectra; i++) { + IDetector_const_sptr det = inputWS->getDetector(i); + // If this detector is a monitor, skip to the next one + if (det->isMasked()) + continue; + + const MantidVec &YDarkValues = scaledDarkWS->readY(i); + const MantidVec &YDarkErrors = scaledDarkWS->readE(i); + const MantidVec &XValues = inputWS->readX(i); + MantidVec &YValues = inputWS->dataY(i); + MantidVec &YErrors = inputWS->dataE(i); + for (int j = 0; j < nBins; j++) { + double bin_scale = (XValues[j+1] - XValues[j]) / (XValues[nBins] - XValues[0]); + YValues[j] -= YDarkValues[0] * bin_scale; + YErrors[j] = sqrt(YErrors[j] * YErrors[j] + YDarkErrors[0] * YDarkErrors[0] * bin_scale * bin_scale); + } + } + setProperty("OutputWorkspace", inputWS); + setProperty("OutputMessage", "Dark current subtracted: " + output_message); + + progress.report("Subtracted dark current"); +} + +} // namespace WorkflowAlgorithms +} // namespace Mantid diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp index c603ffdf9da6763846a6d2de7051e3359fb8915e..f1480cfed1fb35816a179b251e5ffde134f8d6f1 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp @@ -172,7 +172,8 @@ MatrixWorkspace_sptr LoadEventAndCompress::loadChunk(const size_t rowIndex) { * * @param wksp */ -void LoadEventAndCompress::processChunk(API::MatrixWorkspace_sptr wksp) { +API::MatrixWorkspace_sptr +LoadEventAndCompress::processChunk(API::MatrixWorkspace_sptr wksp) { EventWorkspace_sptr eventWS = boost::dynamic_pointer_cast<EventWorkspace>(wksp); @@ -182,12 +183,16 @@ void LoadEventAndCompress::processChunk(API::MatrixWorkspace_sptr wksp) { filterBadPulses->setProperty("OutputWorkspace", eventWS); filterBadPulses->setProperty("LowerCutoff", m_filterBadPulses); filterBadPulses->executeAsChildAlg(); + eventWS = filterBadPulses->getProperty("OutputWorkspace"); } auto compressEvents = createChildAlgorithm("CompressEvents"); compressEvents->setProperty("InputWorkspace", eventWS); compressEvents->setProperty("OutputWorkspace", eventWS); compressEvents->executeAsChildAlg(); + eventWS = compressEvents->getProperty("OutputWorkspace"); + + return eventWS; } //---------------------------------------------------------------------------------------------- @@ -202,19 +207,22 @@ void LoadEventAndCompress::exec() { // first run is free EventWorkspace_sptr resultWS = boost::dynamic_pointer_cast<EventWorkspace>(loadChunk(0)); - processChunk(resultWS); + resultWS = + boost::dynamic_pointer_cast<EventWorkspace>(processChunk(resultWS)); // load the other chunks const size_t numRows = m_chunkingTable->rowCount(); for (size_t i = 1; i < numRows; ++i) { MatrixWorkspace_sptr temp = loadChunk(i); - processChunk(temp); + temp = processChunk(temp); auto alg = createChildAlgorithm("Plus"); alg->setProperty("LHSWorkspace", resultWS); alg->setProperty("RHSWorkspace", temp); alg->setProperty("OutputWorkspace", resultWS); alg->setProperty("ClearRHSWorkspace", true); alg->executeAsChildAlg(); + temp = alg->getProperty("OutputWorkspace"); + resultWS = boost::dynamic_pointer_cast<EventWorkspace>(temp); } // Don't bother compressing combined workspace. DetermineChunking is designed diff --git a/Code/Mantid/Images/Mantid_Logo_Forum.pdn b/Code/Mantid/Images/Mantid_Logo_Forum.pdn new file mode 100644 index 0000000000000000000000000000000000000000..14f8e957d5f55c14b8e7dd6b2a6ffdac0219ab59 Binary files /dev/null and b/Code/Mantid/Images/Mantid_Logo_Forum.pdn differ diff --git a/Code/Mantid/Images/Mantid_Logo_Forum.png b/Code/Mantid/Images/Mantid_Logo_Forum.png new file mode 100644 index 0000000000000000000000000000000000000000..6746064bf0a8c7dfa3ea23297675950d7dddc0cc Binary files /dev/null and b/Code/Mantid/Images/Mantid_Logo_Forum.png differ diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h index 63f1567b5ba24e962fd42e1242bf42bd58a00972..be9200fa657c4f31ab225c513be5efd7bd5afff8 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/AlgorithmSelectorWidget.h @@ -5,13 +5,20 @@ #include "MantidAPI/AlgorithmFactory.h" #include "WidgetDllOption.h" +#include <vector> #include <Poco/NObserver.h> #include <QtGui> - //------------------------------------------------------------------------------ // Forward declaration //------------------------------------------------------------------------------ +namespace Mantid +{ +namespace API +{ + struct Algorithm_descriptor; +} +} namespace MantidQt { namespace MantidWidgets @@ -113,6 +120,10 @@ signals: protected: void keyPressEvent(QKeyEvent *e); + private: + typedef std::vector<Mantid::API::Algorithm_descriptor> AlgNamesType; + void addAliases(AlgNamesType& algNamesList); + QString stripAlias(const QString& text) const; }; diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp index c618119c4925111a5303e0bb5a15378a3023ecc4..3f48ee2a809db624236740eafe4b5499b512875a 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/AlgorithmSelectorWidget.cpp @@ -2,6 +2,8 @@ #include "MantidKernel/System.h" #include "MantidAPI/AlgorithmManager.h" +#include "boost/algorithm/string.hpp" + using namespace Mantid::Kernel; using namespace Mantid::API; @@ -55,7 +57,7 @@ namespace MantidWidgets layout->addLayout(buttonLayout); layout->addWidget(m_tree); - // The poco notification will be dispacted from the callers thread but we need to + // The poco notification will be dispatched from the callers thread but we need to // make sure the updates to the widgets happen on the GUI thread. Dispatching // through a Qt signal will make sure it is in the correct thread. AlgorithmFactory::Instance().notificationCenter.addObserver(m_updateObserver); @@ -322,7 +324,7 @@ namespace MantidWidgets else { QString cn = subCats[0]; - QTreeWidgetItem *catItem = 0; + QTreeWidgetItem *catItem = NULL; int n = subCats.size(); for(int j=0;j<n;j++) { @@ -377,13 +379,13 @@ namespace MantidWidgets QComboBox::keyPressEvent(e); } - //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- /** Update the list of algos in the combo box */ void FindAlgComboBox::update() { - typedef std::vector<Algorithm_descriptor> AlgNamesType; //include hidden categories in the combo list box AlgNamesType names = AlgorithmFactory::Instance().getDescriptors(true); + addAliases(names); // sort by algorithm names only to fill this combobox sort(names.begin(),names.end(),Algorithm_descriptor_name_less); @@ -399,6 +401,38 @@ namespace MantidWidgets this->setCurrentIndex(-1); } + + /** Adds alias entries to the list of algorithms */ + void FindAlgComboBox::addAliases(AlgNamesType& algNamesList) + { + AlgNamesType aliasList; + for(AlgNamesType::const_iterator i=algNamesList.begin();i!=algNamesList.end();++i) + { + //the alias is not empty and is not just different by case from the name + if ((!i->alias.empty()) && (!boost::iequals(i->alias,i->name))) + { + Algorithm_descriptor newAlias(*i); + newAlias.name = i->alias + " [" + i->name + "]"; + aliasList.push_back(newAlias); + } + } + //add them to the list - unsorted + algNamesList.reserve( algNamesList.size() + aliasList.size() ); + algNamesList.insert( algNamesList.end(), aliasList.begin(), aliasList.end() ); + } + + /** if a string is for an alias convert it to the algorithm name */ + QString FindAlgComboBox::stripAlias(const QString& text) const + { + QString retVal = text; + int foundOpen = text.indexOf("["); + if (foundOpen!=-1){ + int foundClose=text.lastIndexOf("]"); + if (foundClose!=-1) + retVal = text.mid(foundOpen+1, foundClose-foundOpen-1); + } + return retVal; + } //--------------------------------------------------------------------------- /** Return the selected algorithm */ @@ -413,6 +447,7 @@ namespace MantidWidgets if (matchedIndex > -1) { typedText = this->itemText(matchedIndex); //text in the combobox at the matched index + typedText = stripAlias(typedText); } } //set return values diff --git a/Code/Mantid/Testing/Data/DocTest/EQSANS_6071_event.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/EQSANS_6071_event.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..1bdb2ff8cfcfecb79d197266a2eb5f381f46a07a --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/EQSANS_6071_event.nxs.md5 @@ -0,0 +1 @@ +ac963bf816b36ca7353f6922ce856604 diff --git a/Code/Mantid/Testing/Data/DocTest/GEM38370_Focussed.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/GEM38370_Focussed.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..8b3eff95d1995a2a864ec295fc8b11a0c0e8cb41 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/GEM38370_Focussed.nxs.md5 @@ -0,0 +1 @@ +01acf5f7645c9901efece0ed8dd00ced diff --git a/Code/Mantid/Testing/Data/DocTest/GEM40979.raw.md5 b/Code/Mantid/Testing/Data/DocTest/GEM40979.raw.md5 new file mode 100644 index 0000000000000000000000000000000000000000..48fcaddffbc0eae7564ccacba91582fc5e3a789e --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/GEM40979.raw.md5 @@ -0,0 +1 @@ +6df0f1c2fc472af200eec43762e9a874 diff --git a/Code/Mantid/Testing/Data/DocTest/HRP39182.RAW.md5 b/Code/Mantid/Testing/Data/DocTest/HRP39182.RAW.md5 new file mode 100644 index 0000000000000000000000000000000000000000..5e148277d0301b15aac686f02cfee701332910de --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/HRP39182.RAW.md5 @@ -0,0 +1 @@ +b6f6a905288dd986b5340673d08f93cb diff --git a/Code/Mantid/Testing/Data/DocTest/LOQ48097.raw.md5 b/Code/Mantid/Testing/Data/DocTest/LOQ48097.raw.md5 new file mode 100644 index 0000000000000000000000000000000000000000..21355d16411f76572a78d001aaeb6de9fb3a978b --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/LOQ48097.raw.md5 @@ -0,0 +1 @@ +435f4d573bfe6e64b014223d793e02a2 diff --git a/Code/Mantid/Testing/Data/DocTest/LogWS.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/LogWS.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..2c541b454d8e05ca41d65f40d996d5992bd02ea7 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/LogWS.nxs.md5 @@ -0,0 +1 @@ +602cbf8646a81b25e221bba3fe691a93 diff --git a/Code/Mantid/Testing/Data/DocTest/MAR11015.raw.md5 b/Code/Mantid/Testing/Data/DocTest/MAR11015.raw.md5 new file mode 100644 index 0000000000000000000000000000000000000000..6596285d57fc01f8449bff67a40afa19a16438ea --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/MAR11015.raw.md5 @@ -0,0 +1 @@ +22402246b0d14072b1fd9e6d920c3bb6 diff --git a/Code/Mantid/Testing/Data/DocTest/MAR11060.raw.md5 b/Code/Mantid/Testing/Data/DocTest/MAR11060.raw.md5 new file mode 100644 index 0000000000000000000000000000000000000000..18eef2419f9e02871dfb575b62d5d60f16c8e955 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/MAR11060.raw.md5 @@ -0,0 +1 @@ +3541bd5715fb57d8cdf884c500d8e485 diff --git a/Code/Mantid/Testing/Data/DocTest/PG3_4871_event.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/PG3_4871_event.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..bf7dbc2c85dfcd02d59fd3d931a5db2016ddff02 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/PG3_4871_event.nxs.md5 @@ -0,0 +1 @@ +a3d0edcb36ab8e9e3342cd8a4440b779 diff --git a/Code/Mantid/Testing/Data/DocTest/SXD23767.raw.md5 b/Code/Mantid/Testing/Data/DocTest/SXD23767.raw.md5 new file mode 100644 index 0000000000000000000000000000000000000000..eff1660e91f420bacc8b9b3b3da67e6d41503c68 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/SXD23767.raw.md5 @@ -0,0 +1 @@ +3950f6d890c10dd67c320cab6054d3d8 diff --git a/Code/Mantid/Testing/Data/DocTest/Training_Exercise3a_SNS.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/Training_Exercise3a_SNS.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..4ac89fcb0f9965811ef1fbb8fa5e25b37cff0c65 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/Training_Exercise3a_SNS.nxs.md5 @@ -0,0 +1 @@ +fb38e6a49b8d90ad5cbe7ad5674ab09d diff --git a/Code/Mantid/Testing/Data/DocTest/Training_Exercise3b_SNS.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/Training_Exercise3b_SNS.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..c7e9172c23dd59999975dad327319e601eb59824 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/Training_Exercise3b_SNS.nxs.md5 @@ -0,0 +1 @@ +7906ac610fe7805b872dc47f19164a91 diff --git a/Code/Mantid/Testing/Data/DocTest/peaks_qLab.nxs.md5 b/Code/Mantid/Testing/Data/DocTest/peaks_qLab.nxs.md5 new file mode 100644 index 0000000000000000000000000000000000000000..23dc6f7b89a553df6920be689885c6cf6f5f2531 --- /dev/null +++ b/Code/Mantid/Testing/Data/DocTest/peaks_qLab.nxs.md5 @@ -0,0 +1 @@ +9ae79fe97b23970e6977217254207c60 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py index e92eb2ce790a19cc4f6cae7c962761a3c5bb86d2..176facd12fd724dfd39ada35300a742bcbd621f9 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ARCSReductionTest.py @@ -10,6 +10,10 @@ from numpy import * class ARCSReductionTest(stresstesting.MantidStressTest): + vanFile1='' + vanFile0='' + nxspeFile='' + def requiredFiles(self): return ["ARCS_23961_event.nxs","WBARCS.nxs"] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/BASISAutoReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/BASISAutoReduction.py index 7c999280f9683ea343b430c81b9b058d51245205..96d7cde15414977eff8d5c313750eb2255758f73 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/BASISAutoReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/BASISAutoReduction.py @@ -21,7 +21,29 @@ class BASISAutoReductionTest(stresstesting.MantidStressTest): autows_monitor = 'monitor_ws' Load(Filename='BSS_13387_event.nxs', OutputWorkspace=autows) LoadMask(Instrument='BASIS', OutputWorkspace='BASIS_MASK', InputFile='BASIS_AutoReduction_Mask.xml') - MaskDetectors(Workspace=autows, DetectorList="5,49,69,113,133,177,197,241,261,305,325,369,389,433,453,497,517,561,581,625,645,689,709,753,773,817,837,881,901,945,965,1009,1029,1073,1093,1137,1157,1201,1221,1265,1285,1329,1349,1393,1413,1457,1477,1521,1541,1585,1605,1649,1669,1713,1733,1777,1797,1841,1861,1905,1925,1969,1989,2033,2053,2097,2117,2161,2181,2225,2245,2289,2309,2353,2373,2417,2437,2481,2501,2545,2565,2609,2629,2673,2693,2737,2757,2801,2821,2865,2885,2929,2949,2993,3013,3057,3077,3121,3141,3185,3205,3249,3269,3313,3333,3377,3397,3441,3461,3505,3525,3569,3589-3633,3653-3697,3717-3761,3781-3825,3845-3889,3909-3953,3973-4017,4037-4081,4110,4154,4174,4218,4238,4282,4302,4346,4366,4410,4430,4474,4494,4538,4558,4602,4622,4666,4686,4730,4750,4794,4814,4858,4878,4922,4942,4986,5006,5050,5070,5114,5134,5178,5198,5242,5262,5306,5326,5370,5390,5434,5454,5498,5518,5562,5582,5626,5646,5690,5710,5754,5774,5818,5838,5882,5902,5946,5966,6010,6030,6074,6094,6138,6158,6202,6222,6266,6286,6330,6350,6394,6414,6458,6478,6522,6542,6586,6606,6650,6670,6714,6734,6778,6798,6842,6862,6906,6926,6970,6990,7034,7054,7098,7118,7162,7182,7226,7246,7290,7310,7354,7374,7418,7438,7482,7502,7546,7566,7610,7630,7674,7694-7738,7758-7802,7822-7866,7886-7930,7950-7994,8014-8058,8078-8122,8142-8186,8192-15871") #MaskedWorkspace='BASIS_MASK') + MaskDetectors(Workspace=autows, DetectorList="5,49,69,113,133,177,197,241,261,305,325,369,389,433,453,497,517," + "561,581,625,645,689,709,753,773,817,837,881,901,945,965,1009," + "1029,1073,1093,1137,1157,1201,1221,1265,1285,1329,1349," + "1393,1413,1457,1477,1521,1541,1585,1605,1649,1669,1713," + "1733,1777,1797,1841,1861,1905,1925,1969,1989,2033,2053," + "2097,2117,2161,2181,2225,2245,2289,2309,2353,2373,2417," + "2437,2481,2501,2545,2565,2609,2629,2673,2693,2737,2757," + "2801,2821,2865,2885,2929,2949,2993,3013,3057,3077," + "3121,3141,3185,3205,3249,3269,3313,3333,3377,3397,3441," + "3461,3505,3525,3569,3589-3633,3653-3697,3717-3761," + "3781-3825,3845-3889,3909-3953,3973-4017,4037-4081,4110," + "4154,4174,4218,4238,4282,4302,4346,4366,4410,4430,4474,4494," + "4538,4558,4602,4622,4666,4686,4730,4750,4794,4814,4858," + "4878,4922,4942,4986,5006,5050,5070,5114,5134,5178,5198," + "5242,5262,5306,5326,5370,5390,5434,5454,5498,5518,5562,5582,5626,5646," + "5690,5710,5754,5774,5818,5838,5882,5902,5946,5966,6010," + "6030,6074,6094,6138,6158,6202,6222,6266,6286,6330,6350," + "6394,6414,6458,6478,6522,6542,6586,6606,6650,6670," + "6714,6734,6778,6798,6842,6862,6906,6926,6970,6990," + "7034,7054,7098,7118,7162,7182,7226,7246,7290,7310,7354," + "7374,7418,7438,7482,7502,7546,7566,7610,7630,7674," + "7694-7738,7758-7802,7822-7866,7886-7930,7950-7994," + "8014-8058,8078-8122,8142-8186,8192-15871") #MaskedWorkspace='BASIS_MASK') ModeratorTzeroLinear(InputWorkspace=autows,OutputWorkspace=autows) LoadParameterFile(Workspace=autows, Filename=os.path.join(idfdir,'BASIS_silicon_111_Parameters.xml')) LoadNexusMonitors(Filename='BSS_13387_event.nxs', OutputWorkspace=autows_monitor) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py index 99e7da5989780b097de968f70f4799123c0a91ff..2797e473841e47c199d92ca86e994f0a0f721068 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/BuildSQWTest.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name +#pylint: disable=invalid-name,super-on-old-class """ Defines a system test for converting a set of reduced direct inelastic data to a single SQW file. diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py index b81c988db7b2329e15c647c28e6d505ee4da450c..56f96796b7078e2054f11a00c97f0763ffaf2c9d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CNCSReductionTest.py @@ -8,6 +8,10 @@ import os import stresstesting class CNCSReductionTest(stresstesting.MantidStressTest): + parFile='' + groupingFile='' + nxspeFile='' + vanFile='' def requiredFiles(self): return ["CNCS_51936_event.nxs","CNCS_23936_event.nxs","CNCS_23937_event.nxs"] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CRISPLoadingTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CRISPLoadingTest.py index 784435f1e1aa2ba8da5c6dd053cfe7ec3436dfff..4bf90f3799f496dc673577fa4486fedc27a112fe 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CRISPLoadingTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CRISPLoadingTest.py @@ -1,10 +1,9 @@ from LoadAndCheckBase import * -''' -Test File loading and basic data integrity checks of CRISP data in Mantid. -''' class CRISPLoadingTest(LoadAndCheckBase): - + ''' + Test File loading and basic data integrity checks of CRISP data in Mantid. + ''' def __init__(self): super(self.__class__,self).__init__() self.disableChecking.append("Instrument") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/CalibrateRectangularDetector_Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/CalibrateRectangularDetector_Test.py index f4bcac786a4bb6bbcce9842157170474a7546c8b..3ca4556213d7212b22369095aba5b4e8c6f31813 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/CalibrateRectangularDetector_Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/CalibrateRectangularDetector_Test.py @@ -11,7 +11,7 @@ def _skip_test(): if "redhat-6" in platform.platform(): return True # run on any other linux - return ("Linux" not in platform.platform()) + return "Linux" not in platform.platform() class PG3Calibration(stresstesting.MantidStressTest): def cleanup(self): @@ -34,9 +34,11 @@ class PG3Calibration(stresstesting.MantidStressTest): # run the actual code output = CalibrateRectangularDetectors(OutputDirectory = savedir, SaveAs = 'calibration', FilterBadPulses = True, - GroupDetectorsBy = 'All', DiffractionFocusWorkspace = False, Binning = '0.5, -0.0004, 2.5', - MaxOffset=0.01, PeakPositions = '.6866,.7283,.8185,.8920,1.0758,1.2615,2.0599', - CrossCorrelation = False, Instrument = 'PG3', RunNumber = '2538', Extension = '_event.nxs') + GroupDetectorsBy = 'All', DiffractionFocusWorkspace = False, + Binning = '0.5, -0.0004, 2.5', + MaxOffset=0.01, PeakPositions = '.6866,.7283,.8185,.8920,1.0758,1.2615,2.0599', + CrossCorrelation = False, Instrument = 'PG3', RunNumber = '2538', + Extension = '_event.nxs') if isinstance(output, basestring): self.saved_cal_file = output @@ -45,11 +47,11 @@ class PG3Calibration(stresstesting.MantidStressTest): # load saved cal file LoadCalFile(InputWorkspace="PG3_2538_calibrated", CalFileName=self.saved_cal_file, WorkspaceName="PG3_2538", - MakeGroupingWorkspace=False) + MakeGroupingWorkspace=False) MaskDetectors(Workspace="PG3_2538_offsets",MaskedWorkspace="PG3_2538_mask") # load golden cal file LoadCalFile(InputWorkspace="PG3_2538_calibrated", CalFileName="PG3_golden.cal", WorkspaceName="PG3_2538_golden", - MakeGroupingWorkspace=False) + MakeGroupingWorkspace=False) MaskDetectors(Workspace="PG3_2538_golden_offsets",MaskedWorkspace="PG3_2538_golden_mask") def validateMethod(self): @@ -80,9 +82,11 @@ class PG3CCCalibration(stresstesting.MantidStressTest): # run the actual code output = CalibrateRectangularDetectors(OutputDirectory = savedir, SaveAs = 'calibration', FilterBadPulses = True, - GroupDetectorsBy = 'All', DiffractionFocusWorkspace = False, Binning = '0.5, -0.0004, 2.5', - MaxOffset=0.01, PeakPositions = '0.7282933,1.261441',DetectorsPeaks = '17,6', - CrossCorrelation = True, Instrument = 'PG3', RunNumber = '2538', Extension = '_event.nxs') + GroupDetectorsBy = 'All', DiffractionFocusWorkspace = False, + Binning = '0.5, -0.0004, 2.5', + MaxOffset=0.01, PeakPositions = '0.7282933,1.261441',DetectorsPeaks = '17,6', + CrossCorrelation = True, Instrument = 'PG3', RunNumber = '2538', + Extension = '_event.nxs') if isinstance(output, basestring): self.saved_cal_file = output @@ -91,11 +95,11 @@ class PG3CCCalibration(stresstesting.MantidStressTest): # load saved cal file LoadCalFile(InputWorkspace="PG3_2538_calibrated", CalFileName=self.saved_cal_file, WorkspaceName="PG3_2538", - MakeGroupingWorkspace=False) + MakeGroupingWorkspace=False) MaskDetectors(Workspace="PG3_2538_offsets",MaskedWorkspace="PG3_2538_mask") # load golden cal file LoadCalFile(InputWorkspace="PG3_2538_calibrated", CalFileName="PG3_goldenCC.cal", WorkspaceName="PG3_2538_golden", - MakeGroupingWorkspace=False) + MakeGroupingWorkspace=False) MaskDetectors(Workspace="PG3_2538_golden_offsets",MaskedWorkspace="PG3_2538_golden_mask") def validateMethod(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ConvertToMDworkflow.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ConvertToMDworkflow.py index a2e17aef9868585b07505fdfae1364d2ec6877e7..1dcb95c1ee83a1a4d40402ac0fad5d48e78bb6f2 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ConvertToMDworkflow.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ConvertToMDworkflow.py @@ -1,7 +1,6 @@ #pylint: disable=no-init import stresstesting from mantid.simpleapi import * -from mantid.api import Workspace #---------------------------------------------------------------------- @@ -9,7 +8,7 @@ class ConvertToMDworkflow(stresstesting.MantidStressTest): """ """ - + tolerance = 1e-5 def runTest(self): @@ -55,13 +54,12 @@ class ConvertToMDworkflow(stresstesting.MantidStressTest): def validate(self): """Returns the name of the workspace & file to compare""" self.tolerance = 1e-5 - #elf.disableChecking.append('SpectraMap') - #elf.disableChecking.append('Instrument') + #self.disableChecking.append('SpectraMap') + #self.disableChecking.append('Instrument') result = 'WS_4D' reference = "ConvertToMDSample.nxs" valNames = [result,reference] - from mantid.simpleapi import Load,CompareMDWorkspaces,FrameworkManager,SaveNexus Load(Filename=reference,OutputWorkspace=valNames[1]) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/Diffraction_Workflow_Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/Diffraction_Workflow_Test.py index bc2e057934c6e2217d5f54343294ac80413fc1bb..809b30a3d4987f4c5ccfee0f5add057b1e04a451 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/Diffraction_Workflow_Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/Diffraction_Workflow_Test.py @@ -14,9 +14,9 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): def cleanup(self): Files = ["TOPAZ_3132.hkl", - "TOPAZ_3132FFT.hkl"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "TOPAZ_3132FFT.hkl"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True @@ -33,7 +33,6 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) # determine where to save - import os savedir = os.path.abspath(os.path.curdir) @@ -48,21 +47,21 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): # Convert to Q space ConvertToDiffractionMDWorkspace(InputWorkspace=ws,OutputWorkspace=ws+'_MD2',LorentzCorrection='0', - OutputDimensions='Q (lab frame)', SplitInto='2',SplitThreshold='150') #,Version=1 + OutputDimensions='Q (lab frame)', SplitInto='2',SplitThreshold='150') #,Version=1 # Find peaks (Reduced number of peaks so file comparison with reference does not fail with small differences) FindPeaksMD(InputWorkspace=ws+'_MD2',MaxPeaks='20',OutputWorkspace=ws+'_peaksLattice') # 3d integration to centroid peaks CentroidPeaksMD(InputWorkspace=ws+'_MD2',CoordinatesToUse='Q (lab frame)', - PeakRadius='0.12',PeaksWorkspace=ws+'_peaksLattice',OutputWorkspace=ws+'_peaksLattice') + PeakRadius='0.12',PeaksWorkspace=ws+'_peaksLattice',OutputWorkspace=ws+'_peaksLattice') # Find the UB matrix using the peaks and known lattice parameters FindUBUsingLatticeParameters(PeaksWorkspace=ws+'_peaksLattice',a='10.3522',b='6.0768',c='4.7276', - alpha='90',beta='90',gamma='90', NumInitial='20', Tolerance='0.12') + alpha='90',beta='90',gamma='90', NumInitial='20', Tolerance='0.12') # And index to HKL IndexPeaks(PeaksWorkspace=ws+'_peaksLattice', Tolerance='0.12') # Integrate peaks in Q space using spheres IntegratePeaksMD(InputWorkspace=ws+'_MD2',PeakRadius='0.12', - BackgroundOuterRadius='0.18',BackgroundInnerRadius='0.15', - PeaksWorkspace=ws+'_peaksLattice',OutputWorkspace=ws+'_peaksLattice') + BackgroundOuterRadius='0.18',BackgroundInnerRadius='0.15', + PeaksWorkspace=ws+'_peaksLattice',OutputWorkspace=ws+'_peaksLattice') # Save for SHELX SaveHKL(InputWorkspace=ws+'_peaksLattice', Filename=savedir+'/'+ws+'.hkl') @@ -70,30 +69,30 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): FindPeaksMD(InputWorkspace=ws+'_MD2',MaxPeaks='100',OutputWorkspace=ws+'_peaksFFT') # 3d integration to centroid peaks CentroidPeaksMD(InputWorkspace=ws+'_MD2', CoordinatesToUse='Q (lab frame)', - PeakRadius='0.12',PeaksWorkspace=ws+'_peaksFFT',OutputWorkspace=ws+'_peaksFFT') + PeakRadius='0.12',PeaksWorkspace=ws+'_peaksFFT',OutputWorkspace=ws+'_peaksFFT') # Find the UB matrix using FFT FindUBUsingFFT(PeaksWorkspace=ws+'_peaksFFT',MinD=3.,MaxD=14.) ## TODO conventional cell # And index to HKL - alg = IndexPeaks(PeaksWorkspace=ws+'_peaksFFT', Tolerance='0.12') + dummy_alg = IndexPeaks(PeaksWorkspace=ws+'_peaksFFT', Tolerance='0.12') # Integrate peaks in Q space using spheres IntegratePeaksMD(InputWorkspace=ws+'_MD2',PeakRadius='0.12', - BackgroundOuterRadius='0.18',BackgroundInnerRadius='0.15', - PeaksWorkspace=ws+'_peaksFFT',OutputWorkspace=ws+'_peaksFFT') + BackgroundOuterRadius='0.18',BackgroundInnerRadius='0.15', + PeaksWorkspace=ws+'_peaksFFT',OutputWorkspace=ws+'_peaksFFT') # Save for SHELX SaveHKL(InputWorkspace=ws+'_peaksFFT', Filename=savedir+'/'+ws+'FFT.hkl') # Copy the UB matrix back to the original workspace CopySample(InputWorkspace=ws+'_peaksFFT',OutputWorkspace=ws, - CopyName='0',CopyMaterial='0',CopyEnvironment='0',CopyShape='0', CopyLattice=1) + CopyName='0',CopyMaterial='0',CopyEnvironment='0',CopyShape='0', CopyLattice=1) # Convert to reciprocal space, in the sample frame ConvertToDiffractionMDWorkspace(InputWorkspace=ws,OutputWorkspace=ws+'_HKL', - OutputDimensions='HKL',LorentzCorrection='0', SplitInto='2',SplitThreshold='150') + OutputDimensions='HKL',LorentzCorrection='0', SplitInto='2',SplitThreshold='150') # Bin to a regular grid BinMD(InputWorkspace=ws+'_HKL',AlignedDim0="[H,0,0], -20, 20, 800",AlignedDim1="[0,K,0], -5, 5, 50", AlignedDim2="[0,0,L], -10, 10, 800",OutputWorkspace=ws+'_binned') @@ -117,9 +116,9 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): # Bin to a line (H=0 to 6, L=3, K=3) BinMD(InputWorkspace='TOPAZ_3132_HKL',AxisAligned='0', - BasisVector0='X,units,1,0,0',BasisVector1='Y,units,6.12323e-17,1,0',BasisVector2='2,units,-0,0,1', - Translation='-0,3,6',OutputExtents='0,6, -0.1,0.1, -0.1,0.1',OutputBins='60,1,1', - OutputWorkspace='TOPAZ_3132_HKL_line') + BasisVector0='X,units,1,0,0',BasisVector1='Y,units,6.12323e-17,1,0',BasisVector2='2,units,-0,0,1', + Translation='-0,3,6',OutputExtents='0,6, -0.1,0.1, -0.1,0.1',OutputBins='60,1,1', + OutputWorkspace='TOPAZ_3132_HKL_line') # Now check the integrated bin and the peaks w = mtd["TOPAZ_3132_HKL_line"] @@ -162,8 +161,8 @@ class Diffraction_Workflow_Test(stresstesting.MantidStressTest): for c in xrange(3): # This compares each column, allowing old == new OR old == -new if not numpy.all(diff[:,c]) : - raise Exception("More than 0.001 difference between UB matrices: Q (lab frame):\n%s\nQ (sample frame):\n%s" % ( - originalUB, newUB) ) + raise Exception("More than 0.001 difference between UB matrices: Q (lab frame):\n%s\nQ (sample frame):\n%s"\ + % (originalUB, newUB) ) # load output hkl file and the golden one LoadHKL(Filename="TOPAZ_3132.hkl", OutputWorkspace="TOPAZ_3132") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py index a46981d209cf1ac3ca2f2ea4b33af04051960b92..ed4bb5b7a214472ebe4437040f9448b1ac9fa52c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py @@ -1,6 +1,6 @@ #pylint: disable=no-init from stresstesting import MantidStressTest -from mantid.simpleapi import MaskDetectors, config +import mantid.simpleapi as ms import Direct.DirectEnergyConversion as reduction import os @@ -42,10 +42,10 @@ class DirectInelasticDiagnostic(MantidStressTest): sample = reducer.get_run_descriptor(sample) sample_ws = sample.get_workspace() - MaskDetectors(Workspace=sample_ws, MaskedWorkspace=diag_mask) + ms.MaskDetectors(Workspace=sample_ws, MaskedWorkspace=diag_mask) # Save the masked spectra nmubers to a simple ASCII file for comparison - self.saved_diag_file = os.path.join(config['defaultsave.directory'], 'CurrentDirectInelasticDiag.txt') + self.saved_diag_file = os.path.join(ms.config['defaultsave.directory'], 'CurrentDirectInelasticDiag.txt') handle = file(self.saved_diag_file, 'w') for index in range(sample_ws.getNumberHistograms()): if sample_ws.getDetector(index).isMasked(): @@ -58,7 +58,8 @@ class DirectInelasticDiagnostic(MantidStressTest): if self.succeeded(): os.remove(self.saved_diag_file) else: - os.rename(self.saved_diag_file, os.path.join(config['defaultsave.directory'], 'DirectInelasticDiag-Mismatch.txt')) + os.rename(self.saved_diag_file, os.path.join(ms.config['defaultsave.directory'], + 'DirectInelasticDiag-Mismatch.txt')) def validateMethod(self): return 'validateASCII' diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic2.py index 42fff86f1f76f145c7b1d590f2ac38f35d21ceb9..68013568761616b530f8466ddf4c5e8bff863938 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic2.py @@ -14,6 +14,8 @@ def getNamedParameter(ws, name): class DirectInelasticDiagnostic2(MantidStressTest): + saved_diag_file='' + def requiredMemoryMB(self): """Requires 4Gb""" return 4000 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSBeamCenterAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSBeamCenterAPIv2.py index 59af7140a7668dbedb675a20901b71f36f435661..41112ce659ba5640e4d39e863e97a17f704dbaca 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSBeamCenterAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSBeamCenterAPIv2.py @@ -19,8 +19,8 @@ class EQSANSBeamCenter(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_4061_event.nxs") NoSolidAngle() @@ -55,8 +55,8 @@ class EQSANSBeamCenterEvent(EQSANSBeamCenter): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) AppendDataFile("EQSANS_4061_event.nxs") NoSolidAngle() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py index 10cf5adc5d0f83ffaa4ae70da4277bcc2d0538ed..6a12f0209ee9ab27c2362aa9b9e41b5e4499e94f 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py @@ -7,22 +7,22 @@ from mantid.api import * import os class EQSANSDarkCurrent(stresstesting.MantidStressTest): - + """ + Analysis Tests for EQSANS + Testing that the I(Q) output of is correct + """ def cleanup(self): absfile = FileFinder.getFullPath("EQSANS_1466_event_reduction.log") if os.path.exists(absfile): os.remove(absfile) return True - """ - Analysis Tests for EQSANS - Testing that the I(Q) output of is correct - """ def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' - EQSANS(True) + configI = ConfigService.Instance() + configI["facilityName"]='SNS' + # The new version of dark current subtraction only works on histograms + EQSANS(False) SolidAngle() SetBeamCenter(96.29, 126.15) PerformFlightPathCorrection(False) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSEffAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSEffAPIv2.py index 70f9a8882d503a73a3670468f1ff1e410981fcd1..62d905c686135ee2d17fc0ae6cfbd823bbc0a66b 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSEffAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSEffAPIv2.py @@ -18,8 +18,8 @@ class EQSANSEff(stresstesting.MantidStressTest): """ System test for sensitivity correction """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSFlatTestAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSFlatTestAPIv2.py index 40da2ba524a1c564aa3723f413a206ee67acda47..4fdf380574e0df18ea667989b6658893ac26038e 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSFlatTestAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSFlatTestAPIv2.py @@ -25,8 +25,8 @@ class EQSANSFlatTest(stresstesting.MantidStressTest): It is used to verify that the complete reduction chain works and reproduces reference results. """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) SolidAngle() DarkCurrent(FILE_LOCATION+"EQSANS_5704_event.nxs") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSIQOutputAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSIQOutputAPIv2.py index fc609cb16e9b2262c6974d0580bd1ec43de1f26e..809d8887d55f36feecc1bc624a0e61330d572a37 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSIQOutputAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSIQOutputAPIv2.py @@ -9,29 +9,29 @@ import os def do_cleanup(): Files = ["EQSANS_4061_event_reduction.log", - "EQSANS_1466_event_reduction.log"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "EQSANS_1466_event_reduction.log"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True class EQSANSIQOutput(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS() SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_1466_event.nxs") @@ -59,18 +59,18 @@ class EQSANSIQOutput(stresstesting.MantidStressTest): return "EQSANS_1466_event_Iq", 'EQSANSIQOutput.nxs' class EQSANSBeamMonitor(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS() SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_1466_event.nxs") @@ -89,23 +89,23 @@ class EQSANSBeamMonitor(stresstesting.MantidStressTest): return "EQSANS_1466_event_Iq", 'EQSANSBeamMonitor.nxs' class EQSANSDQPositiveOutput(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the Q resolution output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that the Q resolution calculation returns positive values even when background is larger than signal and I(q) is negative. (Non-physical value that's an experimental edge case) """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS() SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_1466_event.nxs") @@ -126,23 +126,23 @@ class EQSANSDQPositiveOutput(stresstesting.MantidStressTest): return True class EQSANSDQOutput(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the Q resolution output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that the Q resolution calculation returns positive values even when background is larger than signal and I(q) is negative. (Non-physical value that's an experimental edge case) """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS() SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_1466_event.nxs") @@ -192,23 +192,23 @@ class EQSANSDQOutput(stresstesting.MantidStressTest): return output class EQSANSDQOutput_FS(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the Q resolution output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that the Q resolution calculation returns positive values even when background is larger than signal and I(q) is negative. (Non-physical value that's an experimental edge case) """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS() SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_4061_event.nxs") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSNormalisationAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSNormalisationAPIv2.py index a42969d95b3243621fd2ba44f20865d038d378c7..1ef30145bf0f3a218d140b042791160ecfa5fb46 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSNormalisationAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSNormalisationAPIv2.py @@ -15,8 +15,8 @@ class EQSANSNormalisationNoFlux(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' ws = "__eqsans_normalisation_test" EQSANSLoad(Filename="EQSANS_1466_event.nxs", OutputWorkspace=ws, @@ -43,8 +43,8 @@ class EQSANSNormalisationDefault(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' ws = "__eqsans_normalisation_test" EQSANSLoad(Filename="EQSANS_1466_event.nxs", OutputWorkspace=ws, @@ -79,8 +79,8 @@ class EQSANSNormalisationInputFlux(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' ws = "__eqsans_normalisation_test" spectrum_file = "eqsans_beam_flux.txt" @@ -103,13 +103,14 @@ class EQSANSNormalisationBeamFlux(stresstesting.MantidStressTest): """ Analysis Tests for EQSANS """ - + data_ws="" + prop_mng="" def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' self.prop_mng = "eqsans_normalise_options" self.data_ws = "eqsans_normalise_data_ws" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSProcessedEffAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSProcessedEffAPIv2.py index 857233819662137826ba685ab0b8d8c9ead119f2..adeb36f0b92ab5bbcaf4c3e5ef8dc85c0892ef9c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSProcessedEffAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSProcessedEffAPIv2.py @@ -18,8 +18,8 @@ class EQSANSProcessedEff(stresstesting.MantidStressTest): """ System test for sensitivity correction """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py index 79486d62dfb8320f5c7fb6740ecd1b02daea1e41..c8b858fbff769dd9f9a4001c894bd9a0db6dfb20 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py @@ -14,21 +14,20 @@ def do_cleanup(): return True class EQSANSSolid(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -57,20 +56,20 @@ class EQSANSSolid(stresstesting.MantidStressTest): return "EQSANS_1466_event_Iq", 'EQSANSSolid.nxs' class EQSANSSolidEvent(EQSANSSolid): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSTransAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSTransAPIv2.py index 14d279d991b3d5a9e621e6c1ccee0e323b717c73..2119824a8ae0152d313de9b0d3117dc6d05562a6 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSTransAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSTransAPIv2.py @@ -8,9 +8,9 @@ import os def do_cleanup(): Files = ["EQSANS_4061_event_reduction.log", - "EQSANS_1466_event_reduction.log"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "EQSANS_1466_event_reduction.log"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True @@ -22,8 +22,8 @@ class EQSANSTransmission(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -57,8 +57,8 @@ class EQSANSTransmissionEvent(EQSANSTransmission): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -95,8 +95,8 @@ class EQSANSTransmissionDC(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -124,20 +124,19 @@ class EQSANSTransmissionDC(stresstesting.MantidStressTest): return "EQSANS_1466_event_Iq", 'EQSANSTransmissionDC.nxs' class EQSANSTransmissionCompatibility(EQSANSTransmission): - - def cleanup(self): - do_cleanup() - return True - """ Analysis Tests for EQSANS - Check that the transmission correction can be applied if the + Check that the transmission correction can be applied if the sample run and transmission runs don't have the same binning """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -173,8 +172,8 @@ class EQSANSTransmissionFS(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_4061_event.nxs") @@ -205,8 +204,8 @@ class EQSANSDirectTransFS(stresstesting.MantidStressTest): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) SetBeamCenter(96.29, 126.15) AppendDataFile("EQSANS_4061_event.nxs") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/GEMTests.py b/Code/Mantid/Testing/SystemTests/tests/analysis/GEMTests.py index 16642bc4bea76d76c0ded87421441511a22ca5e6..a73a603d949e5723325519dcfb0b49dcd0981a6e 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/GEMTests.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/GEMTests.py @@ -1,8 +1,9 @@ import stresstesting import os from mantid.simpleapi import * - +#pylint: disable=too-many-instance-attributes class GEMTest(stresstesting.MantidStressTest): + validate=None def __init__(self): stresstesting.MantidStressTest.__init__(self) @@ -143,12 +144,12 @@ class GEMTest(stresstesting.MantidStressTest): os.remove(self.gss_file) if os.path.exists(self.new_cal_file): os.remove(self.new_cal_file) - for file in self.xye_tof_files: - if os.path.exists(file): - os.remove(file) - for file in self.xye_d_files: - if os.path.exists(file): - os.remove(file) + for filename in self.xye_tof_files: + if os.path.exists(filename): + os.remove(filename) + for filename in self.xye_d_files: + if os.path.exists(filename): + os.remove(filename) def doValidation(self): '''Override doValidation to vaildate two things at the same time''' @@ -167,14 +168,16 @@ class GEMTest(stresstesting.MantidStressTest): self.validate = self.validateTOFXYE self.file_index = 0 # file_index is incremented after each call to validateASCII() - res = self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() + res = self.validateASCII() and self.validateASCII() and self.validateASCII() and \ + self.validateASCII() and self.validateASCII() and self.validateASCII() if not res: return False # reset validate() method to call validateTOFXYE() self.validate = self.validateDXYE self.file_index = 0 # file_index is incremented after each call to validateASCII() - res = self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() and self.validateASCII() + res = self.validateASCII() and self.validateASCII() and self.validateASCII() and \ + self.validateASCII() and self.validateASCII() and self.validateASCII() return res def validateNexus(self): @@ -183,19 +186,16 @@ class GEMTest(stresstesting.MantidStressTest): def validateGSS(self): '''Validate the created gss file''' - from mantid.api import FileFinder return self.gss_file, FileFinder.getFullPath(self.ref_gss_file) def validateTOFXYE(self): '''Validate the created gss file''' - from mantid.api import FileFinder i = self.file_index self.file_index += 1 return self.xye_tof_files[i], FileFinder.getFullPath(self.ref_xye_tof_files[i]) def validateDXYE(self): '''Validate the created gss file''' - from mantid.api import FileFinder i = self.file_index self.file_index += 1 return self.xye_d_files[i], FileFinder.getFullPath(self.ref_xye_d_files[i]) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRBackgroundAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRBackgroundAPIv2.py index 1ae6707a9a61465341c3c5ee89ce86390bc9cfb9..e9ef2e5d7c7339b1d720fd294d64c61d411a7f0b 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRBackgroundAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRBackgroundAPIv2.py @@ -8,11 +8,11 @@ import os def do_cleanup(): Files = ["BioSANS_test_data_reduction.log", - "BioSANS_test_data_Iq.xml", - "BioSANS_test_data_Iq.txt", - "BioSANS_test_data_Iqxy.dat"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "BioSANS_test_data_Iq.xml", + "BioSANS_test_data_Iq.txt", + "BioSANS_test_data_Iqxy.dat"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True @@ -24,8 +24,8 @@ class HFIRBackground(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() SetBeamCenter(16, 95) AppendDataFile("BioSANS_test_data.xml") @@ -48,8 +48,8 @@ class HFIRBackgroundTransmission(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() AppendDataFile("BioSANS_test_data.xml") Background("BioSANS_test_data.xml") @@ -72,8 +72,8 @@ class HFIRBackgroundDirectBeamTrans(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() AppendDataFile("BioSANS_test_data.xml") Background("BioSANS_test_data.xml") @@ -98,17 +98,17 @@ class HFIRBackgroundBeamSpreaderTrans(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() AppendDataFile("BioSANS_test_data.xml") Background("BioSANS_test_data.xml") BckBeamSpreaderTransmission(sample_spreader="BioSANS_test_data.xml", - direct_spreader="BioSANS_empty_cell.xml", - sample_scattering="BioSANS_test_data.xml", - direct_scattering="BioSANS_empty_cell.xml", - spreader_transmission=0.5, - spreader_transmission_err=0.1) + direct_spreader="BioSANS_empty_cell.xml", + sample_scattering="BioSANS_test_data.xml", + direct_scattering="BioSANS_empty_cell.xml", + spreader_transmission=0.5, + spreader_transmission_err=0.1) AzimuthalAverage(binning="0.01,0.001,0.11") Reduce1D() @@ -127,8 +127,8 @@ class HFIRBackgroundTransDarkCurrent(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() AppendDataFile("BioSANS_test_data.xml") Background("BioSANS_test_data.xml") @@ -154,8 +154,8 @@ class HFIRBackgroundDirectBeamTransDC(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() AppendDataFile("BioSANS_test_data.xml") Background("BioSANS_test_data.xml") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIREffAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIREffAPIv2.py index 775b6c55d14019af93e10ae80bafc40e6cced334..a5348b5c310e4a2e8e4cf1b684c454f4a483c8d0 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIREffAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIREffAPIv2.py @@ -8,11 +8,11 @@ import os def do_cleanup(): Files = ["BioSANS_test_data_reduction.log", - "BioSANS_test_data_Iq.xml", - "BioSANS_test_data_Iq.txt", - "BioSANS_test_data_Iqxy.dat"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "BioSANS_test_data_Iq.xml", + "BioSANS_test_data_Iq.txt", + "BioSANS_test_data_Iqxy.dat"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True @@ -27,8 +27,8 @@ class HFIREffAPIv2(stresstesting.MantidStressTest): """ System test for sensitivity correction """ - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") AppendDataFile("BioSANS_test_data.xml") @@ -55,8 +55,8 @@ class HFIRSensitivityDirectBeamCenter(stresstesting.MantidStressTest): """ System test for sensitivity correction """ - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") AppendDataFile("BioSANS_test_data.xml") @@ -85,8 +85,8 @@ class HFIRSensitivityScatteringBeamCenter(stresstesting.MantidStressTest): """ System test for sensitivity correction """ - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") AppendDataFile("BioSANS_test_data.xml") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRReductionAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRReductionAPIv2.py index c8750b363efd309da54df6b4201488198d8f692c..86b83091ccfced9ff74ee9acc02b8b7adb578b84 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRReductionAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRReductionAPIv2.py @@ -8,29 +8,28 @@ import os def do_cleanup(): Files = ["BioSANS_test_data_reduction.log", - "BioSANS_test_data_Iq.xml", - "BioSANS_test_data_Iq.txt", - "BioSANS_test_data_Iqxy.dat"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "BioSANS_test_data_Iq.xml", + "BioSANS_test_data_Iq.txt", + "BioSANS_test_data_Iqxy.dat"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True class HFIRReductionAPIv2(stresstesting.MantidStressTest): + """ + Simple reduction example + """ def cleanup(self): do_cleanup() return True - """ - Simple reduction example - """ - def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") AppendDataFile("BioSANS_test_data.xml") @@ -47,18 +46,17 @@ class HFIRReductionAPIv2(stresstesting.MantidStressTest): return "BioSANS_test_data_Iq", "HFIRReduction.nxs" class HFIRAbsoluteScalingReference(stresstesting.MantidStressTest): + """ + Test absolute scaling using a reference data set + """ def cleanup(self): do_cleanup() return True - """ - Test absolute scaling using a reference data set - """ - def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() SolidAngle(detector_tubes=True) MonitorNormalization() @@ -76,18 +74,17 @@ class HFIRAbsoluteScalingReference(stresstesting.MantidStressTest): return "BioSANS_test_data_Iq", "HFIRAbsoluteScalingReference.nxs" class HFIRAbsoluteScalingValue(stresstesting.MantidStressTest): + """ + Test absolute scaling using a reference data set + """ def cleanup(self): do_cleanup() return True - """ - Test absolute scaling using a reference data set - """ - def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() SolidAngle(detector_tubes=True) MonitorNormalization() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py index 526b72b6c9c3fa5679d9478816cc0e60bdd0bb47..81eab361aefb80608ab7023fa68c21f8eef06282 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py @@ -23,8 +23,10 @@ for item in data_search_dirs: if len(TEST_DIR)==0: raise RuntimeError, "Could not locate test data directory: [...]/Data/SANS2D" -def _diff_iq(x,y): return x-y -def _add(x,y): return x+y +def _diff_iq(x,y): + return x-y +def _add(x,y): + return x+y def _read_IGOR(filepath): """ @@ -69,10 +71,14 @@ def _check_result(ws, test_file, tolerance=1e-6): return False # Utility methods for manipulating the lists - def _diff_chi2(x,y): return (x[1]-y[1])*(x[1]-y[1])/(x[2]*x[2]) - def _diff_iq(x,y): return x[1]-y[1] - def _diff_err(x,y): return x[2]-y[2] - def _add(x,y): return x+y + def _diff_chi2(x,y): + return (x[1]-y[1])*(x[1]-y[1])/(x[2]*x[2]) + def _diff_iq(x,y): + return x[1]-y[1] + def _diff_err(x,y): + return x[2]-y[2] + def _add(x,y): + return x+y # Check that I(q) is the same for both data sets deltas = map(_diff_iq, data_mantid, data_igor) @@ -99,20 +105,20 @@ def _check_result(ws, test_file, tolerance=1e-6): def do_cleanup(): Files = ["GPSANS_reduction.log", - "BioSANS_exp61_scan0004_0001_Iq.txt", - "BioSANS_exp61_scan0004_0001_Iq.xml", - "BioSANS_exp61_scan0004_0001_Iqxy.dat", - "BioSANS_exp61_scan0004_0001_reduction.log", - "BioSANS_test_data_Iq.txt", - "BioSANS_test_data_Iq.xml", - "BioSANS_test_data_Iqxy.dat", - "BioSANS_test_data_reduction.log", - "test_data_Iq.txt", - "test_data_Iq.xml", - "test_data_Iqxy.dat", - "test_data_reduction.log"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "BioSANS_exp61_scan0004_0001_Iq.txt", + "BioSANS_exp61_scan0004_0001_Iq.xml", + "BioSANS_exp61_scan0004_0001_Iqxy.dat", + "BioSANS_exp61_scan0004_0001_reduction.log", + "BioSANS_test_data_Iq.txt", + "BioSANS_test_data_Iq.xml", + "BioSANS_test_data_Iqxy.dat", + "BioSANS_test_data_reduction.log", + "test_data_Iq.txt", + "test_data_Iq.xml", + "test_data_Iqxy.dat", + "test_data_reduction.log"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True @@ -167,9 +173,9 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): self.n_tests = 0 self.n_passed = 0 self.failed_tests = [] - for item in dir(self): - m = getattr(self, item) - if item.startswith("test_") and type(m)==types.MethodType: + for current_item in dir(self): + m = getattr(self, current_item) + if current_item.startswith("test_") and type(m)==types.MethodType: self.n_tests += 1 t = TestStub(m) result = t.run_test() @@ -177,7 +183,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): if result is None or result==True: self.n_passed += 1 else: - self.failed_tests.append(item) + self.failed_tests.append(current_item) self.all_passed = False def test_data_path(self): @@ -305,7 +311,16 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.19472,0.204269,0.215354,0.230114,0.238961,0.237201,0.247843,0.248424,0.253676,0.254327,0.254366,0.252931,0.258339,0.259297,0.257155,0.254059,0.252383,0.252826,0.256604,0.256754,0.255592,0.256813,0.248569,0.25331,0.251032,0.246424,0.249477,0.250939,0.251959,0.24925,0.250372,0.246148,0.250478,0.244621,0.247428,0.246431,0.245041,0.241647,0.24307,0.240096,0.242797,0.238182,0.237548,0.239789,0.241477,0.23456,0.237372,0.233715,0.233789,0.232262,0.231589,0.230986,0.231646,0.231331,0.230484,0.2277,0.226819,0.224341,0.227239,0.223228,0.221232,0.222011,0.224747,0.219533,0.216973,0.218734,0.21668,0.218366,0.214926,0.213985,0.214469,0.210473,0.209867,0.209066,0.208965,0.207498,0.204505,0.205786,0.202186,0.200442,0.200485,0.200554,0.200499,0.198152,0.193945,0.192082,0.193783,0.193787,0.190557,0.190471,0.186827,0.190088,0.188204,0.187547,0.182206,0.181384,0.180358,0.182663,0.178844,0.176556] + check = [0.19472,0.204269,0.215354,0.230114,0.238961,0.237201,0.247843,0.248424,0.253676,0.254327, + 0.254366,0.252931,0.258339,0.259297,0.257155,0.254059,0.252383,0.252826,0.256604,0.256754, + 0.255592,0.256813,0.248569,0.25331,0.251032,0.246424,0.249477,0.250939,0.251959,0.24925,0.250372, + 0.246148,0.250478,0.244621,0.247428,0.246431,0.245041,0.241647,0.24307,0.240096,0.242797,0.238182, + 0.237548,0.239789,0.241477,0.23456,0.237372,0.233715,0.233789,0.232262,0.231589,0.230986,0.231646, + 0.231331,0.230484,0.2277,0.226819,0.224341,0.227239,0.223228,0.221232,0.222011,0.224747,0.219533, + 0.216973,0.218734,0.21668,0.218366,0.214926,0.213985,0.214469,0.210473,0.209867,0.209066, + 0.208965,0.207498,0.204505,0.205786,0.202186,0.200442,0.200485,0.200554,0.200499,0.198152,0.193945, + 0.192082,0.193783,0.193787,0.190557,0.190471,0.186827,0.190088,0.188204,0.187547,0.182206, + 0.181384,0.180358,0.182663,0.178844,0.176556] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -338,7 +353,27 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.268942,0.272052,0.269806,0.27129,0.273852,0.271301,0.271732,0.271103,0.270996,0.269677,0.27098,0.266802,0.26789,0.268222,0.266125,0.262736,0.262752,0.263827,0.26315,0.262775,0.261541,0.260818,0.258955,0.257675,0.255908,0.254088,0.256778,0.256883,0.253568,0.25636,0.252323,0.251833,0.251914,0.252298,0.249375,0.247718,0.247768,0.244636,0.245604,0.243996,0.244332,0.244363,0.242985,0.242234,0.241118,0.241411,0.24084,0.239293,0.2392,0.236565,0.234557,0.233974,0.232905,0.231898,0.231085,0.229586,0.22862,0.227001,0.226783,0.225837,0.224835,0.223807,0.222296,0.221557,0.220464,0.219139,0.217611,0.217049,0.21606,0.215739,0.216233,0.213467,0.213141,0.213275,0.219695,0.216121,0.215502,0.21792,0.209364,0.209368,0.2064,0.205844,0.20431,0.203443,0.202442,0.200195,0.199408,0.19853,0.195654,0.195514,0.193086,0.193388,0.19137,0.190122,0.189119,0.18864,0.185473,0.184958,0.183981,0.182581] + check = [0.268942,0.272052,0.269806,0.27129,0.273852, + 0.271301,0.271732,0.271103,0.270996,0.269677, + 0.27098,0.266802,0.26789,0.268222,0.266125, + 0.262736,0.262752,0.263827,0.26315,0.262775, + 0.261541,0.260818,0.258955,0.257675,0.255908, + 0.254088,0.256778,0.256883,0.253568,0.25636, + 0.252323,0.251833,0.251914,0.252298,0.249375, + 0.247718,0.247768,0.244636,0.245604,0.243996, + 0.244332,0.244363,0.242985,0.242234,0.241118, + 0.241411,0.24084,0.239293,0.2392,0.236565, + 0.234557,0.233974,0.232905,0.231898,0.231085, + 0.229586,0.22862,0.227001,0.226783,0.225837, + 0.224835,0.223807,0.222296,0.221557,0.220464, + 0.219139,0.217611,0.217049,0.21606,0.215739, + 0.216233,0.213467,0.213141,0.213275,0.219695, + 0.216121,0.215502,0.21792,0.209364,0.209368, + 0.2064,0.205844,0.20431,0.203443,0.202442, + 0.200195,0.199408,0.19853,0.195654, + 0.195514,0.193086,0.193388,0.19137, + 0.190122,0.189119,0.18864,0.185473, + 0.184958,0.183981,0.182581] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -354,7 +389,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.269037,0.272176,0.269917,0.271416,0.273988,0.271432,0.271857,0.271232,0.271118,0.269797,0.271095,0.266912,0.268015,0.268356,0.266256,0.26287,0.262888,0.263964,0.263281,0.262905,0.261669,0.26094,0.259081,0.257802,0.256029,0.254228,0.256913,0.257021,0.253692,0.256491,0.252454,0.251969,0.25204,0.252423,0.249516,0.247844,0.247895,0.24476,0.245734,0.244125,0.244474,0.244491,0.243126,0.242359,0.241239,0.24154,0.240976,0.239421,0.23933,0.236688,0.234685,0.234105,0.233034,0.232036,0.231208,0.229714,0.228749,0.227122,0.226918,0.225969,0.22497,0.223933,0.222426,0.221684,0.2206,0.219277,0.217739,0.217173,0.216193,0.215869,0.216354,0.213597,0.213271,0.213407,0.219829,0.216259,0.215635,0.218058,0.209499,0.209503,0.206529,0.205981,0.20445,0.203577,0.202577,0.200334,0.199544,0.198663,0.195786,0.195653,0.19322,0.193537,0.191503,0.190253,0.189253,0.188771,0.1856,0.185099,0.184111,0.182717] + check = [0.269037,0.272176,0.269917,0.271416,0.273988,0.271432, + 0.271857,0.271232,0.271118,0.269797,0.271095,0.266912, + 0.268015,0.268356,0.266256,0.26287,0.262888,0.263964, + 0.263281,0.262905,0.261669,0.26094,0.259081,0.257802, + 0.256029,0.254228,0.256913,0.257021,0.253692,0.256491, + 0.252454,0.251969,0.25204,0.252423,0.249516,0.247844, + 0.247895,0.24476,0.245734,0.244125,0.244474,0.244491, + 0.243126,0.242359,0.241239,0.24154,0.240976,0.239421, + 0.23933,0.236688,0.234685,0.234105,0.233034,0.232036, + 0.231208,0.229714,0.228749,0.227122,0.226918,0.225969, + 0.22497,0.223933,0.222426,0.221684,0.2206,0.219277, + 0.217739,0.217173,0.216193,0.215869,0.216354,0.213597, + 0.213271,0.213407,0.219829,0.216259,0.215635,0.218058, + 0.209499,0.209503,0.206529,0.205981,0.20445,0.203577, + 0.202577,0.200334,0.199544,0.198663,0.195786, + 0.195653,0.19322,0.193537,0.191503,0.190253, + 0.189253,0.188771,0.1856,0.185099,0.184111,0.182717] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -373,7 +424,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.514758,0.520759,0.516451,0.51932,0.524206,0.519275,0.520125,0.518997,0.518729,0.516198,0.518718,0.51072,0.512816,0.513449,0.509453,0.502968,0.503003,0.505098,0.503835,0.503088,0.500716,0.499304,0.495777,0.49332,0.489926,0.486497,0.491656,0.491858,0.48546,0.490808,0.483111,0.482176,0.482359,0.483098,0.477528,0.474279,0.474485,0.468472,0.470305,0.467228,0.467934,0.467971,0.465358,0.463885,0.461762,0.462352,0.461285,0.458322,0.458118,0.453064,0.44927,0.448151,0.446129,0.444207,0.442629,0.439792,0.437958,0.434826,0.434443,0.432655,0.430731,0.428771,0.425893,0.424477,0.422421,0.419886,0.416942,0.415876,0.414037,0.41339,0.414353,0.409062,0.408431,0.408712,0.419282,0.412833,0.41062,0.414427,0.400056,0.400141,0.394724,0.393821,0.390721,0.38932,0.387497,0.383062,0.381603,0.380016,0.374635,0.374214,0.369733,0.370353,0.366464,0.364109,0.362184,0.361299,0.355246,0.354339,0.352412,0.349748] + check = [0.514758,0.520759,0.516451,0.51932,0.524206,0.519275, + 0.520125,0.518997,0.518729,0.516198,0.518718,0.51072, + 0.512816,0.513449,0.509453,0.502968,0.503003,0.505098, + 0.503835,0.503088,0.500716,0.499304,0.495777,0.49332, + 0.489926,0.486497,0.491656,0.491858,0.48546,0.490808, + 0.483111,0.482176,0.482359,0.483098,0.477528,0.474279, + 0.474485,0.468472,0.470305,0.467228,0.467934,0.467971, + 0.465358,0.463885,0.461762,0.462352,0.461285,0.458322, + 0.458118,0.453064,0.44927,0.448151,0.446129,0.444207, + 0.442629,0.439792,0.437958,0.434826,0.434443,0.432655, + 0.430731,0.428771,0.425893,0.424477,0.422421,0.419886, + 0.416942,0.415876,0.414037,0.41339,0.414353,0.409062, + 0.408431,0.408712,0.419282,0.412833,0.41062,0.414427, + 0.400056,0.400141,0.394724,0.393821,0.390721,0.38932, + 0.387497,0.383062,0.381603,0.380016,0.374635,0.374214, + 0.369733,0.370353,0.366464,0.364109,0.362184,0.361299, + 0.355246,0.354339,0.352412,0.349748] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -496,7 +563,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.374914,0.393394,0.414756,0.443152,0.460175,0.456802,0.477264,0.478456,0.488523,0.489758,0.489871,0.487127,0.497585,0.499346,0.49526,0.489273,0.486082,0.486923,0.494208,0.494531,0.492264,0.494608,0.478766,0.487872,0.48357,0.474654,0.48052,0.483367,0.485269,0.480079,0.482254,0.47413,0.48245,0.471207,0.476589,0.474701,0.472014,0.465479,0.468236,0.462524,0.46773,0.458851,0.457653,0.461929,0.465216,0.451887,0.45733,0.450281,0.45045,0.447508,0.446209,0.445063,0.446328,0.445735,0.444096,0.438758,0.43707,0.432302,0.437903,0.430176,0.426317,0.427858,0.433131,0.423087,0.418146,0.421584,0.417606,0.420891,0.414255,0.412448,0.413393,0.405706,0.404541,0.403016,0.402806,0.400023,0.394248,0.396725,0.389808,0.386475,0.386525,0.386674,0.386575,0.382081,0.373986,0.370391,0.37367,0.373686,0.367479,0.36732,0.36031,0.366588,0.362994,0.361712,0.351433,0.349867,0.3479,0.352355,0.344987,0.340605] + check = [0.374914,0.393394,0.414756,0.443152,0.460175,0.456802, + 0.477264,0.478456,0.488523,0.489758,0.489871,0.487127, + 0.497585,0.499346,0.49526,0.489273,0.486082,0.486923, + 0.494208,0.494531,0.492264,0.494608,0.478766,0.487872, + 0.48357,0.474654,0.48052,0.483367,0.485269,0.480079, + 0.482254,0.47413,0.48245,0.471207,0.476589,0.474701, + 0.472014,0.465479,0.468236,0.462524,0.46773,0.458851, + 0.457653,0.461929,0.465216,0.451887,0.45733,0.450281, + 0.45045,0.447508,0.446209,0.445063,0.446328,0.445735, + 0.444096,0.438758,0.43707,0.432302,0.437903,0.430176, + 0.426317,0.427858,0.433131,0.423087,0.418146,0.421584, + 0.417606,0.420891,0.414255,0.412448,0.413393,0.405706, + 0.404541,0.403016,0.402806,0.400023,0.394248,0.396725, + 0.389808,0.386475,0.386525,0.386674,0.386575,0.382081, + 0.373986,0.370391,0.37367,0.373686,0.367479,0.36732, + 0.36031,0.366588,0.362994,0.361712,0.351433,0.349867, + 0.3479,0.352355,0.344987,0.340605] # Check that I(q) is the same for both data sets deltas = map(_diff_iq, data, check) @@ -506,6 +589,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): def test_SampleGeometry_functions(self): print "SKIPPING test_SampleGeometry_functions()" return + #pylint: disable=unreachable GPSANS() DataPath(TEST_DIR) AppendDataFile("BioSANS_test_data.xml") @@ -529,7 +613,25 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): self.assertTrue(math.fabs(delta)<0.1) def test_noDC_eff_with_DC(self): - ref = [28.06525, 136.94662, -16.20412, 0.00000, 147.79915, 146.42713, 302.00869, 0.00000, 0.00000,-1869.20724,-2190.89681,-1892.14939,-2140.79608,-1980.60037,-2096.75974,-2221.30118,-2263.51541,-2264.89989,-2364.83528,-2420.58152,-2444.51906,-2418.28886,-2606.16991,-2556.93660,-2623.71380,-2547.79671,-2670.60962,-2714.35237,-2717.01692,-2730.84974,-2768.92925,-2753.96396,-2732.66316,-2795.89687,-2780.37320,-2755.38910,-2814.88120,-2830.74081,-2803.42030,-2815.33244,-2754.70444,-2718.55136,-2740.03811,-2754.60415,-2815.96387,-2754.62039,-2781.54596,-2765.26282,-2676.04665,-2762.33751,-2722.94832,-2707.74990,-2730.50371,-2721.71272,-2682.02439,-2703.36446,-2679.47677,-2658.57573,-2669.41871,-2618.90655,-2638.41601,-2614.69128,-2583.29713,-2589.39730,-2567.19209,-2535.09328,-2539.43296,-2489.60117,-2500.76844,-2456.22248,-2444.13734,-2392.68589,-2410.98591,-2348.68064,-2334.84651,-2310.41426,-2250.24085,-2220.02192,-2184.65990,-2154.19638,-2099.56797,-2058.51585,-2004.05601,-1966.52356,-1910.47283,-1876.72098,-1817.69045,-1768.62167,-1721.56444,-1666.47199,-1608.86707,-1544.26178,-1492.78389,-1438.69256,-1358.60437,-1299.34476,-1221.57010,-1080.69421,-609.77891, -77.72765] + ref = [28.06525, 136.94662, -16.20412, 0.00000, 147.79915, 146.42713, 302.00869, + 0.00000, 0.00000,-1869.20724,-2190.89681,-1892.14939,-2140.79608,-1980.60037, + -2096.75974,-2221.30118,-2263.51541,-2264.89989,-2364.83528, + -2420.58152,-2444.51906,-2418.28886,-2606.16991,-2556.93660, + -2623.71380,-2547.79671,-2670.60962,-2714.35237,-2717.01692, + -2730.84974,-2768.92925,-2753.96396,-2732.66316,-2795.89687, + -2780.37320,-2755.38910,-2814.88120,-2830.74081,-2803.42030, + -2815.33244,-2754.70444,-2718.55136,-2740.03811,-2754.60415, + -2815.96387,-2754.62039,-2781.54596,-2765.26282,-2676.04665, + -2762.33751,-2722.94832,-2707.74990,-2730.50371,-2721.71272, + -2682.02439,-2703.36446,-2679.47677,-2658.57573,-2669.41871, + -2618.90655,-2638.41601,-2614.69128,-2583.29713,-2589.39730, + -2567.19209,-2535.09328,-2539.43296,-2489.60117,-2500.76844, + -2456.22248,-2444.13734,-2392.68589,-2410.98591,-2348.68064, + -2334.84651,-2310.41426,-2250.24085,-2220.02192,-2184.65990, + -2154.19638,-2099.56797,-2058.51585,-2004.05601,-1966.52356, + -1910.47283,-1876.72098,-1817.69045,-1768.62167,-1721.56444, + -1666.47199,-1608.86707,-1544.26178,-1492.78389,-1438.69256, + -1358.60437,-1299.34476,-1221.57010,-1080.69421,-609.77891, -77.72765] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() # name clash with SolidAngle algorithm @@ -537,7 +639,8 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True) #IQxQy(nbins=100) DirectBeamCenter("BioSANS_empty_cell.xml") - SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) + SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, + dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) DivideByThickness(1) SetTransmission(1, 0) ThetaDependentTransmission(True) @@ -556,8 +659,22 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): msg="result point %d: %g, found %g" % (i, ref[i], res[i])) def test_DC_eff_with_DC(self): - #ref = [8328.70241,8506.01586,5118.44441, 0.00000,7774.69442,8455.91783,14509.24224, 0.00000, 0.00000,-27551.42890,-34835.52157,-28076.35417,-32645.28731,-29923.90302,-32544.89749,-34519.58590,-35354.19282,-35242.21670,-37201.40137,-38547.80168,-38708.50152,-38339.04967,-41672.21115,-40898.80246,-41881.33026,-40789.34624,-43124.60460,-43846.74602,-43608.61731,-44050.49270,-44607.80184,-44662.71286,-44125.45576,-45197.75580,-45086.38543,-44502.49049,-45552.66509,-45678.42736,-45347.87980,-45613.96643,-44424.82296,-43888.62587,-44292.95665,-44465.13383,-45647.14865,-44450.82619,-44951.69404,-44597.94666,-43277.63573,-44605.52402,-44004.61793,-43774.86031,-44169.38692,-43970.30050,-43316.88231,-43786.96873,-43355.97746,-42952.99756,-43062.07976,-42184.58157,-42578.47214,-42199.41403,-41700.43004,-41780.97621,-41386.94893,-40865.71000,-40932.98886,-40036.67895,-40214.90469,-39471.74497,-39278.21830,-38383.80488,-38728.91704,-37705.78298,-37327.89414,-36943.11807,-35906.89550,-35399.21901,-34751.80556,-34209.49716,-33271.20006,-32530.08744,-31561.29164,-30906.03234,-29895.47664,-29278.16621,-28248.29021,-27341.79392,-26549.84441,-25476.57298,-24453.63444,-23305.85255,-22332.01538,-21306.01200,-19867.21655,-18795.14216,-17317.28374,-14745.54556,-6037.28367,4125.05228] - ref = [28.0476,136.906,-16.3079,0,147.757,146.403,301.982,0,0,-1869.21,-2190.93,-1892.16,-2140.81,-1980.62,-2096.79,-2221.34,-2263.55,-2264.93,-2364.87,-2420.61,-2444.56,-2418.32,-2606.21,-2556.98,-2623.75,-2547.84,-2670.66,-2714.39,-2717.06,-2730.89,-2768.96,-2754.01,-2732.7,-2795.93,-2780.41,-2755.42,-2814.92,-2830.79,-2803.46,-2815.38,-2754.75,-2718.6,-2740.08,-2754.65,-2816.01,-2754.66,-2781.59,-2765.3,-2676.09,-2762.38,-2722.99,-2707.8,-2730.55,-2721.76,-2682.07,-2703.41,-2679.52,-2658.62,-2669.46,-2618.95,-2638.46,-2614.74,-2583.34,-2589.44,-2567.23,-2535.14,-2539.48,-2489.64,-2500.81,-2456.26,-2444.18,-2392.73,-2411.03,-2348.73,-2334.89,-2310.46,-2250.28,-2220.07,-2184.7,-2154.24,-2099.61,-2058.56,-2004.1,-1966.57,-1910.52,-1876.76,-1817.73,-1768.67,-1721.61,-1666.51,-1608.91,-1544.31,-1492.83,-1438.74,-1358.65,-1299.39,-1221.61,-1080.73,-609.821,-77.7712] + ref = [28.0476,136.906,-16.3079,0,147.757,146.403,301.982, + 0,0,-1869.21,-2190.93,-1892.16,-2140.81,-1980.62,-2096.79, + -2221.34,-2263.55,-2264.93,-2364.87,-2420.61,-2444.56, + -2418.32,-2606.21,-2556.98,-2623.75,-2547.84,-2670.66, + -2714.39,-2717.06,-2730.89,-2768.96,-2754.01,-2732.7, + -2795.93,-2780.41,-2755.42,-2814.92,-2830.79,-2803.46, + -2815.38,-2754.75,-2718.6,-2740.08,-2754.65,-2816.01, + -2754.66,-2781.59,-2765.3,-2676.09,-2762.38,-2722.99, + -2707.8,-2730.55,-2721.76,-2682.07,-2703.41,-2679.52, + -2658.62,-2669.46,-2618.95,-2638.46,-2614.74,-2583.34, + -2589.44,-2567.23,-2535.14,-2539.48,-2489.64,-2500.81, + -2456.26,-2444.18,-2392.73,-2411.03,-2348.73,-2334.89, + -2310.46,-2250.28,-2220.07,-2184.7,-2154.24,-2099.61, + -2058.56,-2004.1,-1966.57,-1910.52,-1876.76,-1817.73, + -1768.67,-1721.61,-1666.51,-1608.91,-1544.31, + -1492.83,-1438.74,-1358.65,-1299.39,-1221.61,-1080.73,-609.821,-77.7712] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() @@ -566,7 +683,8 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True) #IQxQy(nbins=100) DirectBeamCenter("BioSANS_empty_cell.xml") - SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) + SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, + max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) DivideByThickness(1) SetTransmission(1, 0) ThetaDependentTransmission(True) @@ -585,8 +703,20 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): msg="result point %d: %g, found %g" % (i, ref[i], res[i])) def test_DC_eff_noDC(self): - #ref = [7164.60565,7752.68818,5711.05627, 0.00000,5900.87667,8062.67404, 0.00000, 0.00000,-24761.10043,-23989.79632,-27228.05671,-27520.90826,-28702.43297,-30016.08164,-31857.27731,-32831.96025,-33274.36135,-33765.95318,-35208.90831,-37330.42544,-38283.00967,-38157.84654,-40398.13178,-40807.56861,-40981.56490,-40010.58202,-42502.81591,-43001.82289,-42582.26700,-43857.23377,-44163.99857,-44732.14970,-43799.50312,-44791.12989,-44777.68791,-43985.74941,-45468.56174,-45452.90859,-45309.47499,-45759.04142,-43969.71697,-43854.45515,-44260.09016,-44420.83533,-45370.71500,-44500.35745,-45047.70688,-44404.89711,-43526.84357,-44566.97107,-43693.66349,-43741.61517,-44045.48712,-43860.53110,-43371.59488,-43623.05598,-43456.87922,-42905.84855,-42947.82849,-42114.29792,-42493.59647,-41998.37587,-41635.60470,-41808.27092,-41359.04234,-40774.21357,-40842.43155,-40073.84107,-40151.59039,-39504.86741,-39166.91772,-38472.64978,-38668.95577,-37731.30203,-37416.76227,-36798.92809,-35971.80065,-35477.59413,-34782.44503,-34089.54104,-33225.67613,-32520.31544,-31591.39201,-30937.42531,-29962.72283,-29241.95009,-28269.99833,-27317.23101,-26561.76975,-25533.91747,-24418.32912,-23309.34592,-22383.49546,-21298.00468,-19889.28546,-18800.07365,-17315.89420,-14744.66783,-6047.10832,4171.62004] - ref = [10.4139,124.814,25.0443,0,38.3413,133.417,0,0,-1733.56,-1627.57,-1811.38,-1851.58,-1888.38,-1957.07,-2056.47,-2117.52,-2139.32,-2176.94,-2239.91,-2350.65,-2417.75,-2406.99,-2525.48,-2551.45,-2566.83,-2499.38,-2632.35,-2662.17,-2653.14,-2718.65,-2740.78,-2758.94,-2712,-2771.35,-2761.38,-2724.05,-2809.97,-2815.92,-2801.25,-2824.54,-2726.76,-2716.63,-2737.83,-2752.06,-2798.95,-2757.7,-2787.58,-2753.12,-2691.47,-2759.93,-2703.94,-2705.55,-2722.64,-2714.75,-2685.28,-2693.49,-2685.75,-2655.65,-2662.42,-2614.47,-2633.12,-2602.29,-2579.4,-2591.17,-2565.28,-2529.61,-2533.85,-2491.87,-2496.78,-2458.25,-2437.25,-2398.16,-2407.29,-2350.32,-2340.43,-2301.5,-2254.37,-2224.97,-2186.64,-2146.73,-2096.71,-2058.12,-2006.2,-1968.6,-1914.93,-1874.31,-1819.05,-1767.14,-1722.35,-1670.38,-1606.61,-1544.51,-1496.24,-1438.21,-1360.12,-1299.68,-1221.61,-1080.91,-610.638,-71.9557] + ref = [10.4139,124.814,25.0443,0,38.3413,133.417,0,0,-1733.56,-1627.57, + -1811.38,-1851.58,-1888.38,-1957.07,-2056.47,-2117.52, + -2139.32,-2176.94,-2239.91,-2350.65,-2417.75,-2406.99,-2525.48, + -2551.45,-2566.83,-2499.38,-2632.35,-2662.17,-2653.14,-2718.65, + -2740.78,-2758.94,-2712,-2771.35,-2761.38,-2724.05,-2809.97, + -2815.92,-2801.25,-2824.54,-2726.76,-2716.63,-2737.83,-2752.06, + -2798.95,-2757.7,-2787.58,-2753.12,-2691.47,-2759.93,-2703.94, + -2705.55,-2722.64,-2714.75,-2685.28,-2693.49,-2685.75,-2655.65, + -2662.42,-2614.47,-2633.12,-2602.29,-2579.4,-2591.17,-2565.28, + -2529.61,-2533.85,-2491.87,-2496.78,-2458.25,-2437.25, + -2398.16,-2407.29,-2350.32,-2340.43,-2301.5,-2254.37,-2224.97, + -2186.64,-2146.73,-2096.71,-2058.12,-2006.2,-1968.6,-1914.93, + -1874.31,-1819.05,-1767.14,-1722.35,-1670.38,-1606.61, + -1544.51,-1496.24,-1438.21,-1360.12,-1299.68,-1221.61,-1080.91,-610.638,-71.9557] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() @@ -694,6 +824,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): print item return self.all_passed +#pylint: disable=too-many-arguments,unused-argument def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delta=None): """ Simple test to compare two numbers @@ -711,8 +842,8 @@ def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delt return True elif abs(first - second)/abs(second)<rel_delta: print '\n-----> %s != %s but within %s percent' % (str(first), - str(second), - str(rel_delta*100.0)) + str(second), + str(rel_delta*100.0)) return True standardMsg = '%s != %s within %s delta' % (str(first), @@ -726,8 +857,8 @@ def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delt return True standardMsg = '%s != %s within %r places' % (str(first), - str(second), - places) + str(second), + places) print standardMsg return False diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTransAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTransAPIv2.py index 4a77810a3b194a7f60236c30deec947a5edd83dc..04b8f98eddbfdc46aeb8353f12eb0c8c0268a2bc 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTransAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTransAPIv2.py @@ -8,24 +8,24 @@ import os def do_cleanup(): Files = ["BioSANS_test_data_reduction.log", - "BioSANS_test_data_Iq.xml", - "BioSANS_test_data_Iq.txt", - "BioSANS_test_data_Iqxy.dat"] - for file in Files: - absfile = FileFinder.getFullPath(file) + "BioSANS_test_data_Iq.xml", + "BioSANS_test_data_Iq.txt", + "BioSANS_test_data_Iqxy.dat"] + for filename in Files: + absfile = FileFinder.getFullPath(filename) if os.path.exists(absfile): os.remove(absfile) return True -class HFIRTrans(stresstesting.MantidStressTest): +class HFIRTrans1(stresstesting.MantidStressTest): def cleanup(self): do_cleanup() return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -43,15 +43,15 @@ class HFIRTrans(stresstesting.MantidStressTest): self.disableChecking.append('Axes') return "BioSANS_test_data_Iq", 'HFIRTrans.nxs' -class HFIRTrans(stresstesting.MantidStressTest): +class HFIRTrans2(stresstesting.MantidStressTest): def cleanup(self): do_cleanup() return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -75,8 +75,8 @@ class HFIRTransmissionDarkCurrent(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -102,8 +102,8 @@ class HFIRTransmissionDirectBeamCenter(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -129,8 +129,8 @@ class HFIRTransmissionBeamCenter(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -157,8 +157,8 @@ class HFIRTransmissionBeamSpreader(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -187,8 +187,8 @@ class HFIRTransmissionBeamSpreaderDC(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -218,8 +218,8 @@ class HFIRTransmissionBeamSpreaderDBC(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() @@ -249,8 +249,8 @@ class HFIRTransmissionBeamSpreaderBC(stresstesting.MantidStressTest): return True def runTest(self): - config = ConfigService.Instance() - config["facilityName"]='HFIR' + configI = ConfigService.Instance() + configI["facilityName"]='HFIR' GPSANS() DirectBeamCenter("BioSANS_empty_cell.xml") TimeNormalization() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HRPDPowderDiffraction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HRPDPowderDiffraction.py index 1deba78de7197b4fa07693a3549aacfef157b27b..2616ed9e5a9c4d6d7f5dd35dcabb15051065d1d0 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HRPDPowderDiffraction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HRPDPowderDiffraction.py @@ -65,8 +65,8 @@ class HRPDPowderDiffraction(stresstesting.MantidStressTest): ConvertUnits(InputWorkspace="Vanadium",OutputWorkspace="Vanadium",Target="Wavelength") #Correct for cylinderAbsorption CylinderAbsorption(InputWorkspace="Vanadium",OutputWorkspace="Transmission",CylinderSampleHeight="2", - CylinderSampleRadius="0.4",AttenuationXSection="5.1",ScatteringXSection="5.08", - SampleNumberDensity="0.072",NumberOfSlices="10",NumberOfAnnuli="10",NumberOfWavelengthPoints="100") + CylinderSampleRadius="0.4",AttenuationXSection="5.1",ScatteringXSection="5.08", + SampleNumberDensity="0.072",NumberOfSlices="10",NumberOfAnnuli="10",NumberOfWavelengthPoints="100") Divide(LHSWorkspace="Vanadium",RHSWorkspace="Transmission",OutputWorkspace="Vanadium") #convert to dspacing and focuss ConvertUnits(InputWorkspace="Vanadium",OutputWorkspace="Vanadium",Target="dSpacing") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HYSPECReductionTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HYSPECReductionTest.py index 0642cf4249e5bd30db968c8573d1cf0f1c9a53ef..fac02c33a0aa0e014e26d465d10c958320780ce8 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HYSPECReductionTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HYSPECReductionTest.py @@ -8,6 +8,8 @@ import os import stresstesting class HYSPECReductionTest(stresstesting.MantidStressTest): + groupingFile = '' + tolerance=1e-8 def requiredMemoryMB(self): return 5000 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD2BTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD2BTest.py index 59490f63f0c20bdb7298342812d877ab2e406554..165cf6971dbdc2feaee14fc475bb518abdb29eec 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD2BTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD2BTest.py @@ -2,7 +2,7 @@ import stresstesting from mantid.api import mtd, IMDEventWorkspace -from mantid.simpleapi import LoadILLAscii +import mantid.simpleapi import unittest @@ -31,7 +31,7 @@ class ILLD2BLoadTest(unittest.TestCase): """ ILL Loader """ - LoadILLAscii(Filename=dataFile,OutputWorkspace=self.ws_name) + mantid.simpleapi.LoadILLAscii(Filename=dataFile,OutputWorkspace=self.ws_name) self._do_ads_check(self.ws_name) def _do_ads_check(self, name): @@ -42,6 +42,8 @@ class ILLD2BLoadTest(unittest.TestCase): class ILLD2BTest(stresstesting.MantidStressTest): + _success=False + def requiredMemoryMB(self): """Set a limit of 2.5Gb to avoid 32-bit environment""" return 2500 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD33Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD33Test.py index a429727bb91db045ba034e33f17134a96ff27805..38be10fae2729df40012e422c0a4ae30f17896e2 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD33Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLD33Test.py @@ -2,7 +2,7 @@ import stresstesting from mantid.api import mtd -from mantid.simpleapi import SetupILLD33Reduction, SANSReduction,Rebin,SANSAzimuthalAverage1D +import mantid.simpleapi as ms import unittest @@ -17,7 +17,7 @@ class ILLD33SANSTest(unittest.TestCase): def test_all(self): - SetupILLD33Reduction( + ms.SetupILLD33Reduction( # Beam center shouldn't work #BeamCenterMethod="None", MaskedDetectorList=[14709,14710,14711,14712,14713,14714,14715,14716,14717,14718,14719, @@ -67,12 +67,12 @@ class ILLD33SANSTest(unittest.TestCase): ComputeResolution=True, ReductionProperties=self.prefix + "props") - output=SANSReduction(Filename='ILL/001425.nxs', ReductionProperties=self.prefix + "props", - OutputWorkspace=self.prefix + "out") - Rebin(InputWorkspace=self.prefix + 'out',OutputWorkspace=self.prefix + 'out_rebin', - Params='4,0.1,15') - SANSAzimuthalAverage1D(InputWorkspace=self.prefix + 'out_rebin',Binning='0.001,0.0002,0.03', - OutputWorkspace=self.prefix + 'final') + ms.SANSReduction(Filename='ILL/001425.nxs', ReductionProperties=self.prefix + "props", + OutputWorkspace=self.prefix + "out") + ms.Rebin(InputWorkspace=self.prefix + 'out',OutputWorkspace=self.prefix + 'out_rebin', + Params='4,0.1,15') + ms.SANSAzimuthalAverage1D(InputWorkspace=self.prefix + 'out_rebin',Binning='0.001,0.0002,0.03', + OutputWorkspace=self.prefix + 'final') # Check some data wsOut = mtd[self.prefix + 'out'] @@ -92,6 +92,7 @@ class ILLD33SANSTest(unittest.TestCase): #==================================================================================== class ILLD33Test(stresstesting.MantidStressTest): + _success = False def requiredMemoryMB(self): """Set a limit of 2.5Gb to avoid 32-bit environment""" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN4Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN4Test.py index aabdcdfbf69a52a5f54d316d752f8d53cce07e99..370120cf82cf5fb1c1d7e910f517fb9d8a589c2f 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN4Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN4Test.py @@ -2,7 +2,7 @@ import stresstesting from mantid.api import MatrixWorkspace, mtd -from mantid.simpleapi import LoadILL +import mantid.simpleapi as ms from mantid.kernel import V3D import unittest @@ -48,7 +48,7 @@ class ILLIN4Tests(unittest.TestCase): """ ILL Loader """ - LoadILL(Filename=dataFile,OutputWorkspace=self.ws_name) + ms.LoadILL(Filename=dataFile,OutputWorkspace=self.ws_name) self._do_ads_check(self.ws_name) def _do_ads_check(self, name): @@ -59,6 +59,8 @@ class ILLIN4Tests(unittest.TestCase): class LoadILLIN4Test(stresstesting.MantidStressTest): + _success = False + def runTest(self): self._success = False # Custom code to create and run this single test suite diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py index c918b179a1b38d0515d2a0cf2c3f984e5fca0f30..20124243941c97e6ece0d1b0379169294f30cffe 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py @@ -2,7 +2,7 @@ import stresstesting from mantid.api import MatrixWorkspace, mtd -from mantid.simpleapi import LoadILL +from mantid.simpleapi import * import unittest @@ -57,7 +57,7 @@ class ILLIN5Tests(unittest.TestCase): #================== Private methods ================================ - + #pylint: disable=unused-argument def _run_load(self, dataFile, vanaFile=None,vanaWS=None,outWSName=wsData_name): """ ILL Loader @@ -72,7 +72,7 @@ class ILLIN5Tests(unittest.TestCase): #==================================================================================== class LoadILLIN5Test(stresstesting.MantidStressTest): - + _success=False def runTest(self): self._success = False # Custom code to create and run this single test suite diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/INTERLoadingTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/INTERLoadingTest.py index 74921f7c23019b198b676be39135eb7f97ec8c72..f4ed2c8462d210aefd33e04eed7425ce64b2ecc9 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/INTERLoadingTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/INTERLoadingTest.py @@ -1,9 +1,9 @@ #pylint: disable=no-init from LoadAndCheckBase import * -''' -Test File loading and basic data integrity checks of INTER data in Mantid. -''' +# +#Test File loading and basic data integrity checks of INTER data in Mantid. +# class INTERLoadingTest(LoadAndCheckBase): def get_raw_workspace_filename(self): return "INTER00007709.raw" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py index 9dd54ffab5d901da67bec594c9c0b3d9a363a149..ef5d9cf1b346912c8da3a6040f05ce4860a393e7 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py @@ -27,12 +27,14 @@ class ISISDirectInelasticReduction(stresstesting.MantidStressTest): - hard_mask: An hard mask file or None """ __metaclass__ = ABCMeta # Mark as an abstract class + tolerance=0. + tolerance_is_reller=True @abstractmethod def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implement get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") @abstractmethod def get_result_workspace(self): @@ -88,6 +90,7 @@ class MARIReductionFromFile(ISISDirectInelasticReduction): def runTest(self): #self.red.run_reduction() + #pylint: disable=unused-variable outWS = self.red.reduce() outWS*=self.scale_to_fix_abf @@ -98,15 +101,17 @@ class MARIReductionFromFile(ISISDirectInelasticReduction): return "MARIReduction.nxs" class MARIReductionFromFileCache(ISISDirectInelasticReduction): + _counter=0 def __init__(self): ISISDirectInelasticReduction.__init__(self) self.tolerance = 1e-9 from ISIS_MariReduction import ReduceMARIFromFile - + self._file_to_clear = None self.red = ReduceMARIFromFile() self.red.def_advanced_properties() self.red.def_main_properties() + self.counter=0 def prepare_test_file(self): """ This method will run instead of pause and @@ -182,9 +187,9 @@ class MARIReductionFromWorkspace(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=self.scale_to_fix_abf @@ -208,9 +213,9 @@ class MARIReductionMon2Norm(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=0.989834962505304 def get_result_workspace(self): @@ -230,10 +235,10 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): def __init__(self): ISISDirectInelasticReduction.__init__(self) - # This test has not been run properly so reference file is kind-of - # arbitrary. It just checks that this reduction works. - # Mari reduction masks are not correct for monitors loaded separately, - # This explains all the difference encountered. + # This test has not been run properly so reference file is kind-of + # arbitrary. It just checks that this reduction works. + # Mari reduction masks are not correct for monitors loaded separately, + # This explains all the difference encountered. from ISIS_MariReduction import ReduceMARIMonitorsSeparate self.red = ReduceMARIMonitorsSeparate() @@ -242,10 +247,11 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - # temporary fix cross-influence of tests for MARI. changes to nex ticket make this unnecessary + # temporary fix cross-influence of tests for MARI. changes to nex ticket make this unnecessary PropertyManager.mono_correction_factor.set_cash_mono_run_number(None) + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=0.997966051169129 @@ -254,8 +260,8 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): return "outWS" def get_reference_file(self): - # monitor separate for MARI needs new maps and masks so, it is easier to redefine - # reference file for the time being + # monitor separate for MARI needs new maps and masks so, it is easier to redefine + # reference file for the time being return "MARIReductionMonSeparate.nxs" class MARIReductionSum(ISISDirectInelasticReduction): @@ -271,10 +277,11 @@ class MARIReductionSum(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test - It verifies operation on summing two files on demand. No absolute units - """ + It verifies operation on summing two files on demand. No absolute units + """ + #pylint: disable=unused-variable outWS=self.red.reduce() - #outWS*=1.00001556766686 + #outWS*=1.00001556766686 def get_result_workspace(self): """Returns the result workspace to be checked""" @@ -293,6 +300,8 @@ class MARIReductionWaitAndSum(ISISDirectInelasticReduction): self.red = MARIReductionSum() self.red.def_advanced_properties() self.red.def_main_properties() + self._counter=0 + self._file_to_clear = '' def prepare_test_file(self): """ This method will run instead of pause and @@ -325,6 +334,7 @@ class MARIReductionWaitAndSum(ISISDirectInelasticReduction): self._counter=0 self.red.reducer.prop_man.sample_run=[11001,11002] + #pylint: disable=unused-variable outWS = self.red.run_reduction() self.red.wait_for_file =0 @@ -351,21 +361,21 @@ class MAPSDgreduceReduction(ISISDirectInelasticReduction): ISISDirectInelasticReduction.__init__(self) from ISIS_MAPS_DGSReduction import ReduceMAPS - + self.ws_name='' self.red = ReduceMAPS() self.red.def_advanced_properties() self.red.def_main_properties() def runTest(self): - + #pylint: disable=unused-variable outWS=self.red.reduce() - #New WBI value 0.02720959162181584 - #Old WBI Value 0.027209867107187088 - # fix old system test. - #outWS*=0.02720959162181584/0.027209867107187088 + #New WBI value 0.02720959162181584 + #Old WBI Value 0.027209867107187088 + # fix old system test. + #outWS*=0.02720959162181584/0.027209867107187088 - # rename workspace to the name expected by unit test framework - #RenameWorkspace(InputWorkspace=outWS,OutputWorkspace=wsName) + # rename workspace to the name expected by unit test framework + #RenameWorkspace(InputWorkspace=outWS,OutputWorkspace=wsName) self.ws_name = 'outWS' @@ -386,7 +396,7 @@ class MERLINReduction(ISISDirectInelasticReduction): def __init__(self): ''' Test relies on MERLIN_Parameters.xml file introduced in July 2014 - ''' + ''' ISISDirectInelasticReduction.__init__(self) from ISIS_MERLINReduction import ReduceMERLIN @@ -396,6 +406,7 @@ class MERLINReduction(ISISDirectInelasticReduction): self.red.def_main_properties() def runTest(self): + #pylint: disable=unused-variable outWS = self.red.reduce() def get_reference_file(self): @@ -417,7 +428,8 @@ class MERLINReduction(ISISDirectInelasticReduction): # class LETReduction(stresstesting.MantidStressTest): - + tolerance = 1e-6 + tolerance_is_reller=True def requiredMemoryMB(self): """Far too slow for managed workspaces. They're tested in other places. Requires 2Gb""" return 2000 @@ -432,7 +444,7 @@ class LETReduction(stresstesting.MantidStressTest): red = ReduceLET_OneRep() red.def_main_properties() red.def_advanced_properties() - + #pylint: disable=unused-variable outWS=red.reduce() @@ -447,9 +459,10 @@ class LETReduction(stresstesting.MantidStressTest): class LETReductionEvent2015Multirep(stresstesting.MantidStressTest): """ - written in a hope that most of the stuff find here will eventually find its way into main reduction routines - """ - + written in a hope that most of the stuff find here will eventually find its way into main reduction routines + """ + tolerance = 1e-6 + tolerance_is_reller=True def requiredMemoryMB(self): """Far too slow for managed workspaces. They're tested in other places. Requires 20Gb""" return 20000 @@ -466,14 +479,11 @@ class LETReductionEvent2015Multirep(stresstesting.MantidStressTest): red.def_advanced_properties() red.def_main_properties() - + #pylint: disable=unused-variable out_ws_list=red.run_reduction() - #for ind,ws in enumerate(out_ws_list): - # ws *=mults[ind] - - - + #for ind,ws in enumerate(out_ws_list): + # ws *=mults[ind] def validate(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectBayesTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectBayesTest.py index 1e3c1a496bf52e1e7831d5c668ccc31c6645fb24..b0aa455ee7c303f8e47d118657147e500616d293 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectBayesTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectBayesTest.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,attribute-defined-outside-init +#pylint: disable=no-init,attribute-defined-outside-init, too-few-public-methods import stresstesting import os from abc import ABCMeta, abstractmethod diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py index 2b7702622f0995a6eff52b9bd160b25a37e50091..bcf63cb6f4a141a6352a7c561b9b2d1b203d5c92 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISIndirectInelastic.py @@ -1,4 +1,5 @@ -#pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-lines,too-many-instance-attributes,non-parent-init-called,abstract-method +#pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-lines +#pylint: disable=too-many-instance-attributes,non-parent-init-called,abstract-method,too-few-public-methods # non-parent-init-called is disabled to remove false positives from a bug in pyLint < 1.4 # abstract-mehod checking seems to ignore the fact some classes are declared abstract using abc @@ -106,8 +107,7 @@ class ISISIndirectInelasticBase(stresstesting.MantidStressTest): raise RuntimeError("The result workspace(s) should be in a list") if num_ref_files != num_results: raise RuntimeError("The number of result workspaces (%d) does not match" - " the number of reference files (%d)." % ( - num_ref_files, num_results)) + " the number of reference files (%d)." % (num_ref_files, num_results)) if num_ref_files < 1 or num_results < 1: raise RuntimeError("There needs to be a least one result and " "reference.") @@ -1143,8 +1143,8 @@ class IRISConvFit(ISISIndirectInelasticConvFit): self.resolution = FileFinder.getFullPath('irs53664_graphite002_res.nxs') #ConvFit fit function self.func = 'name=LinearBackground,A0=0.060623,A1=0.001343;(composite=Convolution,FixResolution=true,NumDeriv=true;'\ - 'name=Resolution,Workspace=\"%s\";name=Lorentzian,Amplitude=1.033150,PeakCentre=-0.000841,FWHM=0.001576)' % ( - self.resolution) + 'name=Resolution,Workspace=\"%s\";name=Lorentzian,Amplitude=1.033150,PeakCentre=-0.000841,FWHM=0.001576)'\ + % (self.resolution) self.ftype = '1L' self.startx = -0.2 self.endx = 0.2 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py index 5d88d3a15811f78acd2ff63af9099cd09ec4270e..04bd5536fa80174ccb85c8b1d10b38a7322cd7cd 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,invalid-name,attribute-defined-outside-init +#pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import math import stresstesting from mantid.simpleapi import * @@ -30,7 +30,7 @@ class ISISMuonAnalysis(stresstesting.MantidStressTest): def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implmenent get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") def get_result_workspace(self): """Returns the result workspace to be checked""" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py index bf411b23d563efaf3d4b42b0f8e7f4bc0423ea35..f4cd88a8049f523ebe3b95d4809781459d8bbf0f 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,attribute-defined-outside-init +#pylint: disable=no-init,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import stresstesting from mantid.simpleapi import * @@ -27,7 +27,7 @@ class ISISMuonAnalysisGrouping(stresstesting.MantidStressTest): def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implmenent get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") def get_result_workspace(self): """Returns the result workspace to be checked""" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISReflInstrumentIDFTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISReflInstrumentIDFTest.py index 9a3737b1c7026c61cfd048ffb5f71180a0c74cc1..cbd1f4739e9d35cf77f0332db0596f0c07f1f2b3 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISReflInstrumentIDFTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISReflInstrumentIDFTest.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,invalid-name +#pylint: disable=no-init,invalid-name,too-few-public-methods """ These system tests are to verify that the IDF and parameter files for POLREF, CRISP, INTER and SURF are read properly """ diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py index e43851af224a57248ca19a95d08cc06db07303d7..bc6ba04a0cb464af756c1fe27b412ca7176d77cb 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_LETReduction.py @@ -6,7 +6,7 @@ from Direct.ReductionWrapper import * try: import reduce_vars as web_var -except: +except ImportError: web_var = None # @@ -65,7 +65,8 @@ class ReduceLET_OneRep(ReductionWrapper): # Absolute units reduction properties. #prop['monovan_run'] = 17589 - #prop['sample_mass'] = 10/(94.4/13) # -- this number allows to get approximately the same system test intensities for MAPS as the old test + #prop['sample_mass'] = 10/(94.4/13) + # -- this number allows to get approximately the same system test intensities for MAPS as the old test #prop['sample_rmm'] = 435.96 # return prop @@ -100,8 +101,8 @@ class ReduceLET_OneRep(ReductionWrapper): sample_ws = 'w1' monitors_ws = sample_ws + '_monitors' LoadEventNexus(Filename='LET00006278.nxs',OutputWorkspace=sample_ws, - SingleBankPixelsOnly='0',LoadMonitors='1', - MonitorsAsEvents='1') + SingleBankPixelsOnly='0',LoadMonitors='1', + MonitorsAsEvents='1') ConjoinWorkspaces(InputWorkspace1=sample_ws, InputWorkspace2=monitors_ws) #prop.sample_run = sample_ws diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py index 4b63de346581345e122a8a1642f6b36e12cf513a..b3fa6c93a64d7f7e69e34b66ba9c34db6f958743 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py @@ -1,6 +1,6 @@ #pylint: disable=invalid-name """ Sample MERLIN reduction scrip """ -import os +#import os #os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from Direct.ReductionWrapper import * @@ -25,7 +25,8 @@ class ReduceMERLIN(ReductionWrapper): # Absolute units reduction properties. #prop['monovan_run'] = 17589 - #prop['sample_mass'] = 10/(94.4/13) # -- this number allows to get approximately the same system test intensities for MAPS as the old test + #prop['sample_mass'] = 10/(94.4/13) + # -- this number allows to get approximately the same system test intensities for MAPS as the old test #prop['sample_rmm'] = 435.96 # return prop @@ -65,7 +66,7 @@ if __name__=="__main__": #data_dir ='d:/Data/Mantid_Testing/14_11_27' #ref_data_dir = 'd:/Data/MantidSystemTests/SystemTests/AnalysisTests/ReferenceResults' #config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir)) - #config.appendDataSearchDir('d:/Data/Mantid_GIT/Test/AutoTestData') + #config.appendDataSearchDir('d:/Data/Mantid_GIT/Test/AutoTestData') #config['defaultsave.directory'] = data_dir # folder to save resulting spe/nxspe files. Defaults are in # execute stuff from Mantid diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py index 8d045980429b9f61c9a9dd3b9616347abb766926..ef9998fcc48d76859af66ca510bdaf0cb6850304 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py @@ -319,8 +319,8 @@ if __name__ == "__main__": #### uncomment rows below to generate web variables and save then to transfer to ### ## web services. run_dir = os.path.dirname(os.path.realpath(__file__)) - file = os.path.join(run_dir,'reduce_vars.py') - rd.save_web_variables(file) + filename = os.path.join(run_dir,'reduce_vars.py') + rd.save_web_variables(filename) #### Set up time interval (sec) for reducer to check for input data file. #### # If this file is not present and this value is 0,reduction fails diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/IndirectDiffractionTests.py b/Code/Mantid/Testing/SystemTests/tests/analysis/IndirectDiffractionTests.py index b847316984025ec3dc07581d4871215e23d04538..45ba4c68a47a93c3d65a0c3ae659f796447c07d9 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/IndirectDiffractionTests.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/IndirectDiffractionTests.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,non-parent-init-called +#pylint: disable=no-init,non-parent-init-called,too-few-public-methods # non-parent-init-called is disabled to remove false positives from a bug in pyLint < 1.4 from abc import ABCMeta, abstractmethod diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LOQSANSUtilityTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LOQSANSUtilityTest.py index caf625890c8bce6c74d9732d902b2a5704830c39..e4f13dce7dc4c8382322d9bc42f5e419673c8724 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LOQSANSUtilityTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LOQSANSUtilityTest.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name,no-init +#pylint: disable=invalid-name,no-init,too-few-public-methods import stresstesting from mantid.simpleapi import * import SANSUtility as su diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LRScalingFactorsTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LRScalingFactorsTest.py index afdf17e061eddf25049f34bb30598695e5b9f161..e5d97c36024d4e02ed9c18d3a584e8d31f33ba65 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LRScalingFactorsTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LRScalingFactorsTest.py @@ -10,8 +10,10 @@ class LRPrimaryFractionTest(stresstesting.MantidStressTest): # #lambdaRequested[Angstroms] S1H[mm] (S2/Si)H[mm] S1W[mm] (S2/Si)W[mm] a b error_a error_b # - IncidentMedium=Air LambdaRequested=5.0 S1H=0.202 S2iH=0.196767 S1W=9.002 S2iW=9.004654 a=7.79202718645 b=3.39894488089e-05 error_a=0.0936282133631 error_b=5.79945870854e-06 - IncidentMedium=Air LambdaRequested=5.0 S1H=0.202 S2iH=0.196767 S1W=20.0 S2iW=20.007348 a=24.4210636894 b=0.00010609255313 error_a=0.390001391338 error_b=2.51447482677e-05 + #IncidentMedium=Air LambdaRequested=5.0 S1H=0.202 S2iH=0.196767 S1W=9.002 S2iW=9.004654 + #a=7.79202718645 b=3.39894488089e-05 error_a=0.0936282133631 error_b=5.79945870854e-06 + #IncidentMedium=Air LambdaRequested=5.0 S1H=0.202 S2iH=0.196767 S1W=20.0 S2iW=20.007348 + #a=24.4210636894 b=0.00010609255313 error_a=0.390001391338 error_b=2.51447482677e-05 """ def runTest(self): @@ -19,7 +21,7 @@ class LRPrimaryFractionTest(stresstesting.MantidStressTest): LRScalingFactors(DirectBeamRuns=[124168, 124169, 124170, 124171, 124172], Attenuators = [0, 1, 1, 2, 2, 2], TOFRange=[10008, 35000], TOFSteps=200, - SignalPeakPixelRange=[150, 160], + SignalPeakPixelRange=[150, 160], SignalBackgroundPixelRange=[147, 163], ScalingFactorFile=self.cfg_file) @@ -30,31 +32,31 @@ class LRPrimaryFractionTest(stresstesting.MantidStressTest): reference = [[7.82, 3.20e-05, 0.054, 3.3e-06], [24.42, 0.000105, 0.225, 1.45e-05]] tolerances = [[0.1, 5e-6, 0.1, 3e-6], [0.1, 1e-5, 0.2, 2e-5]] - fd = open(self.cfg_file, 'r') + filed = open(self.cfg_file, 'r') item_number = 0 - for line in fd.readlines(): + for line in filed.readlines(): if line.startswith("#"): continue toks = line.split() for token in toks: pair = token.split('=') if pair[0].strip() == 'a': - a = float(pair[1]) + data_a = float(pair[1]) elif pair[0].strip() == 'b': - b = float(pair[1]) + data_b = float(pair[1]) elif pair[0].strip() == 'error_a': error_a = float(pair[1]) elif pair[0].strip() == 'error_b': error_b = float(pair[1]) - if not (abs(reference[item_number][0]- a ) < tolerances[item_number][0] \ - and abs(reference[item_number][1] - b) < tolerances[item_number][1] \ + if not (abs(reference[item_number][0]- data_a ) < tolerances[item_number][0] \ + and abs(reference[item_number][1] - data_b) < tolerances[item_number][1] \ and abs(reference[item_number][2]-error_a) < tolerances[item_number][2] \ and abs(reference[item_number][3] - error_b) < tolerances[item_number][3]): - logger.error("Found %5.3g %5.3g %5.3g %5.3g" % (a, b, error_a, error_b)) + logger.error("Found %5.3g %5.3g %5.3g %5.3g" % (data_a, data_b, error_a, error_b)) logger.error("Expected %5.3g %5.3g %5.3g %5.3g" % (reference[item_number][0], reference[item_number][1], reference[item_number][2], reference[item_number][3])) return False item_number += 1 - fd.close() + filed.close() os.remove(self.cfg_file) return True diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LiquidsReflectometryReductionWithBackgroundTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LiquidsReflectometryReductionWithBackgroundTest.py index 07fa5084cc3e5b63009abc15bea555eb56fc7539..a6e50c72fd44edc1df8d894789d618a37890a213 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LiquidsReflectometryReductionWithBackgroundTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LiquidsReflectometryReductionWithBackgroundTest.py @@ -162,6 +162,7 @@ class NoBackgroundTest(stresstesting.MantidStressTest): class TOFMismatchTest(stresstesting.MantidStressTest): + correct_exception_caught = False def runTest(self): #TODO: The reduction algorithm should not require an absolute path scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg") @@ -192,8 +193,8 @@ class TOFMismatchTest(stresstesting.MantidStressTest): SlitsWidthFlag=True, CropFirstAndLastPoints=False, OutputWorkspace='reflectivity_119816') - except RuntimeError as e: - if str(e).startswith("Requested TOF range does not match data"): + except RuntimeError as err: + if str(err).startswith("Requested TOF range does not match data"): self.correct_exception_caught = True def validate(self): @@ -201,6 +202,7 @@ class TOFMismatchTest(stresstesting.MantidStressTest): class BadDataTOFRangeTest(stresstesting.MantidStressTest): + correct_exception_caught = False def runTest(self): #TODO: The reduction algorithm should not require an absolute path scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg") @@ -231,8 +233,8 @@ class BadDataTOFRangeTest(stresstesting.MantidStressTest): SlitsWidthFlag=True, CropFirstAndLastPoints=False, OutputWorkspace='reflectivity_119816') - except RuntimeError as e: - if str(e).startswith("Requested TOF range does not match data"): + except RuntimeError as err: + if str(err).startswith("Requested TOF range does not match data"): self.correct_exception_caught = True def validate(self): @@ -240,6 +242,7 @@ class BadDataTOFRangeTest(stresstesting.MantidStressTest): class BadPeakSelectionTest(stresstesting.MantidStressTest): + correct_exception_caught = False def runTest(self): #TODO: The reduction algorithm should not require an absolute path scaling_factor_file = FileFinder.getFullPath("directBeamDatabaseFall2014_IPTS_11601_2.cfg") @@ -269,8 +272,8 @@ class BadPeakSelectionTest(stresstesting.MantidStressTest): SlitsWidthFlag=True, CropFirstAndLastPoints=False, OutputWorkspace='reflectivity_119816') - except RuntimeError as e: - if str(e).startswith("The reflectivity is all zeros"): + except RuntimeError as err: + if str(err).startswith("The reflectivity is all zeros"): self.correct_exception_caught = True def validate(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py index 324527385f7881411d841469415cc0c210cef8d4..85677c09a85355a3c38a4457c91ad25f435b2bea 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py @@ -5,7 +5,7 @@ These system tests are to verify the behaviour of the ISIS reflectometry reducti import stresstesting from mantid.simpleapi import * -import mantid.api._api +import mantid.api from abc import ABCMeta, abstractmethod @@ -67,14 +67,14 @@ class LoadAndCheckBase(stresstesting.MantidStressTest): self.assertTrue(type(a) == type(b)) #raise NotImplementedError() - if isinstance(a,mantid.api._api.WorkspaceGroup): + if isinstance(a,mantid.api.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. for i in range(0, a.size()): self.do_check_workspace_shape(a[i], b[i]) if self.enable_instrument_checking(): - self.do_check_instrument_applied(a[i], b[i]) + self.do_check_instrument_applied(a[a.size()-1], b[b.size()-1]) if self.enable_reference_result_checking(): Integration(InputWorkspace=a[0], OutputWorkspace=self.__comparison_out_workspace_name) else: diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadEmbeddedInstrumentInfo.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadEmbeddedInstrumentInfo.py index 7ab8f0630bc47aac3c127af14760fbd7381f0cc7..e300dbfbbddf0037032bc15bded2c7bede7c9cdb 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadEmbeddedInstrumentInfo.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadEmbeddedInstrumentInfo.py @@ -2,13 +2,12 @@ import stresstesting from mantid.simpleapi import * -""" -Here testing against embedded instrument info in different raw file formats - -This include to test that embedded information in raw ISIS Nexus file formats -get loaded correctly. - -""" +# +#Here testing against embedded instrument info in different raw file formats +# +#This include to test that embedded information in raw ISIS Nexus file formats +#get loaded correctly. +# # here test against a custom made ISIS raw hist nexus file created by Freddie # where the A1_window has be, for the purpose of testing, been put at a @@ -16,12 +15,11 @@ get loaded correctly. class ISISRawHistNexus(stresstesting.MantidStressTest): def runTest(self): - - # ISIS raw hist nexus file with A1_window at location (0,3,0) + # ISIS raw hist nexus file with A1_window at location (0,3,0) + #pylint: disable=unused-variable MAPS00018314_raw_ISIS_hist = Load('MAPS00018314.nxs') def validate(self): - MAPS00018314_raw_ISIS_hist = mtd['MAPS00018314_raw_ISIS_hist'] inst = MAPS00018314_raw_ISIS_hist.getInstrument() A1window = inst.getComponentByName('MAPS/A1_window') diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfFiles.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfFiles.py index 8c41a505b82b419d85f2001e1cf5d0fbd273bbd5..6fb382f2f3abb39a894e31b698128ab661e43f13 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfFiles.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfFiles.py @@ -70,14 +70,14 @@ BANNED_FILES = ['992 Descriptions.txt', 'MaskLOQData.txt', 'DIRECTHAB.983', 'loq_batch_mode_reduction.csv', - 'det_corrected7.nxs', # this file can be loaded by LoadDetectorInfo but I am not sure if generic loader should ever deal with it + 'det_corrected7.nxs', # this file can be loaded by LoadDetectorInfo; not sure if generic loader should ever deal with it 'poldi2013n006903.hdf', 'poldi2013n006904.hdf', 'poldi2014n019874.hdf', 'poldi2014n019881.hdf', 'poldi2015n000977.hdf', 'USER_SANS2D_143ZC_2p4_4m_M4_Knowles_12mm.txt' - ] + ] EXPECTED_EXT = '.expected' @@ -169,7 +169,7 @@ class LoadLotsOfFiles(stresstesting.MantidStressTest): cur_index = datafiles.index(fname) except ValueError: continue - value = datafiles.pop(cur_index) + dummy_value = datafiles.pop(cur_index) datafiles.insert(insertion_index, fname) return datafiles @@ -231,8 +231,8 @@ class LoadLotsOfFiles(stresstesting.MantidStressTest): del wksp return False - id = wksp.id() - if id is None or len(id) <= 0: + wid = wksp.id() + if wid is None or len(wid) <= 0: print "Workspace does not have an id" del wksp return False @@ -243,7 +243,7 @@ class LoadLotsOfFiles(stresstesting.MantidStressTest): print "Workspace has zero histograms" del wksp return False - if "managed" not in id.lower() and wksp.getMemorySize() <= 0: + if "managed" not in wid.lower() and wksp.getMemorySize() <= 0: print "Workspace takes no memory: Memory used=" + str(wksp.getMemorySize()) del wksp return False diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfInstruments.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfInstruments.py index 950d1075dae587846d87d8a6ccbeb5fdabd19d6a..e31762266794a0a768d9bf73a54ee5b9d8adca00 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfInstruments.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadLotsOfInstruments.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,invalid-name +#pylint: disable=no-init,invalid-name,too-few-public-methods from mantid.simpleapi import * from mantid.api import FrameworkManager import os @@ -57,6 +57,7 @@ class LoadLotsOfInstruments(stresstesting.MantidStressTest): if not self.__loadAndTest__(filename): print "FAILED TO LOAD '%s'" % filename failed.append(filename) + #pylint: disable=broad-except except Exception, e: print "FAILED TO LOAD '%s' WITH ERROR:" % filename print e diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadMuonNexusTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadMuonNexusTest.py index 39998642b3115a590c5d30cd2f8526c4c167b0d3..58d6da4fc707f3bdd6676960de74d5d616d338db 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadMuonNexusTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadMuonNexusTest.py @@ -9,7 +9,7 @@ class LoadMuonNexusTest(stresstesting.MantidStressTest): # Checked specifically because stores resulution (used to calculate FirstGoodData) # as NX_FLOAT32 opposed to NX_INT32 in other Muon files. loadResult = LoadMuonNexus(Filename = "EMU03087.nxs", - OutputWorkspace = "EMU03087") + OutputWorkspace = "EMU03087") firstGoodData = loadResult[3] self.assertDelta(firstGoodData, 0.416, 0.0001) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py index 4354f51c17bb3ce8ebeab545710f74466c014c90..d0fbaa674ef409534fa863367f3485c382d0a7c4 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadVesuvioTest.py @@ -248,21 +248,21 @@ class VesuvioTests(unittest.TestCase): def test_load_with_spectra_that_are_just_monitors_raises_error(self): self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188", - OutputWorkspace=self.ws_name, SpectrumList="1") + OutputWorkspace=self.ws_name, SpectrumList="1") self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188", OutputWorkspace=self.ws_name, SpectrumList="1-2") def test_load_with_invalid_difference_option_raises_error(self): self.assertRaises(ValueError, ms.LoadVesuvio, Filename="14188", - OutputWorkspace=self.ws_name, Mode="Unknown",SpectrumList="3-134") + OutputWorkspace=self.ws_name, Mode="Unknown",SpectrumList="3-134") def test_load_with_difference_option_not_applicable_to_current_spectra_raises_error(self): self.assertRaises(ValueError, ms.LoadVesuvio, Filename="14188", - OutputWorkspace=self.ws_name, Mode="",SpectrumList="3-134") + OutputWorkspace=self.ws_name, Mode="",SpectrumList="3-134") def test_raising_error_removes_temporary_raw_workspaces(self): self.assertRaises(RuntimeError, ms.LoadVesuvio, Filename="14188,14199", # Second run is invalid - OutputWorkspace=self.ws_name, Mode="SingleDifference",SpectrumList="3-134") + OutputWorkspace=self.ws_name, Mode="SingleDifference",SpectrumList="3-134") self._do_test_temp_raw_workspaces_not_left_around() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/MDWorkspaceTests.py b/Code/Mantid/Testing/SystemTests/tests/analysis/MDWorkspaceTests.py index fec25eaec9359c4212cab874a5230c723328418c..6a51a5aab0402438b4f3d8871905eb038489adc4 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/MDWorkspaceTests.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/MDWorkspaceTests.py @@ -30,15 +30,15 @@ class PlusMDTest(stresstesting.MantidStressTest): def runTest(self): # Some platforms can't clean up the open file handle on cncs.nxs from the last test, so run cleanup here as well barefilename = "cncs.nxs" - config = ConfigService.Instance() - self._saved_filename = os.path.join(config["defaultsave.directory"], barefilename) + configI = ConfigService.Instance() + self._saved_filename = os.path.join(configI["defaultsave.directory"], barefilename) self.cleanup() # Load then convert to Q in the lab frame LoadEventNexus(Filename=r'CNCS_7860_event.nxs',OutputWorkspace='cncs_nxs') ConvertToDiffractionMDWorkspace(InputWorkspace='cncs_nxs', OutputWorkspace='cncs_original', SplitInto=2) - alg = SaveMD(InputWorkspace='cncs_original', Filename=barefilename) + SaveMD(InputWorkspace='cncs_original', Filename=barefilename) self.assertDelta( mtd['cncs_original'].getNPoints(), 112266, 1) BinMD(InputWorkspace='cncs_original',AlignedDim0='Q_lab_x, -3, 3, 100',AlignedDim1='Q_lab_y, -3, 3, 100', @@ -143,16 +143,16 @@ class MergeMDTest(stresstesting.MantidStressTest): return filenames_string def runTest(self): - config = ConfigService.Instance() + configI = ConfigService.Instance() LoadEventNexus(Filename='CNCS_7860_event.nxs', - OutputWorkspace='CNCS_7860_event_NXS',CompressTolerance=0.1) + OutputWorkspace='CNCS_7860_event_NXS',CompressTolerance=0.1) for omega in xrange(0, 5): print "Starting omega %03d degrees" % omega CreateMDWorkspace(Dimensions='3',Extents='-5,5,-5,5,-5,5',Names='Q_sample_x,Q_sample_y,Q__sample_z', Units='A,A,A',SplitInto='3',SplitThreshold='200',MaxRecursionDepth='3', - MinRecursionDepth='3', OutputWorkspace='CNCS_7860_event_MD') + MinRecursionDepth='3', OutputWorkspace='CNCS_7860_event_MD') # Convert events to MD events AddSampleLog("CNCS_7860_event_NXS", "omega", "%s.0" % omega, "Number Series") @@ -165,12 +165,12 @@ class MergeMDTest(stresstesting.MantidStressTest): OutputDimensions='Q (sample frame)',LorentzCorrection='1', Append=True) barefilename = "CNCS_7860_event_rotated_%03d.nxs" % omega - filename = os.path.join(config["defaultsave.directory"], barefilename) - alg = SaveMD("CNCS_7860_event_MD", Filename=filename) + filename = os.path.join(configI["defaultsave.directory"], barefilename) + SaveMD("CNCS_7860_event_MD", Filename=filename) self._saved_filenames.append(filename) # End for loop - filename = os.path.join(config["defaultsave.directory"], r'merged.nxs') - alg = MergeMDFiles(Filenames=self.make_files_to_merge_string(), OutputFilename=filename, OutputWorkspace='merged') + filename = os.path.join(configI["defaultsave.directory"], r'merged.nxs') + MergeMDFiles(Filenames=self.make_files_to_merge_string(), OutputFilename=filename, OutputWorkspace='merged') self._saved_filenames.append(filename) # 5 times the number of events in the output workspace. diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/MuonLoadTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/MuonLoadTest.py index 7ea0ee850a68ff3215c56b191a1a66b862e2389c..721b8828f7bf3c6788e62223dda9dd77539b46e1 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/MuonLoadTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/MuonLoadTest.py @@ -21,22 +21,21 @@ class MuonLoadTest(stresstesting.MantidStressTest): mtd.addOrReplace("MuonLoad_DeadTimes", deadTimes) MuonLoad(Filename = "MUSR00015192", - DetectorGroupingTable = "MuonLoad_Grouping", - ApplyDeadTimeCorrection = True, - CustomDeadTimeTable = "MuonLoad_DeadTimes", - FirstPeriod = 1, - SecondPeriod = 0, - PeriodOperation = "-", - TimeZero = 0.6, - Xmin = 0.11, - Xmax = 10.0, - RebinParams = "0.032", - OutputType = "PairAsymmetry", - PairFirstIndex = 0, - PairSecondIndex = 1, - Alpha = 0.8, - OutputWorkspace = "MuonLoad_MUSR00015192" - ) + DetectorGroupingTable = "MuonLoad_Grouping", + ApplyDeadTimeCorrection = True, + CustomDeadTimeTable = "MuonLoad_DeadTimes", + FirstPeriod = 1, + SecondPeriod = 0, + PeriodOperation = "-", + TimeZero = 0.6, + Xmin = 0.11, + Xmax = 10.0, + RebinParams = "0.032", + OutputType = "PairAsymmetry", + PairFirstIndex = 0, + PairSecondIndex = 1, + Alpha = 0.8, + OutputWorkspace = "MuonLoad_MUSR00015192") def validate(self): return "MuonLoad_MUSR00015192", "MuonLoad_MUSR00015192.nxs" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py index aa233a68bb2a0ec3f385c411e94d2696d12d2758..7754f80043d2ea3623db183d99c29e81e5852fe6 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py @@ -1,10 +1,10 @@ #pylint: disable=no-init from LoadAndCheckBase import * -''' -Test File loading and basic data integrity checks of OFFSPEC data in Mantid. -''' class OFFSPECLoadingTest(LoadAndCheckBase): + ''' + Test File loading and basic data integrity checks of OFFSPEC data in Mantid. + ''' def get_raw_workspace_filename(self): return "OFFSPEC00010791.raw" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECReflRedOneAuto.py b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECReflRedOneAuto.py index e86dabf6354e37d567d82f96a3f9a82de75815be..091f0275ffd49a514e4f5788f2f253f612375ac6 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECReflRedOneAuto.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECReflRedOneAuto.py @@ -15,22 +15,20 @@ class OFFSPECReflRedOneAuto(stresstesting.MantidStressTest): offspec85 = Load("OFFSPEC00027585.raw") #transmission run #Process using ReflectometryReductionOneAuto - ivq_75, __, __ = ReflectometryReductionOneAuto( - offspec75, - ThetaIn=0.35, - FirstTransmissionRun=offspec85) + ivq_75, __, __ = ReflectometryReductionOneAuto(offspec75, + ThetaIn=0.35, + FirstTransmissionRun=offspec85) - ivq_76, __, __ = ReflectometryReductionOneAuto( - offspec76, - ThetaIn=1.00, - FirstTransmissionRun=offspec85) + ivq_76, __, __ = ReflectometryReductionOneAuto(offspec76, + ThetaIn=1.00, + FirstTransmissionRun=offspec85) - ivq_78, __, __ = ReflectometryReductionOneAuto( - offspec78, - ThetaIn=1.70, - FirstTransmissionRun=offspec85) + ivq_78, __, __ = ReflectometryReductionOneAuto(offspec78, + ThetaIn=1.70, + FirstTransmissionRun=offspec85) ivq_75_76, __ = Stitch1D(ivq_75, ivq_76, Params="1e-3") + #pylint: disable=unused-variable ivq_75_76_78, __ = Stitch1D(ivq_75_76, ivq_78, Params="0,1e-3,0.08") return True diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLPowderDiffraction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLPowderDiffraction.py index a4537f331cd3e7f357570d9fa4614bac7a8d85b1..abc2e1693accd11d623037ce33d0e4ce20121eff 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLPowderDiffraction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLPowderDiffraction.py @@ -19,7 +19,7 @@ class PEARLPowderDiffraction(stresstesting.MantidStressTest): LoadRaw(Filename=self.sample, OutputWorkspace='monitor73987',LoadLogFiles='0',SpectrumMax='1') ConvertUnits(InputWorkspace='monitor73987',OutputWorkspace='monitor73987',Target='Wavelength') CropWorkspace(InputWorkspace='monitor73987',OutputWorkspace='monitor73987', - XMin=0.03,XMax=6.0) + XMin=0.03,XMax=6.0) MaskBins(InputWorkspace='monitor73987',OutputWorkspace='monitor73987',XMin=3.45,XMax=3.7) MaskBins(InputWorkspace='monitor73987',OutputWorkspace='monitor73987',XMin=2.96,XMax=3.2) @@ -28,14 +28,14 @@ class PEARLPowderDiffraction(stresstesting.MantidStressTest): SplineBackground(InputWorkspace='monitor73987',OutputWorkspace='monitor73987',NCoeff=20) NormaliseToMonitor(InputWorkspace='work',OutputWorkspace='work',MonitorWorkspace='monitor73987', - IntegrationRangeMin=0.6,IntegrationRangeMax=5.0) + IntegrationRangeMin=0.6,IntegrationRangeMax=5.0) ConvertUnits(InputWorkspace='work',OutputWorkspace='work',Target='TOF') rb_params = [1500,-0.0006,19900] Rebin(InputWorkspace='work',OutputWorkspace='work',Params=rb_params) AlignDetectors(InputWorkspace='work',OutputWorkspace='work', CalibrationFile=self.calfile) DiffractionFocussing(InputWorkspace='work',OutputWorkspace='focus', - GroupingFileName=self.groupfile) + GroupingFileName=self.groupfile) ConvertUnits(InputWorkspace='focus',OutputWorkspace='focus',Target='TOF') Rebin(InputWorkspace='focus',OutputWorkspace='focus',Params=rb_params) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py index 95d182acac79f47f77356fc3a3ff22b1e3203986..a71e744d4b9aa756e9cdf36b700d4cd2936dd35a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py @@ -6,10 +6,12 @@ import os import numpy as n from abc import ABCMeta, abstractmethod +#pylint: disable=too-many-instance-attributes class PEARL_Reduction(stresstesting.MantidStressTest): '''Test adapted from actual script used by the scientists''' __metaclass__ = ABCMeta # Mark as an abstract class + validate=None def __init__(self): stresstesting.MantidStressTest.__init__(self) @@ -60,13 +62,12 @@ class PEARL_Reduction(stresstesting.MantidStressTest): def validateGSS(self): '''Validate the created gss file''' - from mantid.api import FileFinder return self.saved_gssfile,FileFinder.getFullPath(self.reference_gss) def PEARL_getlambdarange(self): return 0.03,6.00 - def PEARL_getmonitorspectrum(self, runno): + def PEARL_getmonitorspectrum(self, dummy_runno): return 1 def PEARL_getfilename(self, run_number,ext): @@ -75,7 +76,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): numdigits=8 filename="PEARL" - for i in range(0,numdigits-digit): + for dummy_i in range(0,numdigits-digit): filename=filename+"0" filename+=str(run_number)+"."+ext @@ -167,6 +168,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): mtd.remove(monitor) return + #pylint: disable=too-many-arguments,too-many-branches def PEARL_focus(self, number,ext="raw",fmode="trans",ttmode="TT70",atten=True,van_norm=True): self.tt_mode=ttmode @@ -357,6 +359,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): #================================================================================ class PEARL_Mode_trans(PEARL_Reduction): + validate=None def do_focus(self): #self.reference_nexus = "PRL75318_75323.nxs" return self.PEARL_focus("75318_75323","raw",fmode="trans",ttmode="TT70",atten=True) @@ -373,12 +376,14 @@ class PEARL_Mode_trans(PEARL_Reduction): return 'PRL75318_75323_noatten','PEARL75318_75323_noatten.nxs' #================================================================================ +#pylint: disable=too-few-public-methods class PEARL_Mode_all_Si(PEARL_Reduction): def do_focus(self): #self.reference_nexus = "PRL74798_74800.nxs" return self.PEARL_focus("74798_74800","raw",fmode="all",ttmode="TT70",atten=False) #================================================================================ +#pylint: disable=too-few-public-methods class PEARL_Mode_all_CeO2(PEARL_Reduction): def do_focus(self): #self.reference_nexus = "PRL74795_74797.nxs" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAutoCorrelationTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAutoCorrelationTest.py index c586c6714315f3e5d5e4f221219cac18273714a4..70b4c876caf9ce02689d064558cc55dec98b2b9e 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAutoCorrelationTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIAutoCorrelationTest.py @@ -32,8 +32,8 @@ class POLDIAutoCorrelationTest(stresstesting.MantidStressTest): calculatedData = mtd["%sCorr" % (dataFile)].dataY(0) self.assertEqual(calculatedData.shape[0], referenceData.shape[0], - "Number of d-values does not match for %s (is: %i, should: %i)" % ( - dataFile, calculatedData.shape[0], referenceData.shape[0])) + "Number of d-values does not match for %s (is: %i, should: %i)" % (dataFile,\ + calculatedData.shape[0], referenceData.shape[0])) CreateWorkspace(referenceData, calculatedData, OutputWorkspace=workspaceNameTemplate) @@ -47,18 +47,18 @@ class POLDIAutoCorrelationTest(stresstesting.MantidStressTest): self.assertDelta(slope, 1.0, 1e-4, "Slope is larger than 1.0 for %s (is: %d)" % (dataFile, slope)) relativeSlopeError = fitResult.cell(1, 2) / slope - self.assertLessThan(relativeSlopeError, 5e-4, "Relative error of slope is too large for %s (is: %d)" % ( - dataFile, relativeSlopeError)) + self.assertLessThan(relativeSlopeError, 5e-4, "Relative error of slope is too large " + "for %s (is: %d)" % (dataFile, relativeSlopeError)) intercept = fitResult.cell(0, 1) self.assertDelta(intercept, 0.0, 1.0, "Intercept deviates too far from 0 %s (is: %d)" % (dataFile, intercept)) relativeInterceptError = fitResult.cell(0, 2) / intercept - self.assertLessThan(relativeInterceptError, 1, "Relative error of intercept is too large for %s (is: %d)" % ( - dataFile, relativeInterceptError)) + self.assertLessThan(relativeInterceptError, 1, "Relative error of intercept is too large " + "for %s (is: %d)" % (dataFile, relativeInterceptError)) residuals = mtd[fitNameTemplate + "_Workspace"].dataY(2) maxAbsoluteResidual = np.max(np.abs(residuals)) - self.assertLessThan(maxAbsoluteResidual, 1.0, "Maximum absolute residual is too large for %s (is: %d)" % ( - dataFile, maxAbsoluteResidual)) + self.assertLessThan(maxAbsoluteResidual, 1.0, "Maximum absolute residual is too large " + "for %s (is: %d)" % (dataFile, maxAbsoluteResidual)) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDICreatePeaksFromCellTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDICreatePeaksFromCellTest.py index b74ba222a4a944f8bd9b158ed297a777ee456a8e..9bbea035571187aca4c2ff90d5da97b075083ad9 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDICreatePeaksFromCellTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDICreatePeaksFromCellTest.py @@ -1,4 +1,4 @@ -# pylint: disable=no-init,invalid-name,too-many-locals +# pylint: disable=no-init,invalid-name,too-many-locals,too-few-public-methods import stresstesting from mantid.simpleapi import * diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks1DTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks1DTest.py index c9fa0b4737bd054fabd87efd831cb13e26097d7f..96708b546bc07e43ab01e5c6285dcbe943d5af90 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks1DTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks1DTest.py @@ -29,8 +29,8 @@ class POLDIFitPeaks1DTest(stresstesting.MantidStressTest): def runPeakSearch(self, filenames, deleteList): for dataFile,deleteRowList in zip(filenames, deleteList): PoldiPeakSearch(InputWorkspace=dataFile, - MinimumPeakSeparation=8, - OutputWorkspace="%s_Peaks" % (dataFile)) + MinimumPeakSeparation=8, + OutputWorkspace="%s_Peaks" % (dataFile)) for deleteRows in deleteRowList: DeleteTableRows(TableWorkspace="%s_Peaks" % (dataFile), Rows=deleteRows) @@ -42,11 +42,11 @@ class POLDIFitPeaks1DTest(stresstesting.MantidStressTest): def runPoldiFitPeaks1D(self, filenames, versions): for dataFile, version in zip(filenames, versions): args = {"InputWorkspace": dataFile, - "FwhmMultiples": 4, - "PoldiPeakTable": "%s_Peaks" % (dataFile), - "OutputWorkspace": "%s_Peaks_Refined" % (dataFile), - "FitPlotsWorkspace": "%s_FitPlots" % (dataFile), - "Version": version} + "FwhmMultiples": 4, + "PoldiPeakTable": "%s_Peaks" % (dataFile), + "OutputWorkspace": "%s_Peaks_Refined" % (dataFile), + "FitPlotsWorkspace": "%s_FitPlots" % (dataFile), + "Version": version} if version == 2: args["AllowedOverlap"] = 0.1 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks2DTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks2DTest.py index a2fbd7fa4c8aee3f32d8bd13667b89b231b63873..cf70b750a64f91575b85ef1c8d01e0e44edcd90a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks2DTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDIFitPeaks2DTest.py @@ -132,12 +132,12 @@ class POLDIFitPeaks2DIntegratedIntensities(stresstesting.MantidStressTest): # Run the same analysis twice, once with integrated and once with maximum intensities # Since a Gaussian is used, the integration can be checked numerically. fit2d, fit1d, peaks_ref_2d = PoldiFitPeaks2D('si_data_6904', peaks_ref, - OutputIntegratedIntensities=False, - MaximumIterations=100) + OutputIntegratedIntensities=False, + MaximumIterations=100) fit2d, fit1d, peaks_ref_2d_integrated = PoldiFitPeaks2D('si_data_6904', peaks_ref, - OutputIntegratedIntensities=True, - MaximumIterations=100) + OutputIntegratedIntensities=True, + MaximumIterations=100) self.assertEquals(peaks_ref_2d.rowCount(), peaks_ref_2d_integrated.rowCount()) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDILoadRunsTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDILoadRunsTest.py index 8fd73d1cea6871bd89b10c6e480d563045cf9ba1..47cf3407857aaa20739430837a5bbbb3f18bd510 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/POLDILoadRunsTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/POLDILoadRunsTest.py @@ -135,8 +135,8 @@ class POLDILoadRunsTest(stresstesting.MantidStressTest): def checkRemoveBadDetectors(self): # Determine bad detectors automatically PoldiLoadRuns(2013, 6903, 6904, 2, MaskBadDetectors=True, - BadDetectorThreshold=2.5, - OutputWorkspace='twoWorkspacesMerged') + BadDetectorThreshold=2.5, + OutputWorkspace='twoWorkspacesMerged') wsMerged = AnalysisDataService.retrieve("twoWorkspacesMerged_data_6904") self.assertEquals(len([True for x in range(wsMerged.getNumberHistograms()) if wsMerged.getDetector( @@ -146,8 +146,8 @@ class POLDILoadRunsTest(stresstesting.MantidStressTest): # Lower threshold, more excluded detectors PoldiLoadRuns(2013, 6903, 6904, 2, MaskBadDetectors=True, - BadDetectorThreshold=2.0, - OutputWorkspace='twoWorkspacesMerged') + BadDetectorThreshold=2.0, + OutputWorkspace='twoWorkspacesMerged') wsMerged = AnalysisDataService.retrieve("twoWorkspacesMerged_data_6904") self.assertEquals(len([True for x in range(wsMerged.getNumberHistograms()) if wsMerged.getDetector( @@ -157,7 +157,7 @@ class POLDILoadRunsTest(stresstesting.MantidStressTest): # Only use those from the IDF PoldiLoadRuns(2013, 6903, 6904, 2, MaskBadDetectors=False, - OutputWorkspace='twoWorkspacesMerged') + OutputWorkspace='twoWorkspacesMerged') wsMerged = AnalysisDataService.retrieve("twoWorkspacesMerged_data_6904") self.assertEquals(len([True for x in range(wsMerged.getNumberHistograms()) if wsMerged.getDetector( diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py index d3bcc804d7cafcffaddc9ce5e12f0749e32cc27b..d9bc20ec5fbb023f5433c2b56c7d7d30dc6f7a11 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name,no-init +#pylint: disable=invalid-name,no-init,too-many-arguments,too-many-branches #This script creates numerous PeaksWorkspaces for different Crystal Types and Centerings. Random errors #are also introduced into the peak's. Each PeaksWorkspace is sent through the algorithm's FindPeaksMD, #FindUBUsingFFT, and SelectByForm to determine the corresponding Primitive and Conventional cells. These @@ -8,7 +8,7 @@ #!!!!!!!!! REPLACE THE "XXX" OR else !!!!!!!!!! -import stresstesting +#import stresstesting import numpy from numpy import matrix import math @@ -18,7 +18,7 @@ from mantid.simpleapi import * #from mantid.simpleapi import * #TODO premultiply cases, fix up.. Maybe not needed Cause Conv cell was "Nigglied" #TODO: SWitch cases, if use approx inequality, may get error cause low level code [does Not](does) premult but when it [should](should not) -class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): +class Peak2ConvCell_Test(object):#(stresstesting.MantidStressTest): conventionalUB=numpy.zeros(shape=(3,3)) Cubic=[1,3,5] Tetr=[6,7,11,15,18,21] @@ -34,16 +34,16 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): CentC=[10,13,14,17,20,23,25,27,28,29,30,36,37,38,39,40,41] - def CalcConventionalUB(self,a,b,c,alpha,beta,gamma,type): + def CalcConventionalUB(self,a,b,c,alpha,beta,gamma,celltype): Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]]) - if type=='O': + if celltype=='O': Res[0,0]=1./a Res[1,1]=1./b Res[2,2]=1./c - elif type=='H': + elif celltype=='H': Res[0,0]= a*1.0 Res[1,0]= -a/2. Res[1,1]= a*.866 @@ -160,21 +160,21 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): return RUB.I - def CalcNiggliUB( self,a, b,c,alpha, beta, gamma,type, Center): + def CalcNiggliUB( self,a, b,c,alpha, beta, gamma,celltype, Center): if Center=='P': - X = self.CalcConventionalUB( a,b,c,alpha,beta,gamma,type) + X = self.CalcConventionalUB( a,b,c,alpha,beta,gamma,celltype) return X Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]]) - ConvUB = self.CalcConventionalUB(a,b,c,alpha,beta,gamma,type) + ConvUB = self.CalcConventionalUB(a,b,c,alpha,beta,gamma,celltype) if ConvUB== None: return None ResP = numpy.matrix.copy(ConvUB) ResP =ResP.I - if type=='H' and Center =='I': + if celltype=='H' and Center =='I': Center ='R' if Center == 'I': @@ -198,7 +198,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='F': - if type =='H' or type=='M': + if celltype =='H' or celltype=='M': return None ss = [0,0,0] @@ -217,25 +217,25 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='A' or Center=='B'or Center=='C': - if type =='H' : + if celltype =='H' : return None - if type =='M' and Center== 'B': + if celltype =='M' and Center== 'B': return None r=2 if Center =='A' : r=0 - if b==c and type=='O':# result would be orthorhombic primitive + if b==c and celltype=='O':# result would be orthorhombic primitive return None elif Center =='B': r=1 - if a==c and type=='O': + if a==c and celltype=='O': return None - elif a==b and type=='O': + elif a==b and celltype=='O': return None k=0 @@ -262,7 +262,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='R': - if type != 'H' or alpha >120:#alpha =120 planar, >120 no go or c under a-b plane. + if celltype != 'H' or alpha >120:#alpha =120 planar, >120 no go or c under a-b plane. self.conventionalUB=NiggliUB = None return None @@ -803,7 +803,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): print ["Formnum,Lat1,Lat0",FormXtal[i1],Lat1,Lat0] if math.fabs(Lat0[0]-Lat1[0])<tolerance and math.fabs(Lat0[1]-Lat1[1])<tolerance and math.fabs(Lat0[2]-Lat1[2])<tolerance: - for i in range(3): + for dummy_i in range(3): if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance: break if Lat1[0]>Lat1[1]-tolerance: @@ -900,7 +900,8 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): InPks=IndexPeaks(Peaks,.10) - CopySample(Peaks,"Sws",CopyMaterial="0",CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1") + CopySample(Peaks,"Sws",CopyMaterial="0", + CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1") OrLat= mtd["Sws"].sample().getOrientedLattice() Lat1= [OrLat.a(),OrLat.b(),OrLat.c(),OrLat.alpha(),OrLat.beta(),OrLat.gamma()] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py index bd6148ee6421b4cd24dd4a1255794aa4479ec2aa..73ef84ab1d06cb57a9ead72d642eb701a9cda82d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/PowderDiffProfileCalibrateTest.py @@ -17,6 +17,7 @@ class VulcanExamineProfile(stresstesting.MantidStressTest): irf_file = 'arg_powder.irf' dat_file = 'arg_si.dat' bkgd_file = 'arg_si_bkgd_polynomial.nxs' + tolerance=1.0e-6 def requiredFiles(self): files = [self.irf_file, self.dat_file, self.bkgd_file] @@ -60,6 +61,7 @@ class VulcanSeqRefineProfileFromScratch(stresstesting.MantidStressTest): """ irf_file = 'VULCAN_SNS_1.irf' dat_file = 'VULCAN_22946_NOM.dat' + tolerance=1.0e-6 def requiredFiles(self): files = [self.irf_file, self.dat_file] @@ -184,6 +186,7 @@ class VulcanSeqRefineProfileLoadPlus(stresstesting.MantidStressTest): """ System test for sequential refinement """ seqfile = "VULCAN_Calibrate_Seq.nxs" + tolerance=1.0e-6 def requiredFiles(self): files = [self.seqfile] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/RawVNexus.py b/Code/Mantid/Testing/SystemTests/tests/analysis/RawVNexus.py index 12081a8b6be0809f5ec2a31ca2ebda3ae2b1790f..41790da97816f8ac78af1031e5b2fc333a994197 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/RawVNexus.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/RawVNexus.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init +#pylint: disable=no-init,unused-variable import stresstesting from mantid.simpleapi import * diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReduceOneSCD_Run.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReduceOneSCD_Run.py index ff3ba022855d540064741a7995ecb905195ca132..97f999904c3d360bb5dfe999615920ec1e51ad2c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReduceOneSCD_Run.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReduceOneSCD_Run.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name,no-init +#pylint: disable=invalid-name,no-init,too-many-locals # File: ReduceOneSCD_Run.py # # Version 2.0, modified to work with Mantid's new python interface. @@ -17,12 +17,16 @@ import time import stresstesting - +import os from mantid.api import * from mantid.simpleapi import * class ReduceOneSCD_Run( stresstesting.MantidStressTest): + __reduced_ws_name="" + saved=False + output_directory="" + run_conventional_matrix_file="" def requiredMemoryMB(self): """ Require about 12GB free """ @@ -80,15 +84,15 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): # # Name the files to write for this run # - run_niggli_matrix_file = self.output_directory + "/" + run + "_Niggli.mat" - run_niggli_integrate_file = self.output_directory + "/" + run + "_Niggli.integrate" +# run_niggli_matrix_file = self.output_directory + "/" + run + "_Niggli.mat" +# run_niggli_integrate_file = self.output_directory + "/" + run + "_Niggli.integrate" # # Load the run data and find the total monitor counts # - event_ws = LoadEventNexus( Filename=full_name, - FilterByTofMin=min_tof, FilterByTofMax=max_tof ) + event_ws = LoadEventNexus(Filename=full_name, + FilterByTofMin=min_tof, FilterByTofMax=max_tof ) if (calibration_file_1 is not None) or (calibration_file_2 is not None): LoadIsawDetCal(event_ws, Filename=calibration_file_1) @@ -141,10 +145,10 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): # if integrate_predicted_peaks: print "PREDICTING peaks to integrate...." - peaks_ws = PredictPeaks( InputWorkspace=peaks_ws, - WavelengthMin=min_pred_wl, WavelengthMax=max_pred_wl, - MinDSpacing=min_pred_dspacing, MaxDSpacing=max_pred_dspacing, - ReflectionCondition='Primitive' ) + peaks_ws = PredictPeaks(InputWorkspace=peaks_ws, + WavelengthMin=min_pred_wl, WavelengthMax=max_pred_wl, + MinDSpacing=min_pred_dspacing, MaxDSpacing=max_pred_dspacing, + ReflectionCondition='Primitive' ) else: print "Only integrating FOUND peaks ...." # @@ -167,14 +171,14 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): SplitInto='2', SplitThreshold='500', MaxRecursionDepth='5' ) peaks_ws = IntegratePeaksMD(InputWorkspace=MDEW, PeakRadius=peak_radius, - BackgroundOuterRadius=bkg_outer_radius, + BackgroundOuterRadius=bkg_outer_radius, BackgroundInnerRadius=bkg_inner_radius, - PeaksWorkspace=peaks_ws, + PeaksWorkspace=peaks_ws, IntegrateIfOnEdge=integrate_if_edge_peak ) elif use_fit_peaks_integration: event_ws = Rebin(InputWorkspace=event_ws, - Params=rebin_params, PreserveEvents=preserve_events ) + Params=rebin_params, PreserveEvents=preserve_events ) peaks_ws = PeakIntegration( InPeaksWorkspace=peaks_ws, InputWorkspace=event_ws, IkedaCarpenterTOF=use_ikeda_carpenter, MatchingRunNo=True, @@ -194,11 +198,11 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): if (not cell_type is None) and (not centering is None) : self.run_conventional_matrix_file = self.output_directory + "/" + run + "_" + \ cell_type + "_" + centering + ".mat" - run_conventional_integrate_file = self.output_directory + "/" + run + "_" + \ - cell_type + "_" + centering + ".integrate" + # run_conventional_integrate_file = self.output_directory + "/" + run + "_" + \ + # cell_type + "_" + centering + ".integrate" SelectCellOfType( PeaksWorkspace=peaks_ws, - CellType=cell_type, Centering=centering, - Apply=True, Tolerance=tolerance ) + CellType=cell_type, Centering=centering, + Apply=True, Tolerance=tolerance ) # UNCOMMENT the line below to get new output values if an algorithm changes #SaveIsawPeaks( InputWorkspace=peaks_ws, AppendFile=False, Filename=run_conventional_integrate_file ) SaveIsawUB( InputWorkspace=peaks_ws, Filename=self.run_conventional_matrix_file ) @@ -218,9 +222,9 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): CreateSingleValuedWorkspace(OutputWorkspace="XX2",DataValue="3") LoadIsawUB(InputWorkspace="XX2",Filename="3132_Orthorhombic_P.mat") - s2 = mtd["XX2"].sample() + #s2 = mtd["XX2"].sample() ol = s1.getOrientedLattice() - o2 = s2.getOrientedLattice() + #o2 = s2.getOrientedLattice() self.assertDelta( ol.a(), ol.a(), 0.01, "Correct lattice a value not found.") self.assertDelta( ol.b(), ol.b(), 0.01, "Correct lattice b value not found.") self.assertDelta( ol.c(), ol.c(), 0.01, "Correct lattice c value not found.") @@ -235,7 +239,6 @@ class ReduceOneSCD_Run( stresstesting.MantidStressTest): def cleanup(self): if self.saved: - import os os.remove( self.run_conventional_matrix_file) def validateMethod(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py index 1af0a4ae036ccac77c8498b7bf314ad1cec9713f..f79fe5700ecc404fb9328d015da97d78ff753535 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py @@ -22,7 +22,7 @@ class ReflectometryQuickCombineMulti(stresstesting.MantidStressTest): for transmissionNumber in transmissionNumbers: LoadISISNexus(Filename=str(transmissionNumber), OutputWorkspace=str(transmissionNumber)) - transmissionRuns = ",".join(map(str, transmissionNumbers)) + transmissionRuns = ",".join([str(tn) for tn in transmissionNumbers]) # Run quick quick.quick(str(runNumber), trans=transmissionRuns, theta=incidentAngle) finally: diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickPointDetectorMakeTransmission.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickPointDetectorMakeTransmission.py index d32736ea18b346433ca9312a4be21767be380d2b..c6910ec9e46e575eefe3a1c07b25c675950c3529 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickPointDetectorMakeTransmission.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickPointDetectorMakeTransmission.py @@ -23,7 +23,7 @@ class ReflectometryQuickPointDetectorMakeTransmission(stresstesting.MantidStress runNo = '13460' incidentAngle = 0.7 transmissionWs=quick.make_trans_corr(transmissionRuns, stitch_start_overlap=10, - stitch_end_overlap=12, stitch_params=[1.5,0.02,17]) + stitch_end_overlap=12, stitch_params=[1.5,0.02,17]) quick.quick(runNo, trans=transmissionWs, theta=incidentAngle) finally: config[defaultInstKey] = defaultInstrument diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py index b259692221b7d35b3fc2f9635ad19be754089d4d..3f89437a7150a58fa528fbd41f502b29e4ff055d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py @@ -6,25 +6,26 @@ import stresstesting class ReuseExistingCalibration(stresstesting.MantidStressTest): + det_pos_first_run = None + det_pos_second_run = None def requiredFiles(self): return ["HRP39180.RAW", "HRP38094Calib.nxs"] def runTest(self): - from mantid.simpleapi import Load, CopyInstrumentParameters, MoveInstrumentComponent - + import mantid.simpleapi as ms def do_reduction(calibration): # load data - data = Load("HRP39180.RAW") + data = ms.Load("HRP39180.RAW") # copy parameters from calibration to data - CopyInstrumentParameters(calibration, data) + ms.CopyInstrumentParameters(calibration, data) # Now move component on data workspace using a relative move, where that component was a detector in the calibrated workspace - MoveInstrumentComponent(data, DetectorID=1100,X=0.0,Y=0.0,Z=5.0,RelativePosition=True) + ms.MoveInstrumentComponent(data, DetectorID=1100,X=0.0,Y=0.0,Z=5.0,RelativePosition=True) return data.getDetector(0).getPos() #### # load calibration - calibration = Load("HRP38094Calib") + calibration = ms.Load("HRP38094Calib") self.det_pos_first_run = do_reduction(calibration) # again not reloading of calibration self.det_pos_second_run = do_reduction(calibration) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DLOQReloadWorkspaces.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DLOQReloadWorkspaces.py index 89f698b9972b420136222ec557aae690585452d8..040039f721db1537e4b2918e4763d920e407f51d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DLOQReloadWorkspaces.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DLOQReloadWorkspaces.py @@ -4,7 +4,6 @@ from mantid.simpleapi import * from ISISCommandInterface import * import unittest -## export PYTHONPATH=/apps/workspace/mantid_debug/bin/:/apps/mantid/systemtests/StressTestFramework/:/apps/mantid/mantid/Code/Mantid/scripts/SANS/:/apps/mantid/mantid/Code/Mantid/scripts/reduction """ diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DMultiPeriod.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DMultiPeriod.py index 9be38098fc830d44baad26e0e9a078f9044d3e9d..82205ed962add9119ecc29d4505c3e8fce09b115 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DMultiPeriod.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DMultiPeriod.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init +#pylint: disable=no-init,too-few-public-methods import stresstesting from mantid.simpleapi import * @@ -9,6 +9,8 @@ from SANSBatchMode import * # test batch mode with sans2d and selecting a period in batch mode class SANS2DMultiPeriodSingle(stresstesting.MantidStressTest): + reduced='' + def runTest(self): SANS2D() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py index f1003e6c927cad44d851427e19e8fd324f77ddec..a9635171ff1ffd3b12cf043e643aa1f96f01cc0a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py @@ -248,7 +248,7 @@ class SANS2DGUIReduction(SANS2DGUIBatchReduction): def checkFittingSettings(self): settings = {'scale':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.scale, - 'shift':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.shift} + 'shift':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.shift} super(SANS2DGUIReduction,self).checkFittingSettings(settings) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py index bf9c55906db4d5614cd009a535e90c07a8f81c31..feaacd185befad16aa9ab9fc002fef0bae9fa521 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py @@ -12,6 +12,8 @@ from mantid.simpleapi import * from numpy import * class DirectInelaticSNSTest(stresstesting.MantidStressTest): + _nxspe_filename="" + customDataDir="" #setup routines def topbottom(self): @@ -100,12 +102,12 @@ class DirectInelaticSNSTest(stresstesting.MantidStressTest): newruns=[] try: len(runs) - except: + except TypeError: runs=[runs] for r in runs: try: len(r) - except: + except TypeError: r=[r] temppath=[] tempnewruns=[] @@ -152,6 +154,7 @@ class DirectInelaticSNSTest(stresstesting.MantidStressTest): if os.path.exists(self.customDataDir): shutil.rmtree(self.customDataDir) + #pylint: disable=too-many-locals,too-many-branches def runTest(self): self.setupFiles() runs=[[12384,12385]] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SNSConvertToMDTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SNSConvertToMDTest.py index 34ffa09f049369bea5aea8f378fa48b389872824..4843ba44cc37039c0f32d8e5b6125c3cefbc65af 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SNSConvertToMDTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SNSConvertToMDTest.py @@ -81,7 +81,6 @@ def validateMD(result,reference,tol=1.e-5,class_name='dummy',mismatchName=None): #elf.disableChecking.append('Instrument') valNames = [result,reference] - from mantid.simpleapi import Load if not reference in mtd: Load(Filename=reference,OutputWorkspace=valNames[1]) @@ -112,6 +111,9 @@ def validateMD(result,reference,tol=1.e-5,class_name='dummy',mismatchName=None): class SNSConvertToMDNoHistNoProjTest(stresstesting.MantidStressTest): truth_file = "SEQ_11499_md_enp.nxs" + output_ws=None + tolerance=0.0 + gold_ws_name ='' def requiredMemoryMB(self): """ Require about 2.5GB free """ @@ -134,6 +136,9 @@ class SNSConvertToMDNoHistNoProjTest(stresstesting.MantidStressTest): class SNSConvertToMDHistNoProjTest(stresstesting.MantidStressTest): truth_file = "SEQ_11499_md_hnp.nxs" + output_ws=None + tolerance=0.0 + gold_ws_name ='' def requiredMemoryMB(self): """ Require about 2.5GB free """ @@ -156,6 +161,9 @@ class SNSConvertToMDHistNoProjTest(stresstesting.MantidStressTest): class SNSConvertToMDNoHistProjTest(stresstesting.MantidStressTest): truth_file = "SEQ_11499_md_ewp.nxs" + output_ws=None + tolerance=0.0 + gold_ws_name ='' def requiredMemoryMB(self): """ Require about 2.5GB free """ @@ -179,6 +187,9 @@ class SNSConvertToMDNoHistProjTest(stresstesting.MantidStressTest): class SNSConvertToMDHistProjTest(stresstesting.MantidStressTest): truth_file = "SEQ_11499_md_hwp.nxs" + output_ws=None + tolerance=0.0 + gold_ws_name ='' def requiredMemoryMB(self): """ Require about 2.5GB free """ diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SXDAnalysis.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SXDAnalysis.py index c859e0b3748a8dfce1eeac60c72470cedd343e6e..affb6c1416bf60fa64fa40a49166b7153cf85b21 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SXDAnalysis.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SXDAnalysis.py @@ -22,7 +22,7 @@ class SXDAnalysis(stresstesting.MantidStressTest): # NaCl has a relatively small unit cell, so the distance between peaks is relatively large. Setting the PeakDistanceThreshold # higher avoids finding high count regions on the sides of strong peaks as separate peaks. - peaks_qLab = FindPeaksMD(InputWorkspace='QLab', MaxPeaks=300, DensityThresholdFactor=10, PeakDistanceThreshold=1.0) + peaks_qLab = FindPeaksMD(InputWorkspace=QLab, MaxPeaks=300, DensityThresholdFactor=10, PeakDistanceThreshold=1.0) FindUBUsingFFT(PeaksWorkspace=peaks_qLab, MinD='3', MaxD='5',Tolerance=0.08) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SpaceGroupFactoryTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SpaceGroupFactoryTest.py index 6aac43d5a79a5981661fc0539cf7ca88a0fa626b..997de79533fa67b76e7be09a13094132e02e6331 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SpaceGroupFactoryTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SpaceGroupFactoryTest.py @@ -25,7 +25,7 @@ class SpaceGroupFactoryTest(stresstesting.MantidStressTest): self.assertTrue(group.isGroup(), ("Space group " + str(group.getNumber()) + " (" + symbol + ") does not " - "fulfill group axioms")) + "fulfill group axioms")) groupOperations = set(group.getSymmetryOperationStrings()) referenceOperations = self.spaceGroupData[group.getNumber()] @@ -51,10 +51,9 @@ class SpaceGroupFactoryTest(stresstesting.MantidStressTest): self.assertFalse( set(onlyMatrices.getSymmetryOperationStrings()).isdisjoint(pointGroup.getSymmetryOperationStrings()), ("Point group of space group " + spaceGroup.getHMSymbol() + " does not match group obtained from" - " matrices of symmetry operations.")) + " matrices of symmetry operations.")) def loadReferenceData(self): - from mantid.api import FileFinder # Reference data, generated using sginfo (http://cci.lbl.gov/sginfo/) # Dictionary has a string set for each space group number. separatorMatcher = re.compile(r"(\d+)") diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SurfLoadingTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SurfLoadingTest.py index f39d1f222932cbbefbeb2ea8d080e2a949a1ebc6..aa7b36d1c6b155b90bc760c77e06f995a9850cd7 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SurfLoadingTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SurfLoadingTest.py @@ -1,10 +1,11 @@ #pylint: disable=no-init from LoadAndCheckBase import * -''' -Test File loading and basic data integrity checks of SURF data in Mantid. -''' class SurfLoadingTest(LoadAndCheckBase): + ''' + Test File loading and basic data integrity checks of SURF data in Mantid. + ''' + def get_raw_workspace_filename(self): return "SRF92132.raw" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/TOPAZPeakFinding.py b/Code/Mantid/Testing/SystemTests/tests/analysis/TOPAZPeakFinding.py index 5d95b6e0045ddaf46e53d69f7b69c816b1d9afb3..a643f55dbe1fd02728e8767011b6cbc47925a10e 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/TOPAZPeakFinding.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/TOPAZPeakFinding.py @@ -49,9 +49,9 @@ class TOPAZPeakFinding(stresstesting.MantidStressTest): # Bin to a line (H=0 to 6, L=3, K=3) BinMD(InputWorkspace='topaz_3132_HKL',AxisAligned='0', - BasisVector0='X,units,1,0,0',BasisVector1='Y,units,6.12323e-17,1,0',BasisVector2='2,units,-0,0,1', - Translation='-0,3,6',OutputExtents='0,6, -0.1,0.1, -0.1,0.1',OutputBins='60,1,1', - OutputWorkspace='topaz_3132_HKL_line') + BasisVector0='X,units,1,0,0',BasisVector1='Y,units,6.12323e-17,1,0',BasisVector2='2,units,-0,0,1', + Translation='-0,3,6',OutputExtents='0,6, -0.1,0.1, -0.1,0.1',OutputBins='60,1,1', + OutputWorkspace='topaz_3132_HKL_line') # Now check the integrated bin and the peaks w = mtd["topaz_3132_HKL_line"] @@ -93,8 +93,8 @@ class TOPAZPeakFinding(stresstesting.MantidStressTest): for c in xrange(3): # This compares each column, allowing old == new OR old == -new if not numpy.all(diff[:,c]) : - raise Exception("More than 0.001 difference between UB matrices: Q (lab frame):\n%s\nQ (sample frame):\n%s" % ( - originalUB, newUB) ) + raise Exception("More than 0.001 difference between UB matrices: Q (lab frame):\n" + "%s\nQ (sample frame):\n%s" % (originalUB, newUB) ) def doValidation(self): # If we reach here, no validation failed diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py index 650b656da435fa6ce017d01e99aeb97e0c00076d..d015337c8d8d4c562c7a18c48cf71ad319370f6c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py @@ -8,6 +8,8 @@ EXPECTED_EXT = '.expected' class ValidateGroupingFiles(stresstesting.MantidStressTest): + xsdFile ='' + def skipTests(self): try: import genxmlif @@ -45,9 +47,9 @@ class ValidateGroupingFiles(stresstesting.MantidStressTest): print "----------------------------------------" print "Validating '%s'" % filename pyxsval.parseAndValidateXmlInput(filename, xsdFile=self.xsdFile, validateSchema=0) - except Exception, e: + except Exception, err: print "VALIDATION OF '%s' FAILED WITH ERROR:" % filename - print e + print err failed.append(filename) # final say on whether or not it 'worked' diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py b/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py index a6716e54bba943baa4e9c328cbb144322c20b8dc..b676087dde5602f99261f24efbf3d3f2bfcf99f7 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py @@ -20,7 +20,7 @@ class WishMasking(stresstesting.MantidStressTest): try: index = int(line_contents[0].strip()) select = int(line_contents[3].strip()) - group = int(line_contents[4].strip()) + dummy_group = int(line_contents[4].strip()) if index == requested_index: return select except ValueError: @@ -30,22 +30,23 @@ class WishMasking(stresstesting.MantidStressTest): # 1) Uses the masks to create a cal file # 2) Read the cal file # 3) Use the known masking boundaries to determine whether the cal file has been created propertly accoring to the function inputs. + #pylint: disable=too-many-arguments def do_test_cal_file(self, masked_workspace, should_invert, expected_masking_identifier, expected_not_masking_identifier, masking_edge): cal_filename = 'wish_masking_system_test_temp.cal' cal_file_full_path = os.path.join(config['defaultsave.directory'],cal_filename) MaskWorkspaceToCalFile(InputWorkspace=masked_workspace, OutputFile=cal_file_full_path, Invert=should_invert) - file = open(cal_file_full_path, 'r') + cfile = open(cal_file_full_path, 'r') try: - mask_boundary_inside = self.get_masking_for_index(file, masking_edge) - mask_boundary_outside = self.get_masking_for_index(file, masking_edge+1) + mask_boundary_inside = self.get_masking_for_index(cfile, masking_edge) + mask_boundary_outside = self.get_masking_for_index(cfile, masking_edge+1) self.assertTrue(mask_boundary_inside == expected_masking_identifier) self.assertTrue(mask_boundary_outside == expected_not_masking_identifier) except LookupError: print "Could not find the requested index" self.assertTrue(False) finally: - file.close() + cfile.close() os.remove(cal_file_full_path) def requiredMemoryMB(self): @@ -124,7 +125,7 @@ class WishMasking(stresstesting.MantidStressTest): MaskWorkspaceToCalFile(InputWorkspace=ws, OutputFile=update_cal_file_name, Invert=True) MergeCalFiles(UpdateFile=update_cal_file_path, MasterFile=master_cal_file_path, - OutputFile=merged_cal_file_name, MergeSelections=True) + OutputFile=merged_cal_file_name, MergeSelections=True) update_cal_file = open(update_cal_file_path, 'r') merged_cal_file = open(merged_cal_file_path, 'r') diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSDarkCurrent.nxs.md5 b/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSDarkCurrent.nxs.md5 index 3c011198238499e2cc90e97cfd6a1d5c84aecfa9..f7a249a83364e8e0c4e8ad08433d8f113aaf6c69 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSDarkCurrent.nxs.md5 +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSDarkCurrent.nxs.md5 @@ -1 +1 @@ -36bbbbe32a96cd111c9e238f5b6eebbb \ No newline at end of file +ef7b5feb1786d5a512fb50892ad86d91 diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSTransmissionDC.nxs.md5 b/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSTransmissionDC.nxs.md5 index 39eaa579f9684831c9fdb03f6eb723d90f684a08..9afa5a54275d068dbc4f8c5ce530e0598d33caa2 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSTransmissionDC.nxs.md5 +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/reference/EQSANSTransmissionDC.nxs.md5 @@ -1 +1 @@ -866983c8aea0108fefbd5ef5ebc4938d \ No newline at end of file +f07955307239b5afc0632f464d493cfa diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py b/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py index ea4ce19e8e59e3bbe9440c28120a73e2c104469d..796822594355cbf3434714085336c12fa602a022 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py @@ -173,19 +173,17 @@ def expecting(): print "---", a,b,c,d a, b = c, d = f() print "---", a,b,c,d - ''' - #}}} - """ Developers Notes: + Developers Notes: Now works with an multiple assigments correctly. This is verified by test() and test1() below - """ + ''' f = inspect.currentframe().f_back.f_back i = f.f_lasti # index of the last attempted instruction in byte code ins=decompile(f.f_code) #pretty_print(ins) - for (offset, op, name, argument, argtype, argvalue) in ins: + for (offset, dummy_op, name, argument, dummy_argtype, dummy_argvalue) in ins: if offset > i: if name == 'POP_TOP': return 0 @@ -194,6 +192,7 @@ def expecting(): if name == 'CALL_FUNCTION': return 1 +#pylint: disable=too-many-locals,too-many-branches def lhs(output='names'): ''' call signature(s):: @@ -215,17 +214,23 @@ def lhs(output='names'): follow the form below. ''' - """ Developers Notes: - """ + f = inspect.currentframe().f_back.f_back i = f.f_lasti # index of the last attempted instruction in byte code ins=decompile(f.f_code) #pretty_print(ins) CallFunctionLocation={} - first=False; StartIndex=0; StartOffset=0 + first=False + StartIndex=0 + StartOffset=0 # we must list all of the operators that behave like a function call in byte-code - OperatorNames=set(['CALL_FUNCTION','UNARY_POSITIVE','UNARY_NEGATIVE','UNARY_NOT','UNARY_CONVERT','UNARY_INVERT','GET_ITER', 'BINARY_POWER','BINARY_MULTIPLY','BINARY_DIVIDE', 'BINARY_FLOOR_DIVIDE', 'BINARY_TRUE_DIVIDE', 'BINARY_MODULO','BINARY_ADD','BINARY_SUBTRACT','BINARY_SUBSCR','BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR','BINARY_OR']) + OperatorNames=set(['CALL_FUNCTION','UNARY_POSITIVE','UNARY_NEGATIVE', + 'UNARY_NOT','UNARY_CONVERT','UNARY_INVERT','GET_ITER', + 'BINARY_POWER','BINARY_MULTIPLY','BINARY_DIVIDE', + 'BINARY_FLOOR_DIVIDE', 'BINARY_TRUE_DIVIDE', 'BINARY_MODULO', + 'BINARY_ADD','BINARY_SUBTRACT','BINARY_SUBSCR', + 'BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR','BINARY_OR']) for index in range(len(ins)): (offset, op, name, argument, argtype, argvalue) = ins[index] @@ -261,7 +266,8 @@ def lhs(output='names'): # a,b=c=d=f() => [ ['a','b'] , 'c','d' ] So on and so forth. # put this in a loop and stack the results in an array. - count = 0; maxReturns = 0 # Must count the maxReturns ourselves in this case + count = 0 + maxReturns = 0 # Must count the maxReturns ourselves in this case while count < len(ins[CallFunctionLocation[i][0] :CallFunctionLocation[i][1]]): (offset_, op_, name_, argument_, argtype_, argvalue_) = ins[CallFunctionLocation[i][0]+count] #print 'i= ',i,'count = ', count, 'maxReturns = ',maxReturns diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx index 18e57fefaee4b04fee465e37d79fa0c60b158d17..8568ccf5a9ef022da5d829e0c02fc8617c8894e9 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.cxx @@ -11,6 +11,10 @@ #include <vtkUnstructuredGridAlgorithm.h> #include <vtkUnstructuredGrid.h> +#include <vtkSmartPointer.h> +#include <vtkPolyData.h> +#include <vtkAppendFilter.h> + vtkStandardNewMacro(vtkScaleWorkspace) using namespace Mantid::VATES; @@ -37,7 +41,19 @@ vtkScaleWorkspace::~vtkScaleWorkspace() int vtkScaleWorkspace::RequestData(vtkInformation*, vtkInformationVector **inputVector, vtkInformationVector *outputVector) { vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); - vtkUnstructuredGrid *inputDataSet = vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + + // Try to cast to vktUnstructuredGrid, if this fails then cast it to vtkPolyData + vtkUnstructuredGrid* inputDataSet = vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + + // This follows the example given here: + // http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToUnstructuredGrid + auto appendFilter = vtkSmartPointer<vtkAppendFilter>::New(); + if (!inputDataSet) { + auto polyDataSet = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + appendFilter->AddInputData(polyDataSet); + appendFilter->Update(); + inputDataSet = appendFilter->GetOutput(); + } vtkInformation *outInfo = outputVector->GetInformationObject(0); vtkUnstructuredGrid *outputDataSet = vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); @@ -56,7 +72,16 @@ int vtkScaleWorkspace::RequestInformation(vtkInformation*, vtkInformationVector* { // Set the meta data vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); - vtkUnstructuredGrid *inputDataSet = vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkSmartPointer<vtkUnstructuredGrid> inputDataSet = vtkSmartPointer<vtkUnstructuredGrid>(vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()))); + // This follows the example given here: + // http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToUnstructuredGrid + auto appendFilter = vtkSmartPointer<vtkAppendFilter>::New(); + if (!inputDataSet) { + auto polyDataSet = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); + appendFilter->AddInputData(polyDataSet); + appendFilter->Update(); + inputDataSet = appendFilter->GetOutput(); + } updateMetaData(inputDataSet); return 1; } @@ -156,4 +181,25 @@ void vtkScaleWorkspace::updateMetaData(vtkUnstructuredGrid *inputDataSet) { m_maxValue = m_metadataJsonManager->getMaxValue(); m_instrument = m_metadataJsonManager->getInstrument(); m_specialCoordinates = m_metadataJsonManager->getSpecialCoordinates(); -} \ No newline at end of file +} + +/** + * Set the input types that we expect for this algorithm. These are naturally + * vtkUnstructredGrid data sets. In order to accomodate for the cut filter's + * output we need to allow also for vtkPolyData data sets. + * @param port: the input port + * @param info: the information object + * @retuns either success flag (1) or a failure flag (0) + */ +int vtkScaleWorkspace::FillInputPortInformation (int port, vtkInformation *info) { + // We only have port 0 as an input + if (port == 0) + { + info->Remove(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE()); + info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),"vtkUnstructuredGrid"); + info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),"vtkPolyData"); + return 1; + } + return 0; +} + diff --git a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.h b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.h index 55fb8eb7241d4b490e073513603d9577ea6f6573..f47ce5ef03bf1a65150fe27023876342714898ba 100644 --- a/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.h +++ b/Code/Mantid/Vates/ParaviewPlugins/ParaViewFilters/ScaleWorkspace/vtkScaleWorkspace.h @@ -24,6 +24,7 @@ protected: ~vtkScaleWorkspace(); int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + int FillInputPortInformation (int port, vtkInformation *info); private: vtkScaleWorkspace(const vtkScaleWorkspace&); diff --git a/Code/Mantid/docs/source/algorithms/EQSANSDarkCurrentSubtraction-v2.rst b/Code/Mantid/docs/source/algorithms/EQSANSDarkCurrentSubtraction-v2.rst new file mode 100644 index 0000000000000000000000000000000000000000..2be799e69f6850b7ef2060e84b3dc5c6b4664a24 --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/EQSANSDarkCurrentSubtraction-v2.rst @@ -0,0 +1,33 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +Subtract the dark current from an EQSANS data set. +This algorithm is rarely called directly. It is called by +:ref:`SANSReduction <algm-SANSReduction>`. + +This workflow algorithm will: + +- Properly load the dark current data set + +- Normalize the dark current to the data taking period + +- Subtract the dark current from the input workspace + + +The dark current is subtracted pixel by pixel by normalizing the dark current data by counting time. The total number of dark current counts :math:`N_{dc}(i)` for each pixel i is obtained by integrating over all time of flight bins. For a given pixel and wavelength bin, the corrected signal is given by: + +:math:`I'(i,\lambda_j)=I_{data}(i,\lambda_j)-N_{dc}(i) \ \ \frac{T_{data}}{T_{dc}} \ \ \frac{t_{frame}-t^{low}_{cut} - t^{high}_{cut}}{t_{frame}} \ \ \frac{\Delta\lambda_j}{\lambda_{max}-\lambda_{min}}` + +where the T-values are the counting times for the data set and the dark current (dc). The :math:`t_{cut}` values are the TOF cuts at the beginning and end of a frame. :math:`t_{frame}` is the width of a frame. :math:`\Delta\lambda_j` is the width of the wavelength bin we are considering. + +.. categories:: + +.. sourcelink:: diff --git a/Code/Mantid/docs/source/algorithms/GenerateEventsFilter-v1.rst b/Code/Mantid/docs/source/algorithms/GenerateEventsFilter-v1.rst index 4b56145661e6b2364206b0225c29b97448fde5d9..f3e2969088dadd23f854d962bcbdde6e36c4a936 100644 --- a/Code/Mantid/docs/source/algorithms/GenerateEventsFilter-v1.rst +++ b/Code/Mantid/docs/source/algorithms/GenerateEventsFilter-v1.rst @@ -56,6 +56,8 @@ event splitters that are supported by this algorithm. :ref:`MatrixWorkspace <MatrixWorkspace>` is way faster than a `TableWorkspace <http://www.mantidproject.org/TableWorkspace>`_ in Mantid. +.. _functionalities-GenerateEventFilter-ref: + Functionalities ############### @@ -87,6 +89,8 @@ this algorithm: equal or within the tolerance of the log value as v\_0 + n x delta\_v +/- tolerance\_v. +.. _filterbytime-GenerateEventFilter-ref: + Generate event filters by time ############################## @@ -113,6 +117,7 @@ Unit of time There are three types of units that are supported for time. They are second, nanosecond and percentage of duration from *StartTime* to *StopTime*. +.. _filterbylogv-GenerateEventFilter-ref: Generate event filters by sample log value ########################################## diff --git a/Code/Mantid/docs/source/algorithms/ReflectometryReductionOne-v1.rst b/Code/Mantid/docs/source/algorithms/ReflectometryReductionOne-v1.rst index 9567fdead8c4f8512abb137f629215a1994ae016..a36e9dca76fb3fe7926cc2c3cd5f02bb636b500d 100644 --- a/Code/Mantid/docs/source/algorithms/ReflectometryReductionOne-v1.rst +++ b/Code/Mantid/docs/source/algorithms/ReflectometryReductionOne-v1.rst @@ -66,6 +66,14 @@ If the :literal:`CorrectionAlgorithm` property is set to algorithm is used, with C0 and C1 taken from the :literal:`C0` and :literal:`C1` properties. +Detector Position Correction +############################ + +Detector Position Correction is used for when the position of the detector +is not aligned with the reflected beamline. The correction algorithm used is +:ref:`algm-SpecularReflectionPositionCorrect-v1` which is a purely vertical +position correction. + Workflow ######## @@ -80,9 +88,9 @@ Usage run = Load(Filename='INTER00013460.nxs') # Basic reduction with no transmission run - IvsQ, IvsLam, thetaOut = ReflectometryReductionOne(InputWorkspace=run, ThetaIn=0.7, I0MonitorIndex=2, ProcessingInstructions='3:4', - WavelengthMin=1.0, WavelengthMax=17.0, - MonitorBackgroundWavelengthMin=15.0, MonitorBackgroundWavelengthMax=17.0, + IvsQ, IvsLam, thetaOut = ReflectometryReductionOne(InputWorkspace=run, ThetaIn=0.7, I0MonitorIndex=2, ProcessingInstructions='3:4', + WavelengthMin=1.0, WavelengthMax=17.0, + MonitorBackgroundWavelengthMin=15.0, MonitorBackgroundWavelengthMax=17.0, MonitorIntegrationWavelengthMin=4.0, MonitorIntegrationWavelengthMax=10.0 ) print "The first four IvsLam Y values are: [ %.4e, %.4e, %.4e, %.4e ]" % (IvsLam.readY(0)[0], IvsLam.readY(0)[1], IvsLam.readY(0)[2], IvsLam.readY(0)[3]) diff --git a/Code/Mantid/docs/source/concepts/PropertiesFile.rst b/Code/Mantid/docs/source/concepts/PropertiesFile.rst index 59990e7afae65e21147b9303ce32575b7c62db42..7a3d332535971cf791d651cc4efa9de41f5440ec 100644 --- a/Code/Mantid/docs/source/concepts/PropertiesFile.rst +++ b/Code/Mantid/docs/source/concepts/PropertiesFile.rst @@ -126,6 +126,7 @@ to alter and those properties are detailed below. +-------------------------------------------+---------------------------------------------------+-----------------------+ |logging.channels.fileChannel.path | The Path to the log file. |../logs/mantid.log | +-------------------------------------------+---------------------------------------------------+-----------------------+ + The logging priority levels for the file logging and console logging can also be adjusted in python using the commands: .. testcode:: LoggingConfigExample @@ -135,8 +136,6 @@ The logging priority levels for the file logging and console logging can also be #Set the file to only log at critical level (2=critical) ConfigService.setConsoleLogLevel(2) -.. testoutput:: AddSampleLogExample - MantidPlot Properties diff --git a/Code/Mantid/docs/source/images/FilterEventsGUI.png b/Code/Mantid/docs/source/images/FilterEventsGUI.png new file mode 100644 index 0000000000000000000000000000000000000000..f11c3627057b4dddff6bf9bd856d8ae4f9fcbfae Binary files /dev/null and b/Code/Mantid/docs/source/images/FilterEventsGUI.png differ diff --git a/Code/Mantid/docs/source/interfaces/FilterEventUI.rst b/Code/Mantid/docs/source/interfaces/FilterEventUI.rst new file mode 100644 index 0000000000000000000000000000000000000000..6b4db6fa16c1a7a76dc75224069f34986d1d3f6c --- /dev/null +++ b/Code/Mantid/docs/source/interfaces/FilterEventUI.rst @@ -0,0 +1,123 @@ +Filter Events Interface +======================= + +.. contents:: Table of Contents + :local: + +Description +----------- + +The Filter Events interface provides aid to users in order to set up event filter with different +:ref:`functionalities-GenerateEventFilter-ref`. This interface utilises the algorithm +:ref:`GenerateEventsFilter <algm-GenerateEventsFilter>` which is able to generate event splitters +according to user’s requirement for filtering events. +The generated time splitters are stored either in a SplittersWorkspace or a +:ref:`MatrixWorkspace <MatrixWorkspace>`. Both of them will be used by algorithm +:ref:`FilterEvents <algm-FilterEvents>` which filters the events from a EventWorkspace to one or +multiple EventWorkspaces according to an input `SplittersWorkspace <http://www.mantidproject.org/SplittersWorkspace>`_ +containing a series of splitters. + +On the bottom section the user has an option of :ref:`filterbylogv-GenerateEventFilter-ref` +or :ref:`filterbytime-GenerateEventFilter-ref`. User also has an option of filtering events using +:ref:`advsetup-FilterEventUI-ref`. + + +Layout +------ + +.. figure:: /images/FilterEventsGUI.png + :align: center + :width: 400 + + +Data Loading +------------ + +For the data loading step, MantidPlot provides an interface in which the user shall select the +appropriate file via *Browse* button or by entering an integer as a valid run number in the +*File/Run* field, if the instrument name is set up in Mantid. The user must provide a file, +which contains valid sample logs +for splitting and :ref:`EventWorkspace <EventWorkspace>`. The data will be loaded once the user +has clicked upon the *Load* button. +With the help of *drop-down* list, user is be able to load more than one file and then click +on the *Use* button which will load the selected +file. If the file cannot be found in the *drop-down* list then user can click `Refresh` button +which should update +the *drop-down* list and enable user to select any browsed file. + +Plotting +-------- + +Once the file has been selected then the Interface would automatically generate the plot using +the provided file. If the user wish to plot another file then that could be achieved by selecting +another file from *drop-down* list and clicking on the *Use* button, which will automatically +plot the new graph generated from the selected file. + + +Output & Storing Event Splitters +-------------------------------- + +The output will be one or multiple workspaces according to the number of index in splitters. The +output workspace name is the combination of parameter OutputWorkspaceBaseName and the index in +splitter. The *Splitter Title* field is used as title of output splitters workspace and information +workspace. An event splitter used in Mantid contains start time, stop time and target workspace. Any +data structure that has the above 3 properties can serve as an event splitter. There are two types of +output workspaces for storing event splitters that are supported by +:ref:`GenerateEventsFilter <algm-GenerateEventsFilter>` algorithm. + +- `SplittersWorkspace <http://www.mantidproject.org/SplittersWorkspace>`_: It is a + :ref:`TableWorkspace <Table Workspaces>` that has 3 columns for start time, + stop time and target workspace for events within start time and stop time. This type of workspace is + appropriate for the case that the amount of generated event splitters are not huge. + + +- :ref:`MatrixWorkspace <MatrixWorkspace>`: It uses X-axis to store time stamp in total nanoseconds + and Y-axis to store target workspace. For example, :math:`[x_i, x_i+1]` and :math:`[y_i]` construct + an event filter as start time is :math:`[x_i]`, stop time is :math:`[x_i+1]`, and target workspace + is :math:`[y_i-th]` workspace. If :math:`[y_i]`, is less than 0, then it means + that all events between time :math:`[x_i]` and :math:`[x_i+1]` will be discarded. This type of + workspace is appropriate for the case that the amount of generated event splitters are huge, because + processing a :ref:`MatrixWorkspace <MatrixWorkspace>` is way faster than a + :ref:`TableWorkspace <Table Workspaces>` in Mantid. + +.. _advsetup-FilterEventUI-ref: + +Advanced Setup +-------------- + +The **Advanced Setup** section on the bottom of the interface provides access to the following +functionality: + ++------------------+----------------------------------------------------------+ +|Action | Effect | ++==================+==========================================================+ +| TOF Correction | Type of correction on neutron events to sample time from | +| To Sample | detector time. | ++------------------+----------------------------------------------------------+ +| Fast Log | Fast log will make output workspace to be a maxtrix | +| | workspace. | ++------------------+----------------------------------------------------------+ +| Generate Filter | Use multiple cores to generate events filter by log | +| In Parallel | values. Default as Serial which uses a single core and | +| | Parallel uses multiple cores. | ++------------------+----------------------------------------------------------+ +| Spectrum without | Approach to deal with spectrum without detectors. | +| Detector | | ++------------------+----------------------------------------------------------+ +| Filter By Pulse | Filter the event by its pulse time only for slow sample | +| Time | environment log.This option can make execution of | +| | algorithm faster. But it lowers precision. | ++------------------+----------------------------------------------------------+ +| Output Workspace | If selected, the minimum output workspace is indexed | +| Indexed From 1 | from 1 and continuous. | ++------------------+----------------------------------------------------------+ +| Group Output | Option to group all the output workspaces. | +| Workspace | | ++------------------+----------------------------------------------------------+ +| Split Sample | If selected, all sample logs will be splitted by the | +| Log | event splitters. It is not recommended for fast event | +| | log splitters. | ++------------------+----------------------------------------------------------+ + + +.. categories:: Interfaces FilterEventUI diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/doctest.py b/Code/Mantid/docs/sphinxext/mantiddoc/doctest.py index 613fc3cd70602983d25f0291dd7e9b599ea9bf6e..3bd4bea3581dcdcfd5a281f716c43a475eca4ae0 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/doctest.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/doctest.py @@ -42,7 +42,7 @@ Document: bar/FooDoc -------------------- ********************************************************************** - File "bar/FooDoc.rst", line 127, in Ex2 + File "bar/FooDoc.rst", line 127, in Ex2[31] Failed example: print "Multi-line failed" print "test" @@ -62,13 +62,13 @@ ********************************************************************** 2 items had failures: 1 of 1 in Ex1 - 1 of 1 in Ex2 + 1 of 1 in Ex2[31] 2 tests in 2 items. 0 passed and 2 failed. ***Test Failed*** 2 failures. 2 items passed all tests: 1 tests in Ex1 (cleanup code) - 1 tests in Ex2 (cleanup code) + 1 tests in Ex2[31] (cleanup code) 2 tests in 2 items. 2 passed and 0 failed. Test passed. @@ -152,7 +152,7 @@ NUMBER_PASSED_RE = re.compile(r"^(\d+) items passed all tests:$") TEST_PASSED_END_RE = re.compile(r"Test passed.") TEST_FAILED_END_RE = re.compile(r"\*\*\*Test Failed\*\*\* (\d+) failures.") -FAILURE_LOC_RE = re.compile(r"^File \"(.+)\",\s+line\s+(\d+),\s+in\s+(\w+)(\s\((setup|cleanup) code\))?$") +FAILURE_LOC_RE = re.compile(r"^File \"(.+)\",\s+line\s+(\d+),\s+in\s+(\S+)(\s\((setup|cleanup) code\))?$") MIX_FAIL_RE = re.compile(r'^\s+(\d+)\s+of\s+(\d+)\s+in\s+(\w+)$') #------------------------------------------------------------------------------- diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/tests/test_doctest.py b/Code/Mantid/docs/sphinxext/mantiddoc/tests/test_doctest.py index 66f3de9031e3d3a4677cd52f05943bb645218430..cf0a9505450405ad16bc2a21ba0edfcc74864a79 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/tests/test_doctest.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/tests/test_doctest.py @@ -149,7 +149,7 @@ ALL_FAIL_EX = \ """Document: algorithms/AllFailed ------------------------------ ********************************************************************** -File "algorithms/AllFailed.rst", line 127, in Ex2 +File "algorithms/AllFailed.rst", line 127, in Ex2[31] Failed example: print "Multi-line failed" print "test" @@ -169,13 +169,13 @@ Got: ********************************************************************** 2 items had failures: 1 of 1 in Ex1 - 1 of 1 in Ex2 + 1 of 1 in Ex2[31] 2 tests in 2 items. 0 passed and 2 failed. ***Test Failed*** 2 failures. 2 items passed all tests: 1 tests in Ex1 (cleanup code) - 1 tests in Ex2 (cleanup code) + 1 tests in Ex2[31] (cleanup code) 2 tests in 2 items. 2 passed and 0 failed. Test passed. @@ -275,9 +275,9 @@ class DocTestOutputParserTest(unittest.TestCase): self.assertEquals(2, suite.ntests) cases = suite.testcases - expected_names = ["Ex2", "Ex1"] + expected_names = ["Ex2[31]", "Ex1"] expected_errors = [ -"""File "algorithms/AllFailed.rst", line 127, in Ex2 +"""File "algorithms/AllFailed.rst", line 127, in Ex2[31] Failed example: print "Multi-line failed" print "test" diff --git a/Code/Mantid/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py b/Code/Mantid/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py index acc33996bbde30fd2a7311e6e873dd2db1f44184..8f337d02a9167c0a952900f1a1d545b494ee82b0 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py +++ b/Code/Mantid/scripts/Inelastic/Direct/ISISDirecInelasticConfig.py @@ -100,7 +100,7 @@ class MantidConfigDirectInelastic(object): to have: Map/masks folder with layout defined on (e.g. svn checkout) https://svn.isis.rl.ac.uk/InstrumentFiles/trunk - 2) User scripts folder with layout defined on + 2) User scripts folder with layout defined on (e.g. git checkout or Mantid script repository set-up): git@github.com:mantidproject/scriptrepository.git see https://github.com/mantidproject/scriptrepository for details @@ -110,7 +110,7 @@ class MantidConfigDirectInelastic(object): and other folders All these assumptions are summarized within __init__ - The class have to change/to be amended if the configuration + The class have to change/to be amended if the configuration changes or has additional features. """ def __init__(self,mantid='/opt/Mantid/',home='/home/',\ @@ -181,9 +181,9 @@ class MantidConfigDirectInelastic(object): # Methods, which build & verify various parts of Mantid configuration self._dynamic_options = [self._set_default_inst, - self._set_script_repo, # this would be necessary to have on an Instrument scientist account, disabled on generic setup - self._def_python_search_path, - self._set_datasearch_directory,self._set_rb_directory] + self._set_script_repo, # necessary to have on an Instrument scientist account, disabled on generic setup + self._def_python_search_path, + self._set_datasearch_directory,self._set_rb_directory] self._user = None self._cycle_data_folder=set() # this is the list, containing configuration strings @@ -202,7 +202,7 @@ class MantidConfigDirectInelastic(object): return True # missing file should always be replaced if not os.path.isfile(config_file_name): - return True + return True modification_date = date.fromtimestamp(os.path.getmtime(config_file_name)) start_date = self._user.get_start_date() if modification_date<start_date: @@ -218,7 +218,7 @@ class MantidConfigDirectInelastic(object): return True # non-existing file should always be replaced if not os.path.isfile(target_script_name): - return True + return True #Always replace sample file if it has not been touched start_date = self._user.get_start_date() # this time is set up to the file, copied from the repository @@ -299,7 +299,7 @@ class MantidConfigDirectInelastic(object): self._cycle_data_folder=set() for date_key,folder_id in theUser.cycle_IDlist.items(): self._cycle_data_folder.add(self.get_data_folder_name(theUser.instrument[date_key],folder_id)) - # Initialize configuration settings + # Initialize configuration settings self._dynamic_configuration = copy.deepcopy(self._dynamic_options_base) self._init_config() # @@ -363,7 +363,7 @@ class MantidConfigDirectInelastic(object): raise RuntimeError("Can not define RB folder without user being defined") # def _set_datasearch_directory(self): - """Note, map/mask instrument folder is lower case as if loaded from SVN. + """Note, map/mask instrument folder is lower case as if loaded from SVN. Autoreduction may have it upper case""" if not self._user: raise RuntimeError("Can not define Data search path without user being defined") @@ -375,7 +375,7 @@ class MantidConfigDirectInelastic(object): all_data_folders=list(self._cycle_data_folder) data_dir = os.path.abspath('{0}'.format(all_data_folders[0])) for folder in all_data_folders[1:]: - data_dir +=';'+os.path.abspath('{0}'.format(folder)) + data_dir +=';'+os.path.abspath('{0}'.format(folder)) all_rb_folders = self._user.rb_dir for folder in all_rb_folders.values(): @@ -391,7 +391,7 @@ class MantidConfigDirectInelastic(object): config_path = os.path.join(user_path,'.mantid') if not os.path.exists(config_path): err = os.makedirs(config_path) - if err: + if err: raise RuntimeError('can not find or create Mantid configuration path {0}'.format(config_path)) config_file = os.path.join(config_path,'Mantid.user.properties') diff --git a/Code/Mantid/scripts/Inelastic/Direct/PropertyManager.py b/Code/Mantid/scripts/Inelastic/Direct/PropertyManager.py index 63aeb894963734879a7071e0196da7d5c661b5a8..6000be229fa35dac66bee1f3952bc278f7e8220a 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/PropertyManager.py +++ b/Code/Mantid/scripts/Inelastic/Direct/PropertyManager.py @@ -412,7 +412,7 @@ class PropertyManager(NonIDF_Properties): except: try: cur_val = getattr(self,key) - except: + except: cur_val = "Undefined" self.log("Retrieving or reapplying script property {0} failed. Property value remains: {1}"\ .format(key,cur_val),'warning') diff --git a/Code/Mantid/scripts/Inelastic/Direct/diagnostics.py b/Code/Mantid/scripts/Inelastic/Direct/diagnostics.py index e5ceefd9d964e862bb4eb0a7d706889c7f55c2d6..8114b24706bd4ca2fce5a37824269256ea40889d 100644 --- a/Code/Mantid/scripts/Inelastic/Direct/diagnostics.py +++ b/Code/Mantid/scripts/Inelastic/Direct/diagnostics.py @@ -397,7 +397,7 @@ def print_test_summary(test_results,test_name=None): Input: test_results - A list or tuple containing either the number of failed spectra or None indicating that the test was not run - IMPORTANT: The output of this function is used as + IMPORTANT: The output of this function is used as input for GUI, so the keys names, = sign and : are control symbols of MantidWidgets->DiagResults method. """ diff --git a/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py b/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py index 41101523f41074363ccd5fc60587737929b3b9f0..28e1c4ffa2df91ab83d34b10f7107e64c8ece6dd 100644 --- a/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py +++ b/Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py @@ -122,8 +122,10 @@ def quick_explicit(run, i0_monitor_index, lambda_min, lambda_max, background_mi detector_index_ranges = (multi_detector_start, nHist-1) - _monitor_ws, _detector_ws = to_lam.convert(wavelength_min=lambda_min, wavelength_max=lambda_max, - detector_workspace_indexes=detector_index_ranges, monitor_workspace_index=i0_monitor_index, correct_monitor=True, bg_min=background_min, bg_max=background_max ) + _monitor_ws, _detector_ws = to_lam.convert(wavelength_min=lambda_min, wavelength_max=lambda_max, + detector_workspace_indexes=detector_index_ranges, + monitor_workspace_index=i0_monitor_index, correct_monitor=True, + bg_min=background_min, bg_max=background_max ) inst = _sample_ws.getInstrument() # Some beamline constants from IDF diff --git a/Code/Mantid/scripts/SANS/isis_reduction_steps.py b/Code/Mantid/scripts/SANS/isis_reduction_steps.py index c5cc2207efa0112ba6ae4835385bec9e69c9fdbd..0505afea4e4e7764b83cc5fa82f35421b7dd5b15 100644 --- a/Code/Mantid/scripts/SANS/isis_reduction_steps.py +++ b/Code/Mantid/scripts/SANS/isis_reduction_steps.py @@ -1126,7 +1126,7 @@ class LoadSample(LoadRun): def execute(self, reducer, isSample): self._assignHelper(reducer) - + if self.wksp_name == '': raise RuntimeError('Unable to load SANS sample run, cannot continue.') @@ -1246,7 +1246,7 @@ class TransmissionCalc(ReductionStep): self.fit_settings = dict() for prop in self.fit_props: self.fit_settings['both::'+prop] = None - + # CalculateTransmission can be given either a monitor detetor ID or a set of detector # ID's corresponding to a ROI (region of interest). The monitor or ROI will specify # the *transmission* (not the incident beam). A monitor is the standard functionality, @@ -1371,7 +1371,7 @@ class TransmissionCalc(ReductionStep): # We perform a FlatBackground correction. We do this in two parts. # First we find the workspace indices which correspond to monitors # and perform the correction on these indicies. - # Second we perform the correction on all indices which are not + # Second we perform the correction on all indices which are not # monitors for ws_index in range(tmp.getNumberHistograms()): if tmp.getDetector(ws_index).isMonitor(): diff --git a/Code/Tools/scripts/TestWikiPython.py b/Code/Tools/scripts/TestWikiPython.py new file mode 100644 index 0000000000000000000000000000000000000000..ff44eabe84669c17f9de58bd14b2ee19f5153da7 --- /dev/null +++ b/Code/Tools/scripts/TestWikiPython.py @@ -0,0 +1,169 @@ +########################################################################################### +# Extracts code blocks marked as python from mediawiki pages and checks they run +# run with -h for command line arguments +# +########################################################################################## +import os +import re +import sys +import urllib2 +import urlparse +import argparse +import json + +def readWebPage(url): + # set your environment HTTP_PROXY to be your proxy + # for ral HTTP_PROXY=http://wwwcache.rl.ac.uk:8080 + aResp = urllib2.urlopen(url) + web_pg = aResp.read() + return web_pg + + +def getTestablePages(url): + retList = [] + print "Reading Testable pages from " + url + output = readWebPage(url) + jsonObj = json.loads(output) + for member in jsonObj['query']['categorymembers']: + retList.append(member['title']) + return retList + + +def convertURLToRaw(url): + return url.replace(" ","%20") + "?action=raw" +def writeTestRst(filepath,mediawikiText,pageName): + ''' + for a block of wiki text, writes out all tests found to an rst page + :param mediawikiText: mediawiki text + :param filepath: the filepath to write out the rst file to, if None then print to stdout + :return: None + ''' + try: + if filepath is not None: + sys.stdout = open(filepath, 'w') + print ":orphan:\n" + findCodeSections(mediawikiText,pageName) + finally: + sys.stdout = sys.__stdout__ + +def findCodeSections(mediawikiText,pageName): + ''' + Finds code sections that look like this: + + #<div style="border:1pt dashed blue; background:#f9f9f9;padding: 1em 0;"> + # <!--skip--> + # <!-- setup + # x=1 + # y=2 + # file.open() + # --> + # <source lang="python"> + # x = 'The meaning of life is ... ' + # answer = 42 + # y = x + str(answer) # This converts the number 5 to a string and joins + # # it with the first string and then assigns y to a + # # new string containing the concatenated string + # </source> + # <!-- teardown + # print y # print statements can be in the teardown if you do not want them visible + # file.close() + # --> + # <!-- result + # the lazy dog + # --> + # </div> + ''' + + wikiTestPattern = re.compile( + r'''(<!--\s*skip\s*-->)?\s* # optional skip section (group 1) + (<!--\s*testsetup\s*(.*?)\s*-->)?\s* # optional setup section (group 2), just setup code (group 3) + <source.*?lang="python".*?>\s*(.*?)\s*<\/source>\s* # mandatory source section, code (group 4) + (<!--\s*testcleanup\s*(.*?)\s*-->)?\s* # optional teardown section (group 5), code (group 6) + (<!--\s+testoutput\s*(.*?)\s*-->)? # optional result section (group 7), text group (8) + ''', re.IGNORECASE + re.DOTALL + re.VERBOSE) + + for m in re.finditer(wikiTestPattern, mediawikiText): + (line,col) = coords_of_str_index(mediawikiText, m.start(0)) + testName = pageName + "[" + str(line) + "]" + #print the test + if m.group(1) is not None: + print ".. Skipping Test ", testName + print + else: + printDirective("testsetup",testName,m.group(3),True) + printDirective("testcode",testName,m.group(4),False) + printDirective("testcleanup",testName,m.group(6),True) + printDirective("testoutput",testName,m.group(8),True, "+ELLIPSIS, +NORMALIZE_WHITESPACE") + print + +def printDirective (directive, name, contents, hideIfNone = False,options = None): + if not(hideIfNone and contents is None): + print ".. {}:: {}".format(directive,name) + if options is not None: + print " :options: {}".format(options) + print + if contents is not None: + for line in contents.split("\n"): + print " " + line + print + +def coords_of_str_index(string, index): + """Get (line_number, col) of `index` in `string`.""" + lines = string.splitlines(True) + curr_pos = 0 + for linenum, line in enumerate(lines): + if curr_pos + len(line) > index: + return linenum + 1, index-curr_pos + curr_pos += len(line) + +def ensureDirectoriesExist(path): + try: + os.makedirs(path) + except OSError: + pass + +################################################################################################################ + +parser = argparse.ArgumentParser(description='Extracts code blocks marked as python from mediawiki pages and tests they run.') +parser.add_argument('-i', '--i', + help='The title of a mediawiki page, if not specified it will search the Tested Examples category') +parser.add_argument('-s', '--s', + help='The url of a mantid mediawiki site') +parser.add_argument('-o', '--o', + help='Provide a path to output to an output directory') + +args = parser.parse_args() +urlList = []; +baseUrl = "http://www.mantidproject.org/" +if args.s is not None: + baseUrl = args.s +if args.i is None: + urlList = getTestablePages(baseUrl + + "api.php?action=query&list=categorymembers&format=json&cmlimit=500&cmtitle=Category:Tested%20Examples") +else: + urlList.append(args.i) + +outputDir = None +if args.o is not None: + ensureDirectoriesExist(args.o) + if not os.path.isdir(args.o): + print "Output directory not found", args.o + print "Output will be to stdout" + else: + outputDir = args.o + +for url in urlList: + pageName = "mwTest_" + url.replace(" ","_").replace(":","") + print "Parsing ", pageName, + + outputFile = None + if outputDir is not None: + outputFile = os.path.join(outputDir, pageName+".rst") + print "->", outputFile + + #run pandoc and get the output in rst + mediawikiText = readWebPage(convertURLToRaw(baseUrl + url)) + writeTestRst(outputFile,mediawikiText,pageName) + + +