From f3de57f80a026388803409be65e7ddd0ceb104d6 Mon Sep 17 00:00:00 2001 From: Joseph Ramsay <joseph.ramsay@stfc.ac.uk> Date: Fri, 6 Oct 2017 09:19:36 +0100 Subject: [PATCH] Re #20825 Added missing brackets and removed xrange --- docs/source/algorithms/SaveIsawUB-v1.rst | 16 ++++++++-------- docs/source/algorithms/SaveNXSPE-v1.rst | 4 ++-- docs/source/algorithms/SaveNexusProcessed-v1.rst | 2 +- docs/source/algorithms/SaveOpenGenieAscii-v1.rst | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/source/algorithms/SaveIsawUB-v1.rst b/docs/source/algorithms/SaveIsawUB-v1.rst index 00a0b73a5f3..3c1bb60644f 100644 --- a/docs/source/algorithms/SaveIsawUB-v1.rst +++ b/docs/source/algorithms/SaveIsawUB-v1.rst @@ -26,22 +26,22 @@ 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()) + 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()) + 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") f.close() diff --git a/docs/source/algorithms/SaveNXSPE-v1.rst b/docs/source/algorithms/SaveNXSPE-v1.rst index 3f7e7c014a7..82e479821a8 100644 --- a/docs/source/algorithms/SaveNXSPE-v1.rst +++ b/docs/source/algorithms/SaveNXSPE-v1.rst @@ -48,13 +48,13 @@ 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("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:.1f} and rotation angle Psi={1:.1f}deg".format(run.getLogData('Ei').value,run.getLogData('psi').value)) diff --git a/docs/source/algorithms/SaveNexusProcessed-v1.rst b/docs/source/algorithms/SaveNexusProcessed-v1.rst index 51eb7294f61..c0ee6990203 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: diff --git a/docs/source/algorithms/SaveOpenGenieAscii-v1.rst b/docs/source/algorithms/SaveOpenGenieAscii-v1.rst index 0c93ff9da3c..6d853c65781 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: -- GitLab