diff --git a/docs/source/algorithms/SaveIsawPeaks-v1.rst b/docs/source/algorithms/SaveIsawPeaks-v1.rst index 5700be95ada51900a4525b37a6f409935245bd09..64357cacb45512080061310691fad12bc0b32acd 100644 --- a/docs/source/algorithms/SaveIsawPeaks-v1.rst +++ b/docs/source/algorithms/SaveIsawPeaks-v1.rst @@ -44,10 +44,10 @@ Usage # different on different systems and breaks tests for line in file[:9]: # print the line stripping any ending white spaces - print line.rstrip() + print(line.rstrip()) for line in file[10:12]: # print the line stripping any ending white spaces - print line.rstrip() + print(line.rstrip()) Output ###### diff --git a/docs/source/algorithms/SaveIsawUB-v1.rst b/docs/source/algorithms/SaveIsawUB-v1.rst index 8e9e2b4f95953b4796f463c8d6421e3fb4ebab3f..3c1bb60644f80db597c2243ed52e5189011b661e 100644 --- a/docs/source/algorithms/SaveIsawUB-v1.rst +++ b/docs/source/algorithms/SaveIsawUB-v1.rst @@ -26,24 +26,24 @@ Usage .. testcode:: SaveIsawUB #A workspace with some UB matrix - w=CreateSingleValuedWorkspace() - SetUB(w,2,4,5,90,90,90,"0,0,1","1,0,0") + w = CreateSingleValuedWorkspace() + SetUB(w, 2, 4, 5, 90, 90, 90, "0,0,1", "1,0,0") #run the algorithm import mantid - filename=mantid.config.getString("defaultsave.directory")+"saveIsawUBTest.mat" - SaveIsawUB(w,filename) + filename = mantid.config.getString("defaultsave.directory") + "saveIsawUBTest.mat" + SaveIsawUB(w, filename) #check if the correct results are written in the file - f=open(filename,"r") - x,y,z=map(float,f.readline().split()) + f = open(filename, "r") + x, y, z = map(float, f.readline().split()) if (x==0) and (y==0.5) and (z==0): - print "The first line is 0 0.5 0" - x,y,z=map(float,f.readline().split()) + print("The first line is 0 0.5 0") + x, y, z = map(float, f.readline().split()) if (x==0) and (y==0) and (z==0.25): - print "The second line is 0 0 0.25" - x,y,z=map(float,f.readline().split()) + print("The second line is 0 0 0.25") + x, y, z = map(float, f.readline().split()) if (x==0.2) and (y==0) and (z==0): - print "The third line is 0.2 0 0" + print("The third line is 0.2 0 0") f.close() diff --git a/docs/source/algorithms/SaveLauenorm-v1.rst b/docs/source/algorithms/SaveLauenorm-v1.rst index 9e784105ce2de4728e6877695b1a81dc0e4310c5..0ab304c56215c4616a6ac8c7de53e01953a5b927 100644 --- a/docs/source/algorithms/SaveLauenorm-v1.rst +++ b/docs/source/algorithms/SaveLauenorm-v1.rst @@ -37,7 +37,7 @@ Usage SaveLauenorm(InputWorkspace=peaks, Filename=prefix) firstfile = prefix + "001" - print "File was saved:", os.path.isfile(firstfile) + print("File was saved: {}".format(os.path.isfile(firstfile))) Output: @@ -66,7 +66,7 @@ Output: #load a peaks workspace from file peaks = LoadIsawPeaks(Filename=r'Peaks5637.integrate') - print "Number of peaks in table %d" % peaks.rowCount() + print("Number of peaks in table {}".format(peaks.rowCount())) prefix = os.path.expanduser("~/MyPeaks") SaveLauenorm(InputWorkspace=peaks, Filename=prefix, MinWavelength=0.5, MaxWavelength=2,MinDSpacing=0.2, SortFilesBy='Bank') @@ -75,7 +75,7 @@ Output: ifile = open(finalfile, 'r') lines = ifile.readlines() ifile.close() - print "Number of peaks in table %d" % len(lines) + print("Number of peaks in table {}".format(len(lines))) Output: diff --git a/docs/source/algorithms/SaveMD-v1.rst b/docs/source/algorithms/SaveMD-v1.rst index 00a57664583f208fe75edbbaf8d186b476cf4374..e0ff00e221e22f83350229d5ba6c20e91aa151f6 100644 --- a/docs/source/algorithms/SaveMD-v1.rst +++ b/docs/source/algorithms/SaveMD-v1.rst @@ -31,7 +31,7 @@ Usage import os savefile = os.path.join(config["default.savedirectory"], "mdhws.nxs") SaveMD(ws, Filename=savefile, Version=1) - print "File created:", os.path.exists(savefile) + print("File created: {}".format(os.path.exists(savefile))) Output: diff --git a/docs/source/algorithms/SaveMD-v2.rst b/docs/source/algorithms/SaveMD-v2.rst index 1476e21e64967dc1cfcea7d43c586793a5741ca6..baf9a2f931ad27af951dafbe49c12b979bb47aa2 100644 --- a/docs/source/algorithms/SaveMD-v2.rst +++ b/docs/source/algorithms/SaveMD-v2.rst @@ -31,7 +31,7 @@ Usage import os savefile = os.path.join(config["default.savedirectory"], "mdhws.nxs") SaveMD(ws, Filename=savefile) - print "File created:", os.path.exists(savefile) + print("File created: {}".format(os.path.exists(savefile))) Output: diff --git a/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst b/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst index 44ddae6f819bf99329d604bc90833e572b4a6221..19c90a8f3286a0679fdd0575c4739bcc063ce5db 100644 --- a/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst +++ b/docs/source/algorithms/SaveMDWorkspaceToVTK-v1.rst @@ -37,7 +37,7 @@ Usage savefile = os.path.join(config["defaultsave.directory"], "mdhws.vts") SaveMDWorkspaceToVTK(InputWorkspace = ws, Filename = savefile) - print "File created:", os.path.exists(savefile) + print("File created: {}".format(os.path.exists(savefile))) .. testoutput:: SaveMDWorkspaceToVTK diff --git a/docs/source/algorithms/SaveNISTDAT-v1.rst b/docs/source/algorithms/SaveNISTDAT-v1.rst index 737c0665dd65fe79257678200e58226efb88846c..e9d30acff91cd6266b6a7c79dbd0b086600acdbb 100644 --- a/docs/source/algorithms/SaveNISTDAT-v1.rst +++ b/docs/source/algorithms/SaveNISTDAT-v1.rst @@ -34,7 +34,7 @@ Usage # Load it back in and inspect what we have. reloaded_data = LoadAscii(file_path) - print "The data read back in is " + str(reloaded_data.readY(0)) + print("The data read back in is " + str(reloaded_data.readY(0))) .. testcleanup:: ExSaveRoundtrip diff --git a/docs/source/algorithms/SaveNXSPE-v1.rst b/docs/source/algorithms/SaveNXSPE-v1.rst index 0e0232d9f4bc7b148084ed37d8e6bb065e8fe288..23f1dd2ac87b97de50841180a8a2bee9d84a63f9 100644 --- a/docs/source/algorithms/SaveNXSPE-v1.rst +++ b/docs/source/algorithms/SaveNXSPE-v1.rst @@ -48,16 +48,16 @@ Usage # By desigghn, SaveMXSPE does not store detector's ID-s. LoadNXSPE sets detector's ID-s to defaults. # To compare loaded and saved workspaces here, one needs to set-up default detector's ID-s to the source workspace. nSpec = out_ws.getNumberHistograms() - for i in xrange(0,nSpec): + for i in range(0,nSpec): sp=out_ws.getSpectrum(i); sp.setDetectorID(i+1); in_ws = LoadNXSPE(file_path) ws_comparison_rez = CompareWorkspaces(out_ws,in_ws,1.e-9,CheckInstrument=False) - print "Contents of the first spectrum = " + str(in_ws.readY(0)) + "." - print "Initial and loaded workspaces comparison is:",str(ws_comparison_rez[0]) + print("Contents of the first spectrum = {}.".format(in_ws.readY(0))) + print("Initial and loaded workspaces comparison is: {}".format(str(ws_comparison_rez[0]))) run = in_ws.getRun(); - print "Loaded workspace has attached incident energy Ei={0:5} and rotation angle Psi={1:5}deg".format(run.getLogData('Ei').value,run.getLogData('psi').value) + print("Loaded workspace has attached incident energy Ei={0:.1f} and rotation angle Psi= {1:.1f}deg".format(run.getLogData('Ei').value,run.getLogData('psi').value)) .. testcleanup:: ExSimpleSavingRoundtrip diff --git a/docs/source/algorithms/SaveNexusProcessed-v1.rst b/docs/source/algorithms/SaveNexusProcessed-v1.rst index b8925d8a4b1b027a3cd1a3d0be4a449f42beb808..c0ee69902031bbc457d9a1c8c0765419740c0176 100644 --- a/docs/source/algorithms/SaveNexusProcessed-v1.rst +++ b/docs/source/algorithms/SaveNexusProcessed-v1.rst @@ -58,7 +58,7 @@ Usage path = os.path.join(os.path.expanduser("~"), file_name) SaveNexusProcessed(ws, path) - print os.path.isfile(path) + print(os.path.isfile(path)) Output: @@ -91,10 +91,10 @@ Output: path = os.path.join(os.path.expanduser("~"), file_name) SaveNexusProcessed(ws, path, Title="MyWorkspace", WorkspaceIndexMin=0, WorkspaceIndexMax=9) - print os.path.isfile(path) + print(os.path.isfile(path)) ws = Load(path) - print "Saved workspace has %d spectra" % ws.getNumberHistograms() + print("Saved workspace has {} spectra".format(ws.getNumberHistograms())) Output: @@ -127,10 +127,10 @@ Output: path = os.path.join(os.path.expanduser("~"), file_name) SaveNexusProcessed(ws, path, CompressNexus=True, PreserveEvents=True) - print os.path.isfile(path) + print(os.path.isfile(path)) ws = Load(path) - print "Saved workspace has %d spectra" % ws.getNumberHistograms() + print("Saved workspace has {} spectra".format(ws.getNumberHistograms())) Output: diff --git a/docs/source/algorithms/SaveOpenGenieAscii-v1.rst b/docs/source/algorithms/SaveOpenGenieAscii-v1.rst index 0c93ff9da3c725ffd20d6137351d8479691e43db..6d853c65781094c251a7a84a15c1fdab9de5ccd4 100644 --- a/docs/source/algorithms/SaveOpenGenieAscii-v1.rst +++ b/docs/source/algorithms/SaveOpenGenieAscii-v1.rst @@ -41,7 +41,7 @@ Usage SaveOpenGenieAscii(ws, path) path = os.path.join(os.path.expanduser("~"), "myworkspace.ascii") - print os.path.isfile(path) + print(os.path.isfile(path)) Output: diff --git a/docs/source/algorithms/SavePAR-v1.rst b/docs/source/algorithms/SavePAR-v1.rst index 075d7495cd7ca89366f5e23226357a01291ea5e6..11274afe87b080bb80871a809851c2dbd15ce11f 100644 --- a/docs/source/algorithms/SavePAR-v1.rst +++ b/docs/source/algorithms/SavePAR-v1.rst @@ -50,13 +50,13 @@ Usage # import os funcions to work with folders import os # create sample workspace - ws=CreateSampleWorkspace(); + ws = CreateSampleWorkspace() # test file name file_name = os.path.join(config["defaultsave.directory"], "TestSavePar.par") - # save the file + # save the file SavePAR(ws,Filename=file_name); - print "target file exists? {0}".format(os.path.exists(file_name)); + print("target file exists? {0}".format(os.path.exists(file_name))) .. testcleanup:: exSavePAR