Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
8a1588ae
Commit
8a1588ae
authored
Feb 20, 2017
by
Samuel Jackson
Browse files
Refs #18920 Fix bug in Peak
The detPos was not being cleared properly when setting QLab.
parent
86a8b8cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/src/Peak.cpp
View file @
8a1588ae
...
...
@@ -531,6 +531,7 @@ void Peak::setQLabFrame(const Mantid::Kernel::V3D &QLabFrame,
boost
::
optional
<
double
>
detectorDistance
)
{
// Clear out the detector = we can't know them
m_detectorID
=
-
1
;
detPos
=
V3D
();
m_det
=
IDetector_sptr
();
m_row
=
-
1
;
m_col
=
-
1
;
...
...
Framework/DataObjects/test/PeakTest.h
View file @
8a1588ae
...
...
@@ -264,6 +264,18 @@ public:
TS_ASSERT_EQUALS
(
qLab
,
qSampleRotated
);
}
void
test_getQLabFrame
()
{
Instrument_sptr
inst
=
ComponentCreationHelper
::
createTestInstrumentRectangular2
(
1
,
10
);
Peak
p
(
inst
,
0
,
1.5
);
p
.
setQLabFrame
(
V3D
(
1
,
1
,
1
));
auto
q
=
p
.
getQLabFrame
();
// should be the same
TS_ASSERT_DELTA
(
q
[
0
],
1
,
1e-5
);
TS_ASSERT_DELTA
(
q
[
1
],
1
,
1e-5
);
TS_ASSERT_DELTA
(
q
[
2
],
1
,
1e-5
);
}
//------------------------------------------------------------------------------------
/** Can't have Q = 0,0,0 or 0 in the Z direction when creating */
void
test_setQLabFrame_ThrowsIfQIsNull
()
{
...
...
Framework/PythonInterface/test/python/mantid/api/IPeaksWorkspaceTest.py
View file @
8a1588ae
...
...
@@ -70,9 +70,10 @@ class IPeaksWorkspaceTest(unittest.TestCase):
p
.
setQLabFrame
(
V3D
(
1
,
1
,
1
))
except
Exception
:
self
.
fail
(
"Tried setQLabFrame with one V3D argument"
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
X
(),
-
1.4976057446828845
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
Y
(),
0.059904229787315376
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
Z
(),
1.4400957702126842
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
X
(),
1.0
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
Y
(),
1.0
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQLabFrame
().
Z
(),
1.0
,
places
=
10
)
try
:
p
.
setQLabFrame
(
V3D
(
1
,
1
,
1
),
1
)
...
...
@@ -85,13 +86,15 @@ class IPeaksWorkspaceTest(unittest.TestCase):
def
test_peak_setQSampleFrame
(
self
):
pws
=
WorkspaceCreationHelper
.
createPeaksWorkspace
(
1
,
True
)
p
=
pws
.
getPeak
(
0
)
try
:
p
.
setQSampleFrame
(
V3D
(
1
,
1
,
1
))
except
Exception
:
self
.
fail
(
"Tried setQSampleFrame with one V3D argument"
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
X
(),
-
1.4976057446828845
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
Y
(),
0.059904229787315376
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
Z
(),
1.4400957702126842
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
X
(),
1.0
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
Y
(),
1.0
,
places
=
10
)
self
.
assertAlmostEquals
(
p
.
getQSampleFrame
().
Z
(),
1.0
,
places
=
10
)
try
:
p
.
setQSampleFrame
(
V3D
(
1
,
1
,
1
),
1
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment