From bbde4eab487e07f05ed7bb7830f7a00065925f80 Mon Sep 17 00:00:00 2001 From: Nick Draper <nick.draper@stfc.ac.uk> Date: Mon, 9 Oct 2017 13:57:22 +0100 Subject: [PATCH] doctest updates commit 1 re #20869 --- .../algorithms/TOFTOFCropWorkspace-v1.rst | 16 ++-- docs/source/algorithms/TOFTOFMergeRuns-v1.rst | 84 +++++++++---------- .../algorithms/TOSCABankCorrection-v1.rst | 4 +- docs/source/algorithms/TransformHKL-v1.rst | 8 +- docs/source/algorithms/TransformToIqt-v1.rst | 4 +- docs/source/algorithms/Transpose-v1.rst | 8 +- docs/source/algorithms/TransposeMD-v1.rst | 6 +- docs/source/algorithms/UnwrapMonitor-v1.rst | 2 +- docs/source/algorithms/UnwrapSNS-v1.rst | 4 +- .../UpdateInstrumentFromFile-v1.rst | 6 +- .../UpdatePeakParameterTableValue-v1.rst | 4 +- .../VesuvioCalculateGammaBackground-v1.rst | 10 +-- .../VesuvioDiffractionReduction-v1.rst | 6 +- .../VesuvioL1ThetaResolution-v1.rst | 6 +- .../algorithms/VesuvioResolution-v1.rst | 2 +- .../source/algorithms/VesuvioThickness-v1.rst | 4 +- docs/source/algorithms/ViewBOA-v1.rst | 6 +- docs/source/algorithms/WeightedMean-v1.rst | 6 +- .../algorithms/WeightedMeanOfWorkspace-v1.rst | 4 +- 19 files changed, 95 insertions(+), 95 deletions(-) diff --git a/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst index c9aac22852b..c6a6dfcec8d 100644 --- a/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst +++ b/docs/source/algorithms/TOFTOFCropWorkspace-v1.rst @@ -35,24 +35,24 @@ Usage # Load data ws=Load(Filename='TOFTOFTestdata.nxs') - print "Input workspace" - print "Total number of time channels: ", len(ws.readX(0)) - print "Number of filled time channels: ", ws.getRun().getLogData('full_channels').value + print("Input workspace") + print("Total number of time channels: {}".format(len(ws.readX(0)))) + print ("Number of filled time channels: {}".format(ws.getRun().getLogData('full_channels').value)) wscropped = TOFTOFCropWorkspace(ws) - print "Output workspace" - print "Total number of time channels: ", len(wscropped.readX(0)) + print("Output workspace") + print("Total number of time channels: {}".format(len(wscropped.readX(0)))) Output: .. testoutput:: ExTOFTOFCropWorkspace Input workspace - Total number of time channels: 1025 - Number of filled time channels: 1020.0 + Total number of time channels: 1025 + Number of filled time channels: 1020.0 Output workspace - Total number of time channels: 1020 + Total number of time channels: 1020 .. categories:: diff --git a/docs/source/algorithms/TOFTOFMergeRuns-v1.rst b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst index f129e9ba5cc..a82cb525d6b 100644 --- a/docs/source/algorithms/TOFTOFMergeRuns-v1.rst +++ b/docs/source/algorithms/TOFTOFMergeRuns-v1.rst @@ -64,58 +64,58 @@ Usage ws3 = TOFTOFMergeRuns('ws1,ws2') # Temperature - print "Temperature of experiment for 1st workspace (in K): ", ws1.getRun().getLogData('temperature').value - print "Temperature of experiment for 2nd workspace (in K): ", ws2.getRun().getLogData('temperature').value - print "Temperature of experiment for merged workspaces = average over workspaces (in K): ", ws3.getRun().getLogData('temperature').value + print("Temperature of experiment for 1st workspace (in K): {}".format(ws1.getRun().getLogData('temperature').value)) + print("Temperature of experiment for 2nd workspace (in K): {}".format(ws2.getRun().getLogData('temperature').value)) + print("Temperature of experiment for merged workspaces = average over workspaces (in K): {}".format( ws3.getRun().getLogData('temperature').value)) # Duration - print "Duration of experiment for 1st workspace (in s): ", ws1.getRun().getLogData('duration').value - print "Duration of experiment for 2nd workspace (in s): ", ws2.getRun().getLogData('duration').value - print "Duration of experiment for merged workspaces = sum of all durations (in s): ", ws3.getRun().getLogData('duration').value + print("Duration of experiment for 1st workspace (in s): {}".format(ws1.getRun().getLogData('duration').value)) + print("Duration of experiment for 2nd workspace (in s): {}".format(ws2.getRun().getLogData('duration').value)) + print("Duration of experiment for merged workspaces = sum of all durations (in s): {}".format(ws3.getRun().getLogData('duration').value)) # Run start - print "Start of experiment for 1st workspace: ", ws1.getRun().getLogData('run_start').value - print "Start of experiment for 2nd workspace: ", ws2.getRun().getLogData('run_start').value - print "Start of experiment for merged workspaces = miminum of all workspaces: ", ws3.getRun().getLogData('run_start').value + print("Start of experiment for 1st workspace: {}".format(ws1.getRun().getLogData('run_start').value)) + print("Start of experiment for 2nd workspace: {}".format(ws2.getRun().getLogData('run_start').value)) + print("Start of experiment for merged workspaces = miminum of all workspaces: {}".format(ws3.getRun().getLogData('run_start').value)) # Run end - print "End of experiment for 1st workspace: ", ws1.getRun().getLogData('run_end').value - print "End of experiment for 2nd workspace: ", ws2.getRun().getLogData('run_end').value - print "End of experiment for merged workspaces = maximum of all workspaces: ", ws3.getRun().getLogData('run_end').value + print("End of experiment for 1st workspace: {}".format(ws1.getRun().getLogData('run_end').value)) + print("End of experiment for 2nd workspace: {}".format(ws2.getRun().getLogData('run_end').value)) + print("End of experiment for merged workspaces = maximum of all workspaces: {}".format(ws3.getRun().getLogData('run_end').value)) # Run number - print "Run number for 1st workspace: ", ws1.getRun().getLogData('run_number').value - print "Run number for 2nd workspace: ", ws2.getRun().getLogData('run_number').value - print "Run number for merged workspaces = list of all workspaces: ", ws3.getRun().getLogData('run_number').value + print("Run number for 1st workspace: {}".format(ws1.getRun().getLogData('run_number').value)) + print("Run number for 2nd workspace: {}".format(ws2.getRun().getLogData('run_number').value)) + print("Run number for merged workspaces = list of all workspaces: {}".format(ws3.getRun().getLogData('run_number').value)) # Monitor counts - print "Monitor counts for 1st workspace: ", ws1.getRun().getLogData('monitor_counts').value - print "Monitor counts for 2nd workspace: ", ws2.getRun().getLogData('monitor_counts').value - print "Monitor counts for merged workspaces = sum over all workspaces: ", ws3.getRun().getLogData('monitor_counts').value + print("Monitor counts for 1st workspace: {}".format(ws1.getRun().getLogData('monitor_counts').value)) + print("Monitor counts for 2nd workspace: {}".format(ws2.getRun().getLogData('monitor_counts').value)) + print("Monitor counts for merged workspaces = sum over all workspaces: {}".format(ws3.getRun().getLogData('monitor_counts').value)) Output: .. testoutput:: ExTOFTOFMergeRuns2ws - Temperature of experiment for 1st workspace (in K): 294.14 - Temperature of experiment for 2nd workspace (in K): 296.16 - Temperature of experiment for merged workspaces = average over workspaces (in K): 295.15 - Duration of experiment for 1st workspace (in s): 3601 - Duration of experiment for 2nd workspace (in s): 3601 - Duration of experiment for merged workspaces = sum of all durations (in s): 7202 - Start of experiment for 1st workspace: 2013-07-28T10:32:19+0053 - Start of experiment for 2nd workspace: 2013-07-28T11:32:19+0053 - Start of experiment for merged workspaces = miminum of all workspaces: 2013-07-28T10:32:19+0053 - End of experiment for 1st workspace: 2013-07-28T11:32:20+0053 - End of experiment for 2nd workspace: 2013-07-28T12:32:19+0053 - End of experiment for merged workspaces = maximum of all workspaces: 2013-07-28T12:32:19+0053 - Run number for 1st workspace: TOFTOFTestdata - Run number for 2nd workspace: TOFTOFTestdata2 - Run number for merged workspaces = list of all workspaces: ['TOFTOFTestdata', 'TOFTOFTestdata2'] - Monitor counts for 1st workspace: 136935 - Monitor counts for 2nd workspace: 145145 - Monitor counts for merged workspaces = sum over all workspaces: 282080 + Temperature of experiment for 1st workspace (in K): 294.14 + Temperature of experiment for 2nd workspace (in K): 296.16 + Temperature of experiment for merged workspaces = average over workspaces (in K): 295.15 + Duration of experiment for 1st workspace (in s): 3601 + Duration of experiment for 2nd workspace (in s): 3601 + Duration of experiment for merged workspaces = sum of all durations (in s): 7202 + Start of experiment for 1st workspace: 2013-07-28T10:32:19+0053 + Start of experiment for 2nd workspace: 2013-07-28T11:32:19+0053 + Start of experiment for merged workspaces = miminum of all workspaces: 2013-07-28T10:32:19+0053 + End of experiment for 1st workspace: 2013-07-28T11:32:20+0053 + End of experiment for 2nd workspace: 2013-07-28T12:32:19+0053 + End of experiment for merged workspaces = maximum of all workspaces: 2013-07-28T12:32:19+0053 + Run number for 1st workspace: TOFTOFTestdata + Run number for 2nd workspace: TOFTOFTestdata2 + Run number for merged workspaces = list of all workspaces: ['TOFTOFTestdata', 'TOFTOFTestdata2'] + Monitor counts for 1st workspace: 136935 + Monitor counts for 2nd workspace: 145145 + Monitor counts for merged workspaces = sum over all workspaces: 282080 **Example - Merge group of workspaces** @@ -132,17 +132,17 @@ Output: group=GroupWorkspaces('ws1,ws2') groupmerged=TOFTOFMergeRuns(group) - print "Monitor counts for 1st workspace: ", ws1.getRun().getLogData('monitor_counts').value - print "Monitor counts for 2nd workspace: ", ws2.getRun().getLogData('monitor_counts').value - print "Monitor counts for merged workspaces = sum over all workspaces: ", groupmerged.getRun().getLogData('monitor_counts').value + print("Monitor counts for 1st workspace: {}".format(ws1.getRun().getLogData('monitor_counts').value)) + print("Monitor counts for 2nd workspace: {}".format(ws2.getRun().getLogData('monitor_counts').value)) + print("Monitor counts for merged workspaces = sum over all workspaces: {}".format(groupmerged.getRun().getLogData('monitor_counts').value)) Output: .. testoutput:: ExTOFTOFMergeRunsGroup - Monitor counts for 1st workspace: 136935 - Monitor counts for 2nd workspace: 145145 - Monitor counts for merged workspaces = sum over all workspaces: 282080 + Monitor counts for 1st workspace: 136935 + Monitor counts for 2nd workspace: 145145 + Monitor counts for merged workspaces = sum over all workspaces: 282080 .. categories:: diff --git a/docs/source/algorithms/TOSCABankCorrection-v1.rst b/docs/source/algorithms/TOSCABankCorrection-v1.rst index 21a1da9a677..04ad8048292 100644 --- a/docs/source/algorithms/TOSCABankCorrection-v1.rst +++ b/docs/source/algorithms/TOSCABankCorrection-v1.rst @@ -71,7 +71,7 @@ Usage corrected_reduction, peak_position, scale_factor_1, scale_factor_2 = \ TOSCABankCorrection(InputWorkspace=original_reduction) - print 'Target peak centre: %.f' % peak_position + print('Target peak centre: %.f' % peak_position) Output: @@ -89,7 +89,7 @@ Output: TOSCABankCorrection(InputWorkspace=original_reduction, PeakPosition='715') - print 'Target peak centre: %.f' % peak_position + print( )'Target peak centre: %.f' % peak_position) Output: diff --git a/docs/source/algorithms/TransformHKL-v1.rst b/docs/source/algorithms/TransformHKL-v1.rst index 04b403ae80e..8777193cd86 100644 --- a/docs/source/algorithms/TransformHKL-v1.rst +++ b/docs/source/algorithms/TransformHKL-v1.rst @@ -30,13 +30,13 @@ Usage ws=LoadIsawPeaks("TOPAZ_3007.peaks") FindUBUsingFFT(ws,MinD=8.0,MaxD=13.0) - print "Before Transformation:" - print ws.sample().getOrientedLattice().getUB() + print("Before Transformation:") + print(ws.sample().getOrientedLattice().getUB()) #This HKLTransform is a matrix that will swap H and K and negate L TransformHKL(ws,HKLTransform="0,1,0,1,0,0,0,0,-1") - print "\nAfter Transformation:" - print ws.sample().getOrientedLattice().getUB() + print("\nAfter Transformation:") + print(ws.sample().getOrientedLattice().getUB()) Output: diff --git a/docs/source/algorithms/TransformToIqt-v1.rst b/docs/source/algorithms/TransformToIqt-v1.rst index 3e97d8178b7..65aa3e41c86 100644 --- a/docs/source/algorithms/TransformToIqt-v1.rst +++ b/docs/source/algorithms/TransformToIqt-v1.rst @@ -104,8 +104,8 @@ Usage EnergyMax=0.5, BinReductionFactor=10) - print 'Number of output bins: %d' % (params.cell('SampleOutputBins', 0)) - print 'Resolution bins: %d' % (params.cell('ResolutionBins', 0)) + print('Number of output bins: %d' % (params.cell('SampleOutputBins', 0))) + print('Resolution bins: %d' % (params.cell('ResolutionBins', 0))) Output: diff --git a/docs/source/algorithms/Transpose-v1.rst b/docs/source/algorithms/Transpose-v1.rst index 76e7264c9fe..0f1b630b43a 100644 --- a/docs/source/algorithms/Transpose-v1.rst +++ b/docs/source/algorithms/Transpose-v1.rst @@ -33,16 +33,16 @@ Usage # Create a workspace with 2 banks and 4 pixels per bank (8 spectra) # and X axis with 100 bins ws = CreateSampleWorkspace(BankPixelWidth=2) - print "Rank before = (", ws.getNumberHistograms(), ",", ws.blocksize(), ")" + print("Rank before = ( {0}, {1} )".format(ws.getNumberHistograms(),ws.blocksize())) ws = Transpose(ws) - print "Rank after = (", ws.getNumberHistograms(), ",", ws.blocksize(), ")" + print("Rank after = ( {0}, {1} )".format(ws.getNumberHistograms(),ws.blocksize())) Output: .. testoutput:: Ex - Rank before = ( 8 , 100 ) - Rank after = ( 100 , 8 ) + Rank before = ( 8, 100 ) + Rank after = ( 100, 8 ) .. categories:: diff --git a/docs/source/algorithms/TransposeMD-v1.rst b/docs/source/algorithms/TransposeMD-v1.rst index 479c69a0515..3d2715ce1ee 100644 --- a/docs/source/algorithms/TransposeMD-v1.rst +++ b/docs/source/algorithms/TransposeMD-v1.rst @@ -21,16 +21,16 @@ Usage def print_dims(ws): for i in range(ws.getNumDims()): - print 'Dimension %i is %s' % (i, ws.getDimension(i).name) + print('Dimension %i is %s' % (i, ws.getDimension(i).name)) mdws = CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U') FakeMDEventData(InputWorkspace=mdws, PeakParams='500000,0,0,0,3') binned = BinMD(InputWorkspace=mdws, AlignedDim0='A,0,10,100', AlignedDim1='B,-10,10,100', AlignedDim2='C,-10,10,1') - print 'Dimensions before', binned.getNumDims() + print('Dimensions before {}'.format(binned.getNumDims())) print_dims(binned) # Transpose the workspace transposed = TransposeMD(binned, Axes=[1,0]) - print 'Dimensions after', transposed.getNumDims() + print('Dimensions after {}'.format(transposed.getNumDims())) print_dims(transposed) Output: diff --git a/docs/source/algorithms/UnwrapMonitor-v1.rst b/docs/source/algorithms/UnwrapMonitor-v1.rst index b197d2b9de7..975f4095245 100644 --- a/docs/source/algorithms/UnwrapMonitor-v1.rst +++ b/docs/source/algorithms/UnwrapMonitor-v1.rst @@ -100,7 +100,7 @@ Usage # To access individual outputs use result[i] where i is the index of the required output. result = UnwrapMonitor(InputWorkspace=ws,LRef=11) - print "JoinWaveLength is: " + str(result[1]) + print("JoinWaveLength is: " + str(result[1])) Output: diff --git a/docs/source/algorithms/UnwrapSNS-v1.rst b/docs/source/algorithms/UnwrapSNS-v1.rst index 7331b37c348..2ebcc6c4e95 100644 --- a/docs/source/algorithms/UnwrapSNS-v1.rst +++ b/docs/source/algorithms/UnwrapSNS-v1.rst @@ -54,8 +54,8 @@ Usage ws = CreateSampleWorkspace("Event",NumBanks=1,BankPixelWidth=1) wsOut = UnwrapSNS(ws,LRef=10) - print "Input", ws.readY(0)[ws.blocksize()-1] - print "Output", wsOut.readY(0)[wsOut.blocksize()-1] + print("Input {}".format(ws.readY(0)[ws.blocksize()-1])) + print("Output {}".format(wsOut.readY(0)[wsOut.blocksize()-1])) Output: diff --git a/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst b/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst index aaf7babcb7d..32d2db41241 100644 --- a/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst +++ b/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst @@ -82,7 +82,7 @@ Usage ''' print first 10 detectors from given instrument ''' # get first 10 detectors using detector ID - print "{0} {1} instrument".format(instr_type, instr.getName()) + print("{0} {1} instrument".format(instr_type, instr.getName())) for i in xrange(0,10): if i<3: detBase = 1 @@ -91,8 +91,8 @@ Usage detID = detBase+i det1 = instr.getDetector(detID); pos = det1.getPos(); - print 'det with ID: {0:5} is monitor? {1:5}, polar angle: {2:10.3f}, position: | {3:<10.3f} | {4:<10.3f} | {5:<10.3f}|\n'.format(\ - detID,det1.isMonitor(),(det1.getPhi()*(180/math.pi)),pos.X(),pos.Y(),pos.Z()), + print('det with ID: {0:5} is monitor? {1:5}, polar angle: {2:10.3f}, position: | {3:<10.3f} | {4:<10.3f} | {5:<10.3f}|'.format(\ + detID,det1.isMonitor(),(det1.getPhi()*(180/math.pi)),pos.X(),pos.Y(),pos.Z())) print '*********************************************************************************' #-------------------------------------------------------------------------------------- diff --git a/docs/source/algorithms/UpdatePeakParameterTableValue-v1.rst b/docs/source/algorithms/UpdatePeakParameterTableValue-v1.rst index 4628e8697d3..ac2bcafff2d 100644 --- a/docs/source/algorithms/UpdatePeakParameterTableValue-v1.rst +++ b/docs/source/algorithms/UpdatePeakParameterTableValue-v1.rst @@ -64,11 +64,11 @@ Usage tablews.addRow(["A", 1.34]) tablews.addRow(["B", 2.34]) - print "Value before %.2f" % tablews.cell(0, 1) + print("Value before %.2f" % tablews.cell(0, 1)) UpdatePeakParameterTableValue(tablews, Column="Value", ParameterNames=["A"], NewFloatValue=1.00) - print "Value after %.2f" % tablews.cell(0, 1) + print("Value after %.2f" % tablews.cell(0, 1)) Output: diff --git a/docs/source/algorithms/VesuvioCalculateGammaBackground-v1.rst b/docs/source/algorithms/VesuvioCalculateGammaBackground-v1.rst index a011c099c97..1f627b96cbc 100644 --- a/docs/source/algorithms/VesuvioCalculateGammaBackground-v1.rst +++ b/docs/source/algorithms/VesuvioCalculateGammaBackground-v1.rst @@ -57,9 +57,9 @@ Usage corrected, background = VesuvioCalculateGammaBackground(tof_ws, ComptonFunction=mass_function, WorkspaceIndexList=0) - print "First 5 values of input:", tof_ws.readY(0)[0:4] - print "First 5 values of background:", background.readY(0)[0:4] - print "First 5 values of corrected:", corrected.readY(0)[0:4] + print("First 5 values of input: {}".format(tof_ws.readY(0)[0:4])) + print("First 5 values of background: {}".format(background.readY(0)[0:4])) + print("First 5 values of corrected: {}".format(corrected.readY(0)[0:4])) Output: @@ -89,8 +89,8 @@ Output: mass_function = "name=GaussianComptonProfile,Mass=1.0079,Width=0.4,Intensity=1.1" corrected, background = VesuvioCalculateGammaBackground(tof_ws, ComptonFunction=mass_function) - print "Number of background spectra:", background.getNumberHistograms() - print "Number of corrected spectra:", corrected.getNumberHistograms() + print("Number of background spectra: {}".format(background.getNumberHistograms())) + print("Number of corrected spectra: {}".format(corrected.getNumberHistograms())) Output: diff --git a/docs/source/algorithms/VesuvioDiffractionReduction-v1.rst b/docs/source/algorithms/VesuvioDiffractionReduction-v1.rst index b6ee15aa018..7e040f332f1 100644 --- a/docs/source/algorithms/VesuvioDiffractionReduction-v1.rst +++ b/docs/source/algorithms/VesuvioDiffractionReduction-v1.rst @@ -38,9 +38,9 @@ Usage ws = mtd['DiffractionReductions'].getItem(0) - print 'Workspace name: %s' % ws.name() - print 'Number of spectra: %d' % ws.getNumberHistograms() - print 'Number of bins: %s' % ws.blocksize() + print('Workspace name: %s' % ws.name()) + print('Number of spectra: %d' % ws.getNumberHistograms()) + print('Number of bins: %s' % ws.blocksize()) Output: diff --git a/docs/source/algorithms/VesuvioL1ThetaResolution-v1.rst b/docs/source/algorithms/VesuvioL1ThetaResolution-v1.rst index 7515964d082..c27d0c3dc6d 100644 --- a/docs/source/algorithms/VesuvioL1ThetaResolution-v1.rst +++ b/docs/source/algorithms/VesuvioL1ThetaResolution-v1.rst @@ -27,10 +27,10 @@ Usage resolution, l1_dist, theta_dist = VesuvioL1ThetaResolution(NumEvents=1000) resolution_spec_names = resolution.getAxis(1).extractValues() - print "Resolution spectra: %s" % (', '.join(resolution_spec_names)) + print("Resolution spectra: %s" % (', '.join(resolution_spec_names))) - print "L1 distribution spectra count: %d" % (l1_dist.getNumberHistograms()) - print "Theta distribution spectra count: %d" % (theta_dist.getNumberHistograms()) + print("L1 distribution spectra count: %d" % (l1_dist.getNumberHistograms())) + print("Theta distribution spectra count: %d" % (theta_dist.getNumberHistograms())) Output: diff --git a/docs/source/algorithms/VesuvioResolution-v1.rst b/docs/source/algorithms/VesuvioResolution-v1.rst index f1bb8bbc00a..96a8742deda 100644 --- a/docs/source/algorithms/VesuvioResolution-v1.rst +++ b/docs/source/algorithms/VesuvioResolution-v1.rst @@ -34,7 +34,7 @@ Usage tof, ysp = VesuvioResolution(Workspace=tof_ws, Mass=1.0079) - print 'Resolution in %s and %s.' % (tof.getAxis(0).getUnit().symbol(), ysp.getAxis(0).getUnit().symbol()) + print('Resolution in %s and %s.' % (tof.getAxis(0).getUnit().symbol(), ysp.getAxis(0).getUnit().symbol())) Output: diff --git a/docs/source/algorithms/VesuvioThickness-v1.rst b/docs/source/algorithms/VesuvioThickness-v1.rst index 16b324c623a..9933d3fe52a 100644 --- a/docs/source/algorithms/VesuvioThickness-v1.rst +++ b/docs/source/algorithms/VesuvioThickness-v1.rst @@ -30,8 +30,8 @@ Usage dens_tbl, trans_tbl = VesuvioThickness(masses, amplitudes, trans_guess, thickness, number_density) # Test output - print "The final density is: %.4f" % dens_tbl.cell(9,1) - print "The final transmission is: %.4f" % trans_tbl.cell(9,1) + print("The final density is: %.4f" % dens_tbl.cell(9,1)) + print("The final transmission is: %.4f" % trans_tbl.cell(9,1)) Output: diff --git a/docs/source/algorithms/ViewBOA-v1.rst b/docs/source/algorithms/ViewBOA-v1.rst index b5f5f02969c..5ff2f80045b 100644 --- a/docs/source/algorithms/ViewBOA-v1.rst +++ b/docs/source/algorithms/ViewBOA-v1.rst @@ -41,9 +41,9 @@ The following code loads a BOA file and prints out information about the wavelen lamdba_distribution = mtd['histogram61'].readY(0) lambda_values = mtd['histogram61'].readX(0) - print "The wavelength spectrum is described by", len(lamdba_distribution),"points." - print "The range covered is", round(lambda_values[0], 4), "-", round(lambda_values[-1], 4), "Angstrom." - print "The maximum is located at", round(lambda_values[np.argmax(lamdba_distribution)], 4), "Angstrom." + print("The wavelength spectrum is described by {}".format(len(lamdba_distribution),"points.")) + print("The range covered is {0} - {1} Angstrom.".format(round(lambda_values[0], 4),round(lambda_values[-1], 4))) + print("The maximum is located at {} Angstrom.".format(round(lambda_values[np.argmax(lamdba_distribution)], 4))) This script leads to the following output: diff --git a/docs/source/algorithms/WeightedMean-v1.rst b/docs/source/algorithms/WeightedMean-v1.rst index c23f8b13245..c442760088b 100644 --- a/docs/source/algorithms/WeightedMean-v1.rst +++ b/docs/source/algorithms/WeightedMean-v1.rst @@ -33,9 +33,9 @@ Usage # perform the algorithm ws = WeightedMean(ws1, ws2) - print "The X values are: " + str(ws.readX(0)) - print "The Y values are: " + str(ws.readY(0)) - print "The E values are: " + str(ws.readE(0)) + print("The X values are: " + str(ws.readX(0))) + print("The Y values are: " + str(ws.readY(0))) + print("The E values are: " + str(ws.readE(0))) Output: diff --git a/docs/source/algorithms/WeightedMeanOfWorkspace-v1.rst b/docs/source/algorithms/WeightedMeanOfWorkspace-v1.rst index 8c512b7c946..637b0379f9d 100644 --- a/docs/source/algorithms/WeightedMeanOfWorkspace-v1.rst +++ b/docs/source/algorithms/WeightedMeanOfWorkspace-v1.rst @@ -30,8 +30,8 @@ Usage dataE = range(1,12) ws = CreateWorkspace(dataX, dataY, dataE) ws1 = WeightedMeanOfWorkspace(ws) - print "Weighted Mean of Workspace:", str(ws1.readY(0)) - print "Weighted Mean Error of Workspace:", str(ws1.readE(0)) + print("Weighted Mean of Workspace: {}".format(str(ws1.readY(0)))) + print("Weighted Mean Error of Workspace: {}".format(str(ws1.readE(0)))) Output: -- GitLab