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
db8034ae
Commit
db8034ae
authored
12 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Refs #5099. Added ability to set uncertainties to sqrt.
parent
adf6e2e4
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
Code/Mantid/Framework/Algorithms/src/SetUncertaintiesToZero.cpp
+21
-0
21 additions, 0 deletions
...antid/Framework/Algorithms/src/SetUncertaintiesToZero.cpp
with
21 additions
and
0 deletions
Code/Mantid/Framework/Algorithms/src/SetUncertaintiesToZero.cpp
+
21
−
0
View file @
db8034ae
...
...
@@ -6,6 +6,7 @@
// Includes
//----------------------------------------------------------------------
#include
"MantidAlgorithms/SetUncertaintiesToZero.h"
#include
"MantidKernel/ListValidator.h"
#include
<vector>
namespace
Mantid
...
...
@@ -43,17 +44,26 @@ const std::string SetUncertaintiesToZero::name() const
int
SetUncertaintiesToZero
::
version
()
const
{
return
(
1
);}
const
std
::
string
ZERO
(
"zero"
);
const
std
::
string
SQRT
(
"sqrt"
);
void
SetUncertaintiesToZero
::
init
()
{
declareProperty
(
new
WorkspaceProperty
<
API
::
MatrixWorkspace
>
(
"InputWorkspace"
,
""
,
Direction
::
Input
));
declareProperty
(
new
WorkspaceProperty
<
API
::
MatrixWorkspace
>
(
"OutputWorkspace"
,
""
,
Direction
::
Output
));
std
::
vector
<
std
::
string
>
errorTypes
;
errorTypes
.
push_back
(
ZERO
);
errorTypes
.
push_back
(
SQRT
);
declareProperty
(
"SetError"
,
ZERO
,
boost
::
make_shared
<
StringListValidator
>
(
errorTypes
),
"How to reset the uncertainties"
);
}
void
SetUncertaintiesToZero
::
exec
()
{
MatrixWorkspace_const_sptr
inputWorkspace
=
getProperty
(
"InputWorkspace"
);
std
::
string
errorType
=
getProperty
(
"SetError"
);
bool
zeroError
=
(
errorType
.
compare
(
ZERO
)
==
0
);
// Create the output workspace. This will copy many aspects from the input one.
MatrixWorkspace_sptr
outputWorkspace
=
WorkspaceFactory
::
Instance
().
create
(
inputWorkspace
);
...
...
@@ -71,6 +81,17 @@ void SetUncertaintiesToZero::exec()
outputWorkspace
->
dataY
(
i
)
=
inputWorkspace
->
readY
(
i
);
outputWorkspace
->
dataE
(
i
)
=
std
::
vector
<
double
>
(
inputWorkspace
->
readE
(
i
).
size
(),
0.
);
if
(
!
zeroError
)
{
MantidVec
&
Y
=
outputWorkspace
->
dataY
(
i
);
MantidVec
&
E
=
outputWorkspace
->
dataE
(
i
);
std
::
size_t
numE
=
E
.
size
();
for
(
std
::
size_t
j
=
0
;
j
<
numE
;
j
++
)
{
E
[
j
]
=
sqrt
(
Y
[
j
]);
}
}
prog
.
report
();
PARALLEL_END_INTERUPT_REGION
...
...
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