Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
a18d243f
Commit
a18d243f
authored
9 years ago
by
Raquel Alvarez Banos
Browse files
Options
Downloads
Patches
Plain Diff
Re #13968 Test algorithm when spectrum list is supplied
parent
92224e69
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/Algorithms/test/RemoveExpDecayTest.h
+43
-4
43 additions, 4 deletions
Framework/Algorithms/test/RemoveExpDecayTest.h
with
43 additions
and
4 deletions
Framework/Algorithms/test/RemoveExpDecayTest.h
+
43
−
4
View file @
a18d243f
...
@@ -26,23 +26,22 @@ public:
...
@@ -26,23 +26,22 @@ public:
TS_ASSERT
(
alg
->
isInitialized
())
TS_ASSERT
(
alg
->
isInitialized
())
}
}
void
testExecute
()
{
void
test
_
Execute
()
{
auto
ws
=
createWorkspace
(
4
,
50
);
auto
ws
=
createWorkspace
(
1
,
50
);
IAlgorithm_sptr
alg
=
AlgorithmManager
::
Instance
().
create
(
"RemoveExpDecay"
);
IAlgorithm_sptr
alg
=
AlgorithmManager
::
Instance
().
create
(
"RemoveExpDecay"
);
alg
->
initialize
();
alg
->
initialize
();
alg
->
setChild
(
true
);
alg
->
setChild
(
true
);
alg
->
setProperty
(
"InputWorkspace"
,
ws
);
alg
->
setProperty
(
"InputWorkspace"
,
ws
);
alg
->
setPropertyValue
(
"OutputWorkspace"
,
outputName
);
alg
->
setPropertyValue
(
"OutputWorkspace"
,
outputName
);
alg
->
setPropertyValue
(
"Spectra"
,
"0"
);
TS_ASSERT_THROWS_NOTHING
(
alg
->
execute
());
TS_ASSERT_THROWS_NOTHING
(
alg
->
execute
());
TS_ASSERT
(
alg
->
isExecuted
());
TS_ASSERT
(
alg
->
isExecuted
());
MatrixWorkspace_sptr
outWS
=
alg
->
getProperty
(
"OutputWorkspace"
);
MatrixWorkspace_sptr
outWS
=
alg
->
getProperty
(
"OutputWorkspace"
);
}
}
void
test_
Two
Spectr
a
()
{
void
test_
Empty
Spectr
umList
()
{
auto
ws
=
createWorkspace
(
2
,
50
);
auto
ws
=
createWorkspace
(
2
,
50
);
...
@@ -85,6 +84,46 @@ public:
...
@@ -85,6 +84,46 @@ public:
TS_ASSERT_DELTA
(
outWS
->
readE
(
1
)[
49
],
0.0078
,
0.0001
);
TS_ASSERT_DELTA
(
outWS
->
readE
(
1
)[
49
],
0.0078
,
0.0001
);
}
}
void
test_SpectrumList
()
{
auto
ws
=
createWorkspace
(
2
,
50
);
// First, run the algorithm without specifying any spectrum
IAlgorithm_sptr
alg1
=
AlgorithmManager
::
Instance
().
create
(
"RemoveExpDecay"
);
alg1
->
initialize
();
alg1
->
setChild
(
true
);
alg1
->
setProperty
(
"InputWorkspace"
,
ws
);
alg1
->
setPropertyValue
(
"OutputWorkspace"
,
outputName
);
TS_ASSERT_THROWS_NOTHING
(
alg1
->
execute
());
TS_ASSERT
(
alg1
->
isExecuted
());
MatrixWorkspace_sptr
out1
=
alg1
->
getProperty
(
"OutputWorkspace"
);
// Then run the algorithm on the second spectrum only
IAlgorithm_sptr
alg2
=
AlgorithmManager
::
Instance
().
create
(
"RemoveExpDecay"
);
alg2
->
initialize
();
alg2
->
setChild
(
true
);
alg2
->
setProperty
(
"InputWorkspace"
,
ws
);
alg2
->
setPropertyValue
(
"OutputWorkspace"
,
outputName
);
alg2
->
setPropertyValue
(
"Spectra"
,
"1"
);
TS_ASSERT_THROWS_NOTHING
(
alg2
->
execute
());
TS_ASSERT
(
alg2
->
isExecuted
());
MatrixWorkspace_sptr
out2
=
alg2
->
getProperty
(
"OutputWorkspace"
);
// Both output workspaces should have 2 spectra
TS_ASSERT_EQUALS
(
out1
->
getNumberHistograms
(),
ws
->
getNumberHistograms
());
TS_ASSERT_EQUALS
(
out2
->
getNumberHistograms
(),
ws
->
getNumberHistograms
());
// Compare results, they should match for the selected spectrum
TS_ASSERT_EQUALS
(
out1
->
readX
(
1
),
out2
->
readX
(
1
));
TS_ASSERT_EQUALS
(
out1
->
readY
(
1
),
out2
->
readY
(
1
));
TS_ASSERT_EQUALS
(
out1
->
readE
(
1
),
out2
->
readE
(
1
));
// Compare non-selected spectra, the should match the input ones
TS_ASSERT_EQUALS
(
ws
->
readX
(
0
),
out2
->
readX
(
0
));
TS_ASSERT_EQUALS
(
ws
->
readY
(
0
),
out2
->
readY
(
0
));
TS_ASSERT_EQUALS
(
ws
->
readE
(
0
),
out2
->
readE
(
0
));
}
void
test_yUnitLabel
()
{
void
test_yUnitLabel
()
{
auto
ws
=
createWorkspace
(
4
,
50
);
auto
ws
=
createWorkspace
(
4
,
50
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment