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
be361025
Commit
be361025
authored
8 years ago
by
Raquel Alvarez
Browse files
Options
Downloads
Patches
Plain Diff
Re #17673 SofQWCentre
parent
7ef05a0b
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/SofQWCentre.cpp
+8
-8
8 additions, 8 deletions
Framework/Algorithms/src/SofQWCentre.cpp
Framework/Algorithms/test/SofQWCentreTest.h
+12
-13
12 additions, 13 deletions
Framework/Algorithms/test/SofQWCentreTest.h
with
20 additions
and
21 deletions
Framework/Algorithms/src/SofQWCentre.cpp
+
8
−
8
View file @
be361025
...
...
@@ -168,9 +168,9 @@ void SofQWCentre::exec() {
const
size_t
numDets
=
detectors
.
size
();
const
double
numDets_d
=
static_cast
<
double
>
(
numDets
);
// cache to reduce number of static casts
const
MantidVec
&
Y
=
inputWorkspace
->
readY
(
i
);
const
MantidVec
&
E
=
inputWorkspace
->
readE
(
i
);
const
MantidVec
&
X
=
inputWorkspace
->
readX
(
i
);
const
auto
&
Y
=
inputWorkspace
->
y
(
i
);
const
auto
&
E
=
inputWorkspace
->
e
(
i
);
const
auto
&
X
=
inputWorkspace
->
x
(
i
);
// Loop over the detectors and for each bin calculate Q
for
(
size_t
idet
=
0
;
idet
<
numDets
;
++
idet
)
{
...
...
@@ -233,10 +233,10 @@ void SofQWCentre::exec() {
// And add the data and it's error to that bin, taking into account
// the number of detectors contributing to this bin
outputWorkspace
->
data
Y
(
qIndex
)[
j
]
+=
Y
[
j
]
/
numDets_d
;
outputWorkspace
->
mutable
Y
(
qIndex
)[
j
]
+=
Y
[
j
]
/
numDets_d
;
// Standard error on the average
outputWorkspace
->
data
E
(
qIndex
)[
j
]
=
sqrt
((
pow
(
outputWorkspace
->
readE
(
qIndex
)[
j
],
2
)
+
pow
(
E
[
j
],
2
))
/
outputWorkspace
->
mutable
E
(
qIndex
)[
j
]
=
sqrt
((
pow
(
outputWorkspace
->
e
(
qIndex
)[
j
],
2
)
+
pow
(
E
[
j
],
2
))
/
numDets_d
);
}
}
...
...
@@ -327,8 +327,8 @@ void SofQWCentre::makeDistribution(API::MatrixWorkspace_sptr outputWS,
const
size_t
numQBins
=
outputWS
->
getNumberHistograms
();
for
(
size_t
i
=
0
;
i
<
numQBins
;
++
i
)
{
MantidVec
&
Y
=
outputWS
->
data
Y
(
i
);
MantidVec
&
E
=
outputWS
->
data
E
(
i
);
auto
&
Y
=
outputWS
->
mutable
Y
(
i
);
auto
&
E
=
outputWS
->
mutable
E
(
i
);
std
::
transform
(
Y
.
begin
(),
Y
.
end
(),
Y
.
begin
(),
std
::
bind2nd
(
std
::
divides
<
double
>
(),
widths
[
i
+
1
]));
std
::
transform
(
E
.
begin
(),
E
.
end
(),
E
.
begin
(),
...
...
This diff is collapsed.
Click to expand it.
Framework/Algorithms/test/SofQWCentreTest.h
+
12
−
13
View file @
be361025
...
...
@@ -4,7 +4,6 @@
#include
<cxxtest/TestSuite.h>
#include
"MantidAlgorithms/SofQWCentre.h"
#include
"MantidAPI/Axis.h"
#include
"MantidDataHandling/LoadNexusProcessed.h"
#include
"SofQWTest.h"
...
...
@@ -44,18 +43,18 @@ public:
TS_ASSERT_EQUALS
((
*
(
result
->
getAxis
(
1
)))(
6
),
2.0
);
const
double
delta
(
1e-08
);
TS_ASSERT_DELTA
(
result
->
readY
(
0
)[
1160
],
54.85624399
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
0
)[
1160
],
0.34252858
,
delta
);
TS_ASSERT_DELTA
(
result
->
readY
(
1
)[
1145
],
22.72491806
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
1
)[
1145
],
0.19867742
,
delta
);
TS_ASSERT_DELTA
(
result
->
readY
(
2
)[
1200
],
6.76047436
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
2
)[
1200
],
0.10863549
,
delta
);
TS_ASSERT_DELTA
(
result
->
readY
(
3
)[
99
],
0.16439574
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
3
)[
99
],
0.03414360
,
delta
);
TS_ASSERT_DELTA
(
result
->
readY
(
4
)[
1654
],
0.069311442
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
4
)[
1654
],
0.007573484
,
delta
);
TS_ASSERT_DELTA
(
result
->
readY
(
5
)[
1025
],
0.226287179
,
delta
);
TS_ASSERT_DELTA
(
result
->
readE
(
5
)[
1025
],
0.02148236
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
0
)[
1160
],
54.85624399
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
0
)[
1160
],
0.34252858
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
1
)[
1145
],
22.72491806
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
1
)[
1145
],
0.19867742
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
2
)[
1200
],
6.76047436
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
2
)[
1200
],
0.10863549
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
3
)[
99
],
0.16439574
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
3
)[
99
],
0.03414360
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
4
)[
1654
],
0.069311442
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
4
)[
1654
],
0.007573484
,
delta
);
TS_ASSERT_DELTA
(
result
->
y
(
5
)[
1025
],
0.226287179
,
delta
);
TS_ASSERT_DELTA
(
result
->
e
(
5
)[
1025
],
0.02148236
,
delta
);
}
};
...
...
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