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
8bb7170c
Commit
8bb7170c
authored
9 years ago
by
Anton Piccardo-Selg
Browse files
Options
Downloads
Patches
Plain Diff
Refs #13314 Adapt unit test
parent
cbd783d1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Algorithms/src/Q1D2.cpp
+14
-4
14 additions, 4 deletions
Framework/Algorithms/src/Q1D2.cpp
Framework/Algorithms/test/Q1D2Test.h
+4
-0
4 additions, 0 deletions
Framework/Algorithms/test/Q1D2Test.h
with
18 additions
and
4 deletions
Framework/Algorithms/src/Q1D2.cpp
+
14
−
4
View file @
8bb7170c
...
...
@@ -133,9 +133,15 @@ void Q1D2::exec() {
MantidVec
normSum
(
YOut
.
size
(),
0.0
);
// the error on the normalisation
MantidVec
normError2
(
YOut
.
size
(),
0.0
);
// the averaged Q resolution
// the averaged Q resolution. We need the a named dummy variable although it
// won't be
// used since we only want to create a reference to DX if it is really
// required. Referencing
// DX sets a flag which might not be desirable.
MantidVec
dummy
;
MantidVec
&
qResolutionOut
=
useQResolution
?
outputWS
->
dataDx
(
0
)
:
MantidVec
(
);
useQResolution
?
outputWS
->
dataDx
(
0
)
:
outputWS
->
dataY
(
0
);
const
int
numSpec
=
static_cast
<
int
>
(
m_dataWS
->
getNumberHistograms
());
Progress
progress
(
this
,
0.05
,
1.0
,
numSpec
+
1
);
...
...
@@ -279,7 +285,9 @@ void Q1D2::exec() {
WorkspaceFactory
::
Instance
().
create
(
outputWS
);
ws_sumOfCounts
->
dataX
(
0
)
=
outputWS
->
dataX
(
0
);
ws_sumOfCounts
->
dataY
(
0
)
=
outputWS
->
dataY
(
0
);
ws_sumOfCounts
->
dataDx
(
0
)
=
outputWS
->
dataDx
(
0
);
if
(
useQResolution
)
{
ws_sumOfCounts
->
dataDx
(
0
)
=
outputWS
->
dataDx
(
0
);
}
for
(
size_t
i
=
0
;
i
<
outputWS
->
dataE
(
0
).
size
();
i
++
)
{
ws_sumOfCounts
->
dataE
(
0
)[
i
]
=
sqrt
(
outputWS
->
dataE
(
0
)[
i
]);
}
...
...
@@ -287,7 +295,9 @@ void Q1D2::exec() {
MatrixWorkspace_sptr
ws_sumOfNormFactors
=
WorkspaceFactory
::
Instance
().
create
(
outputWS
);
ws_sumOfNormFactors
->
dataX
(
0
)
=
outputWS
->
dataX
(
0
);
ws_sumOfNormFactors
->
dataDx
(
0
)
=
outputWS
->
dataDx
(
0
);
if
(
useQResolution
)
{
ws_sumOfNormFactors
->
dataDx
(
0
)
=
outputWS
->
dataDx
(
0
);
}
for
(
size_t
i
=
0
;
i
<
ws_sumOfNormFactors
->
dataY
(
0
).
size
();
i
++
)
{
ws_sumOfNormFactors
->
dataY
(
0
)[
i
]
=
normSum
[
i
];
ws_sumOfNormFactors
->
dataE
(
0
)[
i
]
=
sqrt
(
normError2
[
i
]);
...
...
This diff is collapsed.
Click to expand it.
Framework/Algorithms/test/Q1D2Test.h
+
4
−
0
View file @
8bb7170c
...
...
@@ -201,6 +201,8 @@ public:
TS_ASSERT_DELTA
(
result
->
readE
(
0
)[
2
],
404981
,
10
)
TS_ASSERT_DELTA
(
result
->
readE
(
0
)[
10
],
489710.39
,
100
)
TS_ASSERT
(
boost
::
math
::
isnan
(
result
->
readE
(
0
)[
7
]))
TSM_ASSERT
(
"Should not have a DX value"
,
!
result
->
hasDx
(
0
))
}
void
testInvalidPixelAdj
()
{
...
...
@@ -397,6 +399,7 @@ public:
value2
);
// Act
TSM_ASSERT
(
"Resolution workspace should not be NULL"
,
qResolution
)
Mantid
::
Algorithms
::
Q1D2
Q1D
;
TS_ASSERT_THROWS_NOTHING
(
Q1D
.
initialize
());
TS_ASSERT
(
Q1D
.
isInitialized
())
...
...
@@ -426,6 +429,7 @@ public:
Mantid
::
API
::
AnalysisDataService
::
Instance
().
retrieve
(
outputWS
+
"_sumOfCounts"
)))
TSM_ASSERT
(
"Should have the x error flag set"
,
result
->
hasDx
(
0
));
// That output will be SUM_i(Yin_i*QRES_in_i)/(SUM_i(Y_in_i)) for each q
// value
// In our test workspace we set QRes_in_1 to 1, this means that all DX
...
...
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