From 0e53b4bc0099343363b1587d54235df3c82fa0b9 Mon Sep 17 00:00:00 2001 From: Owen Arnold <owen.arnold@stfc.ac.uk> Date: Sat, 7 Nov 2015 09:23:41 +0000 Subject: [PATCH] refs #14124. Simplify Doc tests. --- docs/source/algorithms/CorelliCrossCorrelate-v1.rst | 4 ++-- docs/source/algorithms/ElasticWindowMultiple-v1.rst | 4 ++-- docs/source/algorithms/FuryFitMultiple-v1.rst | 4 ++-- docs/source/algorithms/GetEiT0atSNS-v1.rst | 4 ++-- docs/source/algorithms/LoadDetectorInfo-v1.rst | 4 ++-- docs/source/algorithms/LoadInstrument-v1.rst | 4 ++-- docs/source/algorithms/LoadMappingTable-v1.rst | 4 ++-- docs/source/algorithms/MuscatFunc-v1.rst | 4 ++-- docs/source/algorithms/OSIRISDiffractionReduction-v1.rst | 4 ++-- docs/source/algorithms/PoldiFitPeaks1D-v1.rst | 2 +- docs/source/algorithms/PoldiMerge-v1.rst | 6 +++--- docs/source/algorithms/PoldiPeakSearch-v1.rst | 4 ++-- docs/source/algorithms/PoldiPeakSummary-v1.rst | 4 ++-- docs/source/algorithms/PoldiTruncateData-v1.rst | 4 ++-- docs/source/algorithms/QLines-v1.rst | 4 ++-- docs/source/algorithms/ResNorm-v1.rst | 4 ++-- docs/source/algorithms/ResNorm-v2.rst | 4 ++-- docs/source/algorithms/SANSBeamFluxCorrection-v1.rst | 4 ++-- docs/source/algorithms/SofQWMoments-v1.rst | 4 ++-- docs/source/algorithms/UpdateInstrumentFromFile-v1.rst | 4 ++-- 20 files changed, 40 insertions(+), 40 deletions(-) diff --git a/docs/source/algorithms/CorelliCrossCorrelate-v1.rst b/docs/source/algorithms/CorelliCrossCorrelate-v1.rst index f3278aa3c73..43735f309b7 100644 --- a/docs/source/algorithms/CorelliCrossCorrelate-v1.rst +++ b/docs/source/algorithms/CorelliCrossCorrelate-v1.rst @@ -24,12 +24,12 @@ Usage **Example - CorelliCrossCorrelate** .. testcode:: CorelliCrossCorrelateExample - from mantid.kernel import OptionalBoolValue + # Load a Corelli data file. ws = Load('CORELLI_2100') # You will need to load the instrument if the one in the NeXus file doesn't contain the chopper sequence. - LoadInstrument(ws, MonitorList='-1,-2,-3', InstrumentName='CORELLI', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, MonitorList='-1,-2,-3', InstrumentName='CORELLI', RewriteSpectraMap=True) # Run the cross-correlation. This is using a TDC timing offset of 56000ns. wsOut = CorelliCrossCorrelate(ws,56000) diff --git a/docs/source/algorithms/ElasticWindowMultiple-v1.rst b/docs/source/algorithms/ElasticWindowMultiple-v1.rst index 159b16b1112..62f12bb086e 100644 --- a/docs/source/algorithms/ElasticWindowMultiple-v1.rst +++ b/docs/source/algorithms/ElasticWindowMultiple-v1.rst @@ -28,7 +28,7 @@ Usage ----- .. testcode:: exElasticWindowMultiple - from mantid.kernel import OptionalBoolValue + # This test needs the facility to be set to ISIS to load the IRIS instrument facility = config['default.facility'] config['default.facility'] = 'ISIS' @@ -57,7 +57,7 @@ Usage Params=[-0.2,0.004,0.2]) LoadInstrument(Workspace=ws_name, - InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + InstrumentName='IRIS', RewriteSpectraMap=True) SetInstrumentParameter(Workspace=ws_name, ParameterName='Efixed', diff --git a/docs/source/algorithms/FuryFitMultiple-v1.rst b/docs/source/algorithms/FuryFitMultiple-v1.rst index 9385f0750fc..604ac760125 100644 --- a/docs/source/algorithms/FuryFitMultiple-v1.rst +++ b/docs/source/algorithms/FuryFitMultiple-v1.rst @@ -23,13 +23,13 @@ Usage **Example - Running FuryFitMultiple on an reduced workspace.** .. code-block:: python - from mantid.kernel import OptionalBoolValue + #create a dummy workspace function = "name=ExpDecay,Height=1,Lifetime=0.035" ws = CreateSampleWorkspace("Histogram", Function="User Defined", UserDefinedFunction=function, XMin=0, XMax=0.5, BinWidth=0.01, XUnit="Time", NumBanks=1) #load instrument defintion and parameters - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) param_file = config['instrumentDefinition.directory'] + 'IRIS_graphite_002_Parameters.xml' LoadParameterFile(ws, param_file) diff --git a/docs/source/algorithms/GetEiT0atSNS-v1.rst b/docs/source/algorithms/GetEiT0atSNS-v1.rst index 832d408f036..372dcbc9bbe 100644 --- a/docs/source/algorithms/GetEiT0atSNS-v1.rst +++ b/docs/source/algorithms/GetEiT0atSNS-v1.rst @@ -32,9 +32,9 @@ Usage .. include:: ../usagedata-note.txt .. testcode:: GetEiT0atSNS - from mantid.kernel import OptionalBoolValue + w=Load('ADARAMonitors.nxs') - LoadInstrument(Workspace=w,InstrumentName='SEQUOIA',RewriteSpectraMap=OptionalBoolValue.False) + LoadInstrument(Workspace=w,InstrumentName='SEQUOIA',RewriteSpectraMap=False) AddSampleLog(Workspace=w,LogName='vChTrans',LogText='1',LogType='Number Series') AddSampleLog(Workspace=w,LogName='EnergyRequest',LogText='20',LogType='Number Series') res=GetEiT0atSNS(w) diff --git a/docs/source/algorithms/LoadDetectorInfo-v1.rst b/docs/source/algorithms/LoadDetectorInfo-v1.rst index 43821a11e89..c2a8fde97e9 100644 --- a/docs/source/algorithms/LoadDetectorInfo-v1.rst +++ b/docs/source/algorithms/LoadDetectorInfo-v1.rst @@ -278,7 +278,7 @@ that the first three detectors (monitors) were not touched and the next three we import math import os - from mantid.kernel import OptionalBoolValue + # printing procedure def write_detectors(instr_type,instr,ndet): ''' print first ndet detectors from given instrument ''' @@ -362,7 +362,7 @@ that the first three detectors (monitors) were not touched and the next three we ws=CreateSampleWorkspace(); #-------------------------------------------------------------------------------------- # load MARI - det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=OptionalBoolValue.True) + det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=True) inst1=ws.getInstrument(); # write_detectors('unCalibrated',inst1,10); diff --git a/docs/source/algorithms/LoadInstrument-v1.rst b/docs/source/algorithms/LoadInstrument-v1.rst index 00901f0631e..61a79257a76 100644 --- a/docs/source/algorithms/LoadInstrument-v1.rst +++ b/docs/source/algorithms/LoadInstrument-v1.rst @@ -32,7 +32,7 @@ Usage **Example - Load instrument to a workspace:** .. testcode:: exLoadInstrument - from mantid.kernel import OptionalBoolValue + # create sample workspace ws=CreateSampleWorkspace(); inst0=ws.getInstrument(); @@ -40,7 +40,7 @@ Usage print "Default workspace has instrument: {0} with {1} parameters".format(inst0.getName(),len(inst0.getParameterNames())); # load MARI - det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=OptionalBoolValue.True) + det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=True) inst1=ws.getInstrument(); print "Modified workspace has instrument: {0} with {1} parameters".format(inst1.getName(),len(inst1.getParameterNames())); diff --git a/docs/source/algorithms/LoadMappingTable-v1.rst b/docs/source/algorithms/LoadMappingTable-v1.rst index fed7624c639..694ade0b836 100644 --- a/docs/source/algorithms/LoadMappingTable-v1.rst +++ b/docs/source/algorithms/LoadMappingTable-v1.rst @@ -26,11 +26,11 @@ Usage ----- .. testcode:: - from mantid.kernel import OptionalBoolValue + # Create a workspace ws = CreateSampleWorkspace() # Replace the instrument in the workspace with HRPD - LoadInstrument(ws,InstrumentName='HRPD', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws,InstrumentName='HRPD', RewriteSpectraMap=True) # Map spectra to detectors according to an HRPD raw file. LoadMappingTable('HRP39180.RAW',ws) diff --git a/docs/source/algorithms/MuscatFunc-v1.rst b/docs/source/algorithms/MuscatFunc-v1.rst index 8359ea21b52..3c0bd184bd6 100644 --- a/docs/source/algorithms/MuscatFunc-v1.rst +++ b/docs/source/algorithms/MuscatFunc-v1.rst @@ -27,7 +27,7 @@ Usage **Example - a basic example using MuscatFunc.** .. code-block:: python - from mantid.kernel import OptionalBoolValue + def createSampleWorkspace(name, random=False): """ Creates a sample workspace with a single lorentzian that looks like IRIS data""" import os @@ -38,7 +38,7 @@ Usage ws = ScaleX(ws, 0.1, "Multiply") #load instrument and instrument parameters - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) path = os.path.join(config['instrumentDefinition.directory'], 'IRIS_graphite_002_Parameters.xml') LoadParameterFile(ws, Filename=path) ws = RenameWorkspace(ws, OutputWorkspace=name) diff --git a/docs/source/algorithms/OSIRISDiffractionReduction-v1.rst b/docs/source/algorithms/OSIRISDiffractionReduction-v1.rst index 71bb84310f9..c4f35a77b45 100644 --- a/docs/source/algorithms/OSIRISDiffractionReduction-v1.rst +++ b/docs/source/algorithms/OSIRISDiffractionReduction-v1.rst @@ -24,7 +24,7 @@ Usage .. testcode:: ExOSIRISDiffractionReductionSimple import os - from mantid.kernel import OptionalBoolValue + def createDummyOSIRISWorkspace(name, func, xmin, xmax, bin_width): """Creates a workspace that looks something like an OSIRIS diffraction run""" #create workspace according to function @@ -33,7 +33,7 @@ Usage AddSampleLog(ws, 'gd_prtn_chrg', '30.01270866394043', 'Number') #load instrument parameters - LoadInstrument(ws, RewriteSpectraMap=OptionalBoolValue.True, InstrumentName='OSIRIS') + LoadInstrument(ws, RewriteSpectraMap=True, InstrumentName='OSIRIS') param_file = config['instrumentDefinition.directory'] + 'OSIRIS_diffraction_diffspec_Parameters.xml' LoadParameterFile(ws, Filename=param_file) return ws diff --git a/docs/source/algorithms/PoldiFitPeaks1D-v1.rst b/docs/source/algorithms/PoldiFitPeaks1D-v1.rst index 9d8cb3979dd..17fa903a2fa 100644 --- a/docs/source/algorithms/PoldiFitPeaks1D-v1.rst +++ b/docs/source/algorithms/PoldiFitPeaks1D-v1.rst @@ -35,7 +35,7 @@ The following small usage example performs a peak fit on the sample data already # Load data file and instrument, perform correlation analysis raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI") - LoadInstrument(raw_6904, InstrumentName = "POLDI") + LoadInstrument(raw_6904, InstrumentName = "POLDI", RewriteSpectraMap=True) correlated_6904 = PoldiAutoCorrelation(raw_6904) # Run peak search algorithm, store peaks in TableWorkspace diff --git a/docs/source/algorithms/PoldiMerge-v1.rst b/docs/source/algorithms/PoldiMerge-v1.rst index 53f55bae9aa..36d7d30ad23 100644 --- a/docs/source/algorithms/PoldiMerge-v1.rst +++ b/docs/source/algorithms/PoldiMerge-v1.rst @@ -33,10 +33,10 @@ Usage This small usage example merges two compatible POLDI-files which have been loaded before. .. testcode:: ExMergeSilicon - from mantid.kernel import OptionalBoolValue + # Load the first data file and the correct instrument raw_6903 = LoadSINQFile(Filename = "poldi2013n006903.hdf", Instrument = "POLDI") - LoadInstrument(raw_6903, RewriteSpectraMap=OptionalBoolValue.True, InstrumentName = "POLDI") + LoadInstrument(raw_6903, RewriteSpectraMap=True, InstrumentName = "POLDI") # Use Integration and SumSpectra to sum all counts in the spectrum. # The data must be converted to histogram data for Integration to work. @@ -50,7 +50,7 @@ This small usage example merges two compatible POLDI-files which have been loade # The same with the second data file raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI") - LoadInstrument(raw_6904, RewriteSpectraMap=OptionalBoolValue.True, InstrumentName = "POLDI") + LoadInstrument(raw_6904, RewriteSpectraMap=True, InstrumentName = "POLDI") histo_6904 = ConvertToHistogram(raw_6904) spectra_6904 = Integration(histo_6904) total_6904 = SumSpectra(spectra_6904) diff --git a/docs/source/algorithms/PoldiPeakSearch-v1.rst b/docs/source/algorithms/PoldiPeakSearch-v1.rst index 7354c312015..04dcbd74364 100644 --- a/docs/source/algorithms/PoldiPeakSearch-v1.rst +++ b/docs/source/algorithms/PoldiPeakSearch-v1.rst @@ -60,10 +60,10 @@ Usage A typical peak search procedure would be performed on correlation data, so this analysis is performed first, followed by a peak search with default parameters. .. testcode:: ExSiliconPeakSearch - from mantid.kernel import OptionalBoolValue + # Load data file and instrument, perform correlation analysis raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI") - LoadInstrument(raw_6904, RewriteSpectraMap=OptionalBoolValue.True, InstrumentName = "POLDI") + LoadInstrument(raw_6904, RewriteSpectraMap=True, InstrumentName = "POLDI") correlated_6904 = PoldiAutoCorrelation(raw_6904) # Run peak search algorithm, store peaks in TableWorkspace diff --git a/docs/source/algorithms/PoldiPeakSummary-v1.rst b/docs/source/algorithms/PoldiPeakSummary-v1.rst index 964a081de2e..c7443537cca 100644 --- a/docs/source/algorithms/PoldiPeakSummary-v1.rst +++ b/docs/source/algorithms/PoldiPeakSummary-v1.rst @@ -21,10 +21,10 @@ Usage **Example - PoldiPeakSummary** .. testcode:: PoldiPeakSummaryExample - from mantid.kernel import OptionalBoolValue + # Load data file and instrument, perform correlation analysis raw_6904 = LoadSINQFile(Filename = "poldi2013n006904.hdf", Instrument = "POLDI") - LoadInstrument(raw_6904, RewriteSpectraMap=OptionalBoolValue.True, InstrumentName = "POLDI") + LoadInstrument(raw_6904, RewriteSpectraMap=True, InstrumentName = "POLDI") correlated_6904 = PoldiAutoCorrelation(raw_6904) # Run peak search algorithm, store peaks in TableWorkspace diff --git a/docs/source/algorithms/PoldiTruncateData-v1.rst b/docs/source/algorithms/PoldiTruncateData-v1.rst index 346537dd56b..70f01138bbf 100644 --- a/docs/source/algorithms/PoldiTruncateData-v1.rst +++ b/docs/source/algorithms/PoldiTruncateData-v1.rst @@ -28,10 +28,10 @@ Usage In the first example, POLDI data is cropped to the correct workspace size: .. testcode:: PoldiTruncateDataCrop - from mantid.kernel import OptionalBoolValue + # Load data and instrument - this is important, as the chopper configuration must be known. raw_6903 = LoadSINQFile(Filename = "poldi2013n006903.hdf", Instrument = "POLDI") - LoadInstrument(raw_6903, InstrumentName = "POLDI", RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(raw_6903, InstrumentName = "POLDI", RewriteSpectraMap=True) print "The raw data workspace contains", len(raw_6903.readX(0)), "time bins." diff --git a/docs/source/algorithms/QLines-v1.rst b/docs/source/algorithms/QLines-v1.rst index c5350c5c84f..c304761f3cc 100644 --- a/docs/source/algorithms/QLines-v1.rst +++ b/docs/source/algorithms/QLines-v1.rst @@ -43,7 +43,7 @@ Usage **Example - a basic example using QLines to fit a reduced workspace.** .. code-block:: python - from mantid.kernel import OptionalBoolValue + def createSampleWorkspace(name, random=False): """ Creates a sample workspace with a single lorentzian that looks like IRIS data""" import os @@ -54,7 +54,7 @@ Usage ws = ScaleX(ws, 0.1, "Multiply") #load instrument and instrument parameters - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) path = os.path.join(config['instrumentDefinition.directory'], 'IRIS_graphite_002_Parameters.xml') LoadParameterFile(ws, Filename=path) ws = RenameWorkspace(ws, OutputWorkspace=name) diff --git a/docs/source/algorithms/ResNorm-v1.rst b/docs/source/algorithms/ResNorm-v1.rst index 86b3c9c1e54..f611b50a596 100644 --- a/docs/source/algorithms/ResNorm-v1.rst +++ b/docs/source/algorithms/ResNorm-v1.rst @@ -22,7 +22,7 @@ Usage **Example - a basic example using ResNorm.** .. code-block:: python - from mantid.kernel import OptionalBoolValue + def createSampleWorkspace(name, random=False): """ Creates a sample workspace with a single lorentzian that looks like IRIS data""" import os @@ -33,7 +33,7 @@ Usage ws = ScaleX(ws, 0.1, "Multiply") #load instrument and instrument parameters - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) path = os.path.join(config['instrumentDefinition.directory'], 'IRIS_graphite_002_Parameters.xml') LoadParameterFile(ws, Filename=path) ws = RenameWorkspace(ws, OutputWorkspace=name) diff --git a/docs/source/algorithms/ResNorm-v2.rst b/docs/source/algorithms/ResNorm-v2.rst index c9dad8a8bbd..baa4ed715c2 100644 --- a/docs/source/algorithms/ResNorm-v2.rst +++ b/docs/source/algorithms/ResNorm-v2.rst @@ -27,7 +27,7 @@ Usage **Example - a basic example using ResNorm.** .. testcode:: ExIRISResNorm - from mantid.kernel import OptionalBoolValue + def createSampleWorkspace(name, num_spec=10, random=False): """ Creates a sample workspace with a single lorentzian that looks like IRIS data @@ -54,7 +54,7 @@ Usage ws = ScaleX(ws, 0.1, "Multiply") # Load instrument and instrument parameters - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) path = os.path.join(config['instrumentDefinition.directory'], 'IRIS_graphite_002_Parameters.xml') LoadParameterFile(ws, Filename=path) ws = RenameWorkspace(ws, OutputWorkspace=name) diff --git a/docs/source/algorithms/SANSBeamFluxCorrection-v1.rst b/docs/source/algorithms/SANSBeamFluxCorrection-v1.rst index 55e5b349a6c..85cf7b277f7 100644 --- a/docs/source/algorithms/SANSBeamFluxCorrection-v1.rst +++ b/docs/source/algorithms/SANSBeamFluxCorrection-v1.rst @@ -25,12 +25,12 @@ Usage **Example - Performing a Beam Flux Correction on Dummy Data** .. testcode:: ExTable - from mantid.kernel import OptionalBoolValue + # Create some dummy data, as well as a dummy monitor ws for EQSANS. x = [1,2,3,4,5,6,7,8,9,10,11] y = 491520*[0.1] ws = CreateWorkspace(DataX=x,DataY=y,DataE=y,NSpec='49152',UnitX='Wavelength') - LoadInstrument(ws, InstrumentName="EQSANS", RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName="EQSANS", RewriteSpectraMap=True) monitor = SumSpectra(ws) # Do the correction, dragging in the file which contains the reference flux spectrum. diff --git a/docs/source/algorithms/SofQWMoments-v1.rst b/docs/source/algorithms/SofQWMoments-v1.rst index 463e84b53fc..a1854bd96ae 100644 --- a/docs/source/algorithms/SofQWMoments-v1.rst +++ b/docs/source/algorithms/SofQWMoments-v1.rst @@ -24,14 +24,14 @@ Usage **Example - Running SofQWMoments from with an SofQW workspace.** .. testcode:: ExSofQWMomentsSimple - from mantid.kernel import OptionalBoolValue + #create a dummy workspace function = "name=Lorentzian,Amplitude=1,PeakCentre=5,FWHM=1" ws = CreateSampleWorkspace("Histogram", Function="User Defined", UserDefinedFunction=function, XMin=0, XMax=10, BinWidth=0.01, XUnit="DeltaE") ws = ScaleX(ws, -5, "Add") #shift to center on 0 ws = ScaleX(ws, 0.1) #scale to size ws = RenameWorkspace(ws, OutputWorkspace="irs21760_graphite002_red") - LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=OptionalBoolValue.True) + LoadInstrument(ws, InstrumentName='IRIS', RewriteSpectraMap=True) #Run SofQW and then SofQWMoments ws = SofQW(ws, '0.4, 0.1, 1.8', EMode='Indirect', EFixed='1.845', OutputWorkspace="irs00001_graphite002_red") diff --git a/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst b/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst index 34c7f3527a8..aaf7babcb7d 100644 --- a/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst +++ b/docs/source/algorithms/UpdateInstrumentFromFile-v1.rst @@ -74,7 +74,7 @@ Usage **Example - Update Instrument:** .. testcode:: exUpdateInstrumentFromFile - from mantid.kernel import OptionalBoolValue + import math import os # priting procedure @@ -100,7 +100,7 @@ Usage ws=CreateSampleWorkspace(); #-------------------------------------------------------------------------------------- # load MARI - det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=OptionalBoolValue.True) + det=LoadInstrument(ws,InstrumentName='MARI', RewriteSpectraMap=True) inst1=ws.getInstrument(); # print_10_detectors('unCalibrated',inst1); -- GitLab