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
bbc314ba
Commit
bbc314ba
authored
10 years ago
by
Owen Arnold
Browse files
Options
Downloads
Patches
Plain Diff
refs #10208. Fix issues raised in testing.
parent
327030e8
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
Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp
+10
-2
10 additions, 2 deletions
Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp
Code/Mantid/Framework/Algorithms/test/LorentzCorrectionTest.h
+14
-0
14 additions, 0 deletions
.../Mantid/Framework/Algorithms/test/LorentzCorrectionTest.h
with
24 additions
and
2 deletions
Code/Mantid/Framework/Algorithms/src/LorentzCorrection.cpp
+
10
−
2
View file @
bbc314ba
...
...
@@ -119,12 +119,20 @@ namespace Mantid
continue
;
const
double
twoTheta
=
inWS
->
detectorTwoTheta
(
detector
);
const
double
sinTheta
=
std
::
sin
(
twoTheta
/
2
);
double
sinThetaSq
=
sinTheta
*
sinTheta
;
for
(
size_t
j
=
0
;
j
<
inY
.
size
();
++
j
)
{
const
double
wL
=
isHist
?
(
0.5
*
(
inX
[
j
]
+
inX
[
j
+
1
]))
:
inX
[
j
];
double
sinTheta
=
std
::
sin
(
twoTheta
/
2
);
double
weight
=
sinTheta
*
sinTheta
/
(
wL
*
wL
*
wL
*
wL
);
if
(
wL
==
0
)
{
std
::
stringstream
buffer
;
buffer
<<
"Cannot have zero values Wavelength. At workspace index: "
<<
i
;
throw
std
::
runtime_error
(
buffer
.
str
());
}
double
weight
=
sinThetaSq
/
(
wL
*
wL
*
wL
*
wL
);
outY
[
j
]
*=
weight
;
outE
[
j
]
*=
weight
;
}
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/Algorithms/test/LorentzCorrectionTest.h
+
14
−
0
View file @
bbc314ba
...
...
@@ -115,6 +115,20 @@ public:
alg
.
setProperty
(
"InputWorkspace"
,
ws_tof
),
std
::
invalid_argument
&
);
}
void
test_throws_if_wavelength_zero
()
{
auto
ws_lam
=
this
->
create_workspace
(
2
/*nBins*/
);
ws_lam
->
dataX
(
0
)[
0
]
=
0
;
// Make wavelength zero
ws_lam
->
dataX
(
0
)[
1
]
=
0
;
// Make wavelength zero
LorentzCorrection
alg
;
alg
.
setChild
(
true
);
alg
.
setRethrows
(
true
);
alg
.
initialize
();
alg
.
setProperty
(
"InputWorkspace"
,
ws_lam
);
alg
.
setPropertyValue
(
"OutputWorkspace"
,
"temp"
);
TSM_ASSERT_THROWS
(
"Should throw with zero wavelength values."
,
alg
.
execute
(),
std
::
runtime_error
&
);
}
void
test_execute
()
{
auto
ws_lam
=
this
->
create_workspace
(
2
/*nBins*/
);
...
...
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