本文整理汇总了Python中testhelpers.run_algorithm函数的典型用法代码示例。如果您正苦于以下问题:Python run_algorithm函数的具体用法?Python run_algorithm怎么用?Python run_algorithm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_algorithm函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_profileCoeffsNotSavedWhenNotRefined
def test_profileCoeffsNotSavedWhenNotRefined(self):
run_algorithm(self.ALG_NAME,
**self.defaultAlgParams)
with h5py.File(self.TEMP_FILE_NAME, "r") as output_file:
fit_results_group = output_file["Bank 1"]["GSAS-II Fitting"]
self.assertFalse("Profile Coefficients" in fit_results_group)
开发者ID:mantidproject,项目名称:mantid,代码行数:7,代码来源:EnggSaveGSASIIFitResultsToHDF5Test.py
示例2: test_LoadWavelength
def test_LoadWavelength(self):
outputWorkspaceName = "LoadDNSLegacyTest_Test8"
filename = "dn134011vana.d_dat"
alg_test = run_algorithm("LoadDNSLegacy", Filename=filename, Normalization='no',
OutputWorkspace=outputWorkspaceName, CoilCurrentsTable=self.curtable,
Wavelength=5.7)
self.assertTrue(alg_test.isExecuted())
# Verify some values
ws = AnalysisDataService.retrieve(outputWorkspaceName)
# dimensions
self.assertEqual(24, ws.getNumberHistograms())
self.assertEqual(2, ws.getNumDims())
# data array
self.assertEqual(31461, ws.readY(1))
self.assertEqual(13340, ws.readY(23))
self.assertAlmostEqual(5.7, ws.readX(1)[0], 3)
self.assertAlmostEqual(5.7, ws.readX(23)[0], 3)
# sample logs
run = ws.getRun()
self.assertEqual(5.7, run.getProperty('wavelength').value)
self.assertAlmostEqual(2.51782, run.getProperty('Ei').value, 3)
run_algorithm("DeleteWorkspace", Workspace=outputWorkspaceName)
return
开发者ID:mantidproject,项目名称:mantid,代码行数:25,代码来源:LoadDNSLegacyTest.py
示例3: test_TwoTheta
def test_TwoTheta(self):
# check whether the 2theta angles the same as in the data workspace
outputWorkspaceName = "DNSDetCorrVanaTest_Test5"
# rotate detector bank to different angles
api.LoadInstrument(self.__dataws, InstrumentName='DNS')
api.LoadInstrument(self.__vanaws, InstrumentName='DNS')
api.LoadInstrument(self.__bkgrws, InstrumentName='DNS')
api.RotateInstrumentComponent(self.__dataws, "bank0", X=0, Y=1, Z=0, Angle=-7.53)
api.RotateInstrumentComponent(self.__vanaws, "bank0", X=0, Y=1, Z=0, Angle=-8.02)
api.RotateInstrumentComponent(self.__bkgrws, "bank0", X=0, Y=1, Z=0, Angle=-8.54)
# run correction
alg_test = run_algorithm("DNSDetEffCorrVana", InputWorkspace=self.__dataws.getName(),
OutputWorkspace=outputWorkspaceName, VanaWorkspace=self.__vanaws.getName(),
BkgWorkspace=self.__bkgrws.getName())
self.assertTrue(alg_test.isExecuted())
# check dimensions and angles
ws = AnalysisDataService.retrieve(outputWorkspaceName)
# dimensions
self.assertEqual(24, ws.getNumberHistograms())
self.assertEqual(2, ws.getNumDims())
# angles
tthetas = np.array([7.53 + i*5 for i in range(24)])
for i in range(24):
det = ws.getDetector(i)
self.assertAlmostEqual(tthetas[i], np.degrees(ws.detectorSignedTwoTheta(det)))
run_algorithm("DeleteWorkspace", Workspace=outputWorkspaceName)
return
开发者ID:stothe2,项目名称:mantid,代码行数:29,代码来源:DNSDetEffCorrVanaTest.py
示例4: test_LoadPartiallyValidFilesMultipleLogValues
def test_LoadPartiallyValidFilesMultipleLogValues(self):
outputWorskapceName = "LoadLogPropertyTableTest_Test2"
alg_test = run_algorithm(
"LoadLogPropertyTable",
FirstFile="emu00006473.nxs",
LastFile="emu00006475.nxs",
LogNames="Temp_Sample,dur",
OutputWorkspace=outputWorskapceName,
)
self.assertTrue(alg_test.isExecuted())
# Verify some values
tablews = AnalysisDataService.retrieve(outputWorskapceName)
self.assertEqual(2, tablews.rowCount())
self.assertEqual(3, tablews.columnCount())
self.assertEqual(6473, tablews.cell(0, 0))
self.assertAlmostEqual(200.078, tablews.cell(0, 1), 2)
self.assertEqual("8697", tablews.cell(0, 2))
self.assertEqual(6475, tablews.cell(1, 0))
self.assertAlmostEqual(283.523, tablews.cell(1, 1), 2)
self.assertEqual("5647", tablews.cell(1, 2))
run_algorithm("DeleteWorkspace", Workspace=outputWorskapceName)
return
开发者ID:spaceyatom,项目名称:mantid,代码行数:28,代码来源:LoadLogPropertyTableTest.py
示例5: test_setTitle
def test_setTitle(self):
run_algorithm('CreateWorkspace', OutputWorkspace='ws1',DataX=[1.,2.,3.], DataY=[2.,3.], DataE=[2.,3.],UnitX='TOF')
ws1 = AnalysisDataService['ws1']
title = 'test_title'
ws1.setTitle(title)
self.assertEquals(title, ws1.getTitle())
AnalysisDataService.remove(ws1.getName())
开发者ID:trnielsen,项目名称:mantid,代码行数:7,代码来源:MatrixWorkspaceTest.py
示例6: test_LoadValidFilesComments
def test_LoadValidFilesComments(self):
outputWorskapceName = "LoadLogPropertyTableTest_Test1"
alg_test = run_algorithm(
"LoadLogPropertyTable",
FirstFile="MUSR00015189.nxs",
LastFile="MUSR00015193.nxs",
LogNames="comment",
OutputWorkspace=outputWorskapceName,
)
self.assertTrue(alg_test.isExecuted())
# Verify some values
tablews = AnalysisDataService.retrieve(outputWorskapceName)
self.assertEqual(5, tablews.rowCount())
self.assertEqual(2, tablews.columnCount())
self.assertEqual("18.95MHz 100W", tablews.cell(0, 1))
self.assertEqual(15189, tablews.cell(0, 0))
self.assertEqual(15193, tablews.cell(4, 0))
run_algorithm("DeleteWorkspace", Workspace=outputWorskapceName)
return
开发者ID:spaceyatom,项目名称:mantid,代码行数:25,代码来源:LoadLogPropertyTableTest.py
示例7: test_ChildAlg_call_with_output_and_input_ws_the_same_succeeds
def test_ChildAlg_call_with_output_and_input_ws_the_same_succeeds(self):
data = [1.0]
api.CreateWorkspace(DataX=data,DataY=data,NSpec=1,UnitX='Wavelength', OutputWorkspace=self._ws_name)
try:
run_algorithm('PythonAlgorithmChildAlgCallTestAlg', InputWorkspace=self._ws_name, OutputWorkspace=self._ws_name)
except Exception,exc:
self.fail("Algorithm call failed: %s" % str(exc))
开发者ID:trnielsen,项目名称:mantid,代码行数:7,代码来源:PythonAlgorithmChildAlgCallTest.py
示例8: testZeroMasking
def testZeroMasking(self):
ws = self._cloneTestWorkspace()
zeroIndices = [5, 23]
for i in zeroIndices:
ws.dataY(i).fill(0.)
eppWSName = 'eppWS'
self._EPPTable(ws, eppWSName)
outWSName = 'outWS'
algProperties = {
'InputWorkspace': self._TEST_WS_NAME,
'OutputWorkspace': outWSName,
'EPPWorkspace': eppWSName,
'rethrow': True
}
run_algorithm('DirectILLIntegrateVanadium', **algProperties)
self.assertTrue(mtd.doesExist(outWSName))
outWS = mtd[outWSName]
self.assertEquals(outWS.getNumberHistograms(), ws.getNumberHistograms())
self.assertEquals(outWS.blocksize(), 1)
spectrumInfo = outWS.spectrumInfo()
for i in range(outWS.getNumberHistograms()):
if i in zeroIndices:
self.assertEquals(outWS.readY(i)[0], 0.)
self.assertTrue(spectrumInfo.isMasked(i))
else:
self.assertGreater(outWS.readY(i)[0], 0.)
self.assertFalse(spectrumInfo.isMasked(i))
开发者ID:mantidproject,项目名称:mantid,代码行数:27,代码来源:DirectILLIntegrateVanadiumTest.py
示例9: test_updateDouble
def test_updateDouble(self):
""" Test for update a double value
"""
# tablews = self.create_TableWorkspace()
alg_init = run_algorithm("CreateEmptyTableWorkspace", OutputWorkspace="TestTableWorkspace")
self.assertTrue(alg_init.isExecuted())
tablews = AnalysisDataService.retrieve("TestTableWorkspace")
tablews.addColumn("str", "Name")
tablews.addColumn("double", "Value")
tablews.addColumn("str", "FitOrTie")
tablews.addRow(["A", 1.34, "Fit"])
tablews.addRow(["B", 2.34, "Tie"])
tablews.addRow(["S", 3.34, "Tie"])
alg_test = run_algorithm("UpdatePeakParameterTableValue", InputWorkspace=alg_init.getPropertyValue("OutputWorkspace"),
Column="Value", ParameterNames=["A"], NewFloatValue=1.00)
self.assertTrue(alg_test.isExecuted())
newvalue_A = tablews.cell(0, 1)
self.assertEqual(newvalue_A, 1.00)
return
开发者ID:AlistairMills,项目名称:mantid,代码行数:28,代码来源:UpdatePeakParameterTableValueTest.py
示例10: testSuccessWhenEverythingDisabled
def testSuccessWhenEverythingDisabled(self):
outWSName = 'outWS'
algProperties = {
'InputWorkspace': self._TEST_WS_NAME,
'OutputWorkspace': outWSName,
'FlatBkg': 'Flat Bkg OFF',
'IncidentEnergyCalibration': 'Energy Calibration OFF',
'Normalisation': 'Normalisation OFF',
'ElasticChannel': 'Default Elastic Channel',
'rethrow': True
}
run_algorithm('DirectILLCollectData', **algProperties)
self.assertTrue(mtd.doesExist(outWSName))
outWS = mtd[outWSName]
inWS = mtd[self._TEST_WS_NAME]
self.assertEquals(outWS.getNumberHistograms(), inWS.getNumberHistograms() - 1)
xs = outWS.extractX()
originalXs = inWS.extractX()
numpy.testing.assert_almost_equal(xs, originalXs[1:, :])
ys = outWS.extractY()
originalYs = inWS.extractY()
numpy.testing.assert_almost_equal(ys, originalYs[1:, :])
es = outWS.extractE()
originalEs = inWS.extractE()
numpy.testing.assert_almost_equal(es, originalEs[1:, :])
开发者ID:DanNixon,项目名称:mantid,代码行数:25,代码来源:DirectILLCollectDataTest.py
示例11: test_save_one_histogram
def test_save_one_histogram(self):
""" Test to Save one histogram
"""
datawsname = "TestOneHistogram"
E, I, err = self._createOneHistogram(datawsname)
# Execute
out_path = "tempout_hist.json"
alg_test = run_algorithm(
"SavePlot1DAsJson",
InputWorkspace = datawsname,
JsonFilename = out_path)
# Executed?
self.assertTrue(alg_test.isExecuted())
# Verify ....
d = json.load(open(out_path))
d0 = d[datawsname+'0'] # plots are numbered
np.testing.assert_array_equal(d0['x'], E)
np.testing.assert_array_equal(d0['y'], I)
np.testing.assert_array_equal(d0['e'], err)
# test overwrite
alg_test = run_algorithm(
"SavePlot1DAsJson",
InputWorkspace = datawsname,
JsonFilename = out_path)
# Delete the output file
os.remove(out_path)
return
开发者ID:stothe2,项目名称:mantid,代码行数:28,代码来源:SavePlot1DAsJsonTest.py
示例12: test_LoadTOF
def test_LoadTOF(self):
outputWorkspaceName = "LoadDNSLegacyTest_Test7"
filename = "dnstof.d_dat"
tof1 = 424.668 # must be changed if L1 will change
alg_test = run_algorithm("LoadDNSLegacy", Filename=filename, Normalization='no',
OutputWorkspace=outputWorkspaceName)
self.assertTrue(alg_test.isExecuted())
# Verify some values
ws = AnalysisDataService.retrieve(outputWorkspaceName)
# dimensions
self.assertEqual(24, ws.getNumberHistograms())
self.assertEqual(100, ws.getNumberBins())
# data array
self.assertEqual(8, ws.readY(19)[37]) # must be changed after comissioning will be finished
self.assertAlmostEqual(tof1, ws.readX(0)[0], 3)
self.assertAlmostEqual(tof1+40.1*100, ws.readX(0)[100], 3)
# sample logs
run = ws.getRun()
self.assertEqual(-7.5, run.getProperty('deterota').value)
self.assertEqual(100, run.getProperty('tof_channels').value)
self.assertEqual(51428, run.getProperty('mon_sum').value)
self.assertEqual('z', run.getProperty('polarisation').value)
self.assertEqual(33, run.getProperty('EPP').value) # check that EPP is taken from file
self.assertEqual('7', str(run.getProperty('polarisation_comment').value))
self.assertEqual('no', run.getProperty('normalized').value)
# check whether detector bank is rotated
det = ws.getDetector(0)
self.assertAlmostEqual(7.5, ws.detectorSignedTwoTheta(det)*180/pi)
run_algorithm("DeleteWorkspace", Workspace=outputWorkspaceName)
return
开发者ID:DanNixon,项目名称:mantid,代码行数:31,代码来源:LoadDNSLegacyTest.py
示例13: testDetectorGroupingWithUserGivenAngleStep
def testDetectorGroupingWithUserGivenAngleStep(self):
ws = illhelpers.create_poor_mans_in5_workspace(0.0, _groupingTestDetectors)
nhisto = ws.getNumberHistograms()
spectrumInfo = ws.spectrumInfo()
minAngle = 180.
maxAngle = 0.
for i in range(nhisto):
angle = numpy.rad2deg(spectrumInfo.twoTheta(i))
minAngle = min(minAngle, angle)
maxAngle = max(maxAngle, angle)
mtd.addOrReplace('inWS', ws)
outWSName = 'unused'
outSThetaWName = 'SofThetaW'
angleStep = 0.2
algProperties = {
'InputWorkspace': ws,
'OutputWorkspace': outWSName,
'GroupingAngleStep': angleStep,
'OutputSofThetaEnergyWorkspace': outSThetaWName,
'Transposing': 'Transposing OFF',
'rethrow': True
}
run_algorithm('DirectILLReduction', **algProperties)
self.assertTrue(outSThetaWName in mtd)
SThetaWWS = mtd[outSThetaWName]
spectrumInfo = SThetaWWS.spectrumInfo()
firstAngleBin = int(minAngle / angleStep)
lastAngleBin = int(maxAngle / angleStep) + 1
expected = lastAngleBin - firstAngleBin
self.assertEqual(spectrumInfo.size(), expected)
开发者ID:mantidproject,项目名称:mantid,代码行数:30,代码来源:DirectILLReductionTest.py
示例14: test_DNSMomentumTransfer
def test_DNSMomentumTransfer(self):
outputWorkspaceName = "DNSMergeRunsTest_Test4"
alg_test = run_algorithm("DNSMergeRuns", WorkspaceNames=self.workspaces,
OutputWorkspace=outputWorkspaceName, HorizontalAxis='|Q|')
self.assertTrue(alg_test.isExecuted())
# check whether the data are correct
ws = AnalysisDataService.retrieve(outputWorkspaceName)
# dimensions
self.assertEqual(96, ws.blocksize())
self.assertEqual(2, ws.getNumDims())
self.assertEqual(1, ws.getNumberHistograms())
# data array
# reference values
ttheta = np.round(np.radians(self.angles), 4)
qarr = np.sort(4.0*np.pi*np.sin(0.5*ttheta)/4.2)
# read the merged values
dataX = ws.extractX()[0]
for i in range(len(self.angles)):
self.assertAlmostEqual(qarr[i], dataX[i])
# check that the intensity has not been changed
dataY = ws.extractY()[0]
for i in range(len(dataY)):
self.assertAlmostEqual(1.0, dataY[i])
run_algorithm("DeleteWorkspace", Workspace=outputWorkspaceName)
return
开发者ID:dezed,项目名称:mantid,代码行数:26,代码来源:DNSMergeRunsTest.py
示例15: test_save_one_histogram
def test_save_one_histogram(self):
""" Test to Save one histogram
"""
datawsname = "TestOneHistogram"
E, I, err = self._createOneHistogram(datawsname)
# Execute
out_path = "tempout_hist.json"
alg_test = run_algorithm(
"SavePlot1DAsJson",
InputWorkspace = datawsname,
JsonFilename = out_path)
# Executed?
self.assertTrue(alg_test.isExecuted())
# Verify ....
d = json.load(open(out_path))[datawsname]
self._checkData(d, E, I, err)
# test overwrite
alg_test = run_algorithm(
"SavePlot1DAsJson",
InputWorkspace = datawsname,
JsonFilename = out_path)
# Delete the output file
os.remove(out_path)
return
开发者ID:liyulun,项目名称:mantid,代码行数:25,代码来源:SavePlot1DAsJsonTest.py
示例16: setUp
def setUp(self):
# Set up every time.
config['default.instrument'] = 'IRIS'
config["default.facility"] = "ISIS"
# Only set up once.
if not self.class_has_been_set_up:
class_has_been_set_up = True
# Create a workspace that is not a table workspace.
pre_existing_matrix_workspace_alg = run_algorithm(
"CreateWorkspace",
OutputWorkspace='matrix_ws',
DataX='0',
DataY='1')
self.__pre_existing_matrix_workspace_name = \
pre_existing_matrix_workspace_alg.getPropertyValue("OutputWorkspace")
# Create an empty table workspace.
table_workspace_alg = run_algorithm(
"CreateEmptyTableWorkspace",
OutputWorkspace='__empty_table')
self.__empty_table_workspace_name = \
table_workspace_alg.getPropertyValue("OutputWorkspace")
self.__existing_range_of_run_files = '21360, 26173, 38633'
self.__nonexistant_run_file = '99999'
开发者ID:trnielsen,项目名称:mantid,代码行数:27,代码来源:RetrieveRunInfoTest.py
示例17: setUp
def setUp(self):
if self.__class__._no_peak_ws == None:
# Create test workspace with no peaks
dataX = [0, 1]
dataY = [0]
dataE = [0]
nSpec = 1
no_peak_ws_alg = run_algorithm("CreateWorkspace", DataX=dataX, DataY=dataY, DataE=dataE, NSpec=nSpec, UnitX="Wavelength", VerticalAxisUnit="SpectraNumber", OutputWorkspace="no_peak_ws")
self.__class__._no_peak_ws = no_peak_ws_alg.getPropertyValue("OutputWorkspace")
# Create test workspace with a single peak
dataX = [0, 1, 0, 1, 0, 1] # Setup enough X values {0, 1} to create a histo workspace with a single bin.
dataY = [0, 1, 0] # One real peak
dataE = [0, 0, 0] # Errors are not considered in the algorithm
nSpec = 3
one_peak_ws_alg = run_algorithm("CreateWorkspace", DataX=dataX, DataY=dataY, DataE=dataE, NSpec=nSpec, UnitX="Wavelength", VerticalAxisUnit="SpectraNumber", OutputWorkspace="one_peak_ws")
self.__class__._one_peak_ws = one_peak_ws_alg.getPropertyValue("OutputWorkspace")
# Create test workspace with two peaks
dataX = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1] # Setup enough X values {0, 1} to create a histo workspace with a single bin.
dataY = [0.1, 1, 0.1, 0.2, 0.1, 2, 0.1] # Real peaks with values 1, 2, false peak with value 0.2
dataE = [0, 0, 0, 0, 0, 0, 0] # Errors are not considered in the algorithm
nSpec = 7
two_peak_ws_alg = run_algorithm("CreateWorkspace", DataX=dataX, DataY=dataY, DataE=dataE, NSpec=nSpec, UnitX="Wavelength", VerticalAxisUnit="SpectraNumber", OutputWorkspace="two_peak_ws")
self.__class__._two_peak_ws = two_peak_ws_alg.getPropertyValue("OutputWorkspace")
# Create test workspace with three peaks
dataX = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1] # Setup enough X values {0, 1} to create a histo workspace with a single bin.
dataY = [0, 1, 0, 1, 0, 1, 0, 1, 0] # 3 real peaks
dataE = [0, 0, 0, 0, 0, 0, 0, 0, 0] # Errors are not considered in the algorithm
nSpec = 9
three_peak_ws_alg = run_algorithm("CreateWorkspace", DataX=dataX, DataY=dataY, DataE=dataE, NSpec=nSpec, UnitX="Wavelength", VerticalAxisUnit="SpectraNumber", OutputWorkspace="three_peak_ws")
self.__class__._three_peak_ws = three_peak_ws_alg.getPropertyValue("OutputWorkspace")
开发者ID:DanNixon,项目名称:mantid,代码行数:33,代码来源:FindReflectometryLinesTest.py
示例18: test_Fit_works_with_multidomain_functions
def test_Fit_works_with_multidomain_functions(self):
x1 = np.arange(10)
y1 = np.empty(0)
y2 = np.empty(0)
y3 = np.empty(0)
for x in x1:
y1 = np.append(y1, 3)
y2 = np.append(y2, 2.9 + 3*x)
y3 = np.append(y3, 3.1 + 3*x*x)
x = np.concatenate((x1,x1,x1))
y = np.concatenate((y1,y2,y3))
data_name = 'dataWS'
run_algorithm('CreateWorkspace',OutputWorkspace=data_name,DataX=x, DataY=y,DataE=np.ones(30),NSpec=3,UnitX='TOF')
f1 = ';name=UserFunction,$domains=i,Formula=a+b*x+c*x^2'
func= 'composite=MultiDomainFunction,NumDeriv=1' + f1 + f1 + f1 + ';ties=(f2.a=f1.a=f0.a)'
output_name = "fitWS"
Fit(Function=func,InputWorkspace=data_name,WorkspaceIndex=0,Output=output_name,
InputWorkspace_1=data_name,WorkspaceIndex_1=1,InputWorkspace_2=data_name,WorkspaceIndex_2=2)
self.assertTrue(output_name + '_Parameters' in mtd)
params = mtd[output_name+'_Parameters']
self.assertEqual(params.rowCount(), 10)
self.assertAlmostEqual(params.row(0)['Value'], 3.0, 10)
self.assertAlmostEqual(params.row(3)['Value'], 3.0, 10)
self.assertAlmostEqual(params.row(6)['Value'], 3.0, 10)
self.assertAlmostEqual(params.row(4)['Value'], 3.0, 1)
self.assertAlmostEqual(params.row(8)['Value'], 3.0, 1)
开发者ID:mantidproject,项目名称:mantid,代码行数:33,代码来源:SimpleAPIFitTest.py
示例19: testRawWorkspaceOutput
def testRawWorkspaceOutput(self):
outWSName = 'outWS'
rawWSName = 'rawWS'
algProperties = {
'InputWorkspace': self._TEST_WS_NAME,
'OutputWorkspace': outWSName,
'OutputRawWorkspace': rawWSName,
'rethrow': True
}
run_algorithm('DirectILLCollectData', **algProperties)
self.assertTrue(mtd.doesExist(outWSName))
outWS = mtd[outWSName]
inWS = mtd[self._TEST_WS_NAME]
self.assertTrue(mtd.doesExist(rawWSName))
rawWS = mtd[rawWSName]
ys = rawWS.extractY()
originalYS = inWS.extractY()
numpy.testing.assert_almost_equal(ys, originalYS[1:, :])
es = rawWS.extractE()
originalES = inWS.extractE()
numpy.testing.assert_almost_equal(es, originalES[1:, :])
xs = rawWS.extractX()
outXS = outWS.extractX()
numpy.testing.assert_almost_equal(xs, outXS)
Ei = rawWS.getRun().getProperty('Ei').value
outEi = outWS.getRun().getProperty('Ei').value
self.assertEqual(Ei, outEi)
wavelength = outWS.getRun().getProperty('wavelength').value
outWavelength = outWS.getRun().getProperty('wavelength').value
self.assertEqual(wavelength, outWavelength)
开发者ID:DanNixon,项目名称:mantid,代码行数:30,代码来源:DirectILLCollectDataTest.py
示例20: testSelfShieldingCorrections
def testSelfShieldingCorrections(self):
ws = self._cloneTestWorkspace()
corrFactor = 0.789
corrWS = self._cloneTestWorkspace('correctionWS')
for i in range(corrWS.getNumberHistograms()):
ys = corrWS.dataY(i)
ys.fill(corrFactor)
es = corrWS.dataE(i)
es.fill(0)
outWSName = 'outWS'
algProperties = {
'InputWorkspace': self._TEST_WS_NAME,
'OutputWorkspace': outWSName,
'SelfShieldingCorrectionWorkspace': corrWS,
'rethrow': True
}
run_algorithm('DirectILLApplySelfShielding', **algProperties)
self.assertTrue(mtd.doesExist(outWSName))
outWS = mtd[outWSName]
self.assertEquals(outWS.getNumberHistograms(), ws.getNumberHistograms())
ys = outWS.extractY()
originalYs = ws.extractY()
numpy.testing.assert_almost_equal(ys, originalYs / corrFactor)
es = outWS.extractE()
originalEs = ws.extractE()
numpy.testing.assert_almost_equal(es, originalEs / corrFactor)
开发者ID:DanNixon,项目名称:mantid,代码行数:26,代码来源:DirectILLApplySelfShieldingTest.py
注:本文中的testhelpers.run_algorithm函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论