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
be63fb12
Commit
be63fb12
authored
Nov 23, 2012
by
Owen Arnold
Browse files
refs #6222 Add and implement query method.
parent
aa8478a6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
View file @
be63fb12
...
...
@@ -108,6 +108,12 @@ namespace API
*/
virtual
IPeak
*
createPeak
(
Mantid
::
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
=
1.0
)
const
=
0
;
//---------------------------------------------------------------------------------------------
/** Determine if the workspace has been integrated using a peaks integration algorithm.
* @return TRUE if the workspace has been integrated.
*/
virtual
bool
hasIntegratedPeaks
()
const
=
0
;
};
...
...
Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
View file @
be63fb12
...
...
@@ -107,7 +107,7 @@ namespace DataObjects
API
::
IPeak
*
createPeak
(
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
=
1.0
)
const
;
std
::
vector
<
Peak
>
&
getPeaks
();
const
std
::
vector
<
Peak
>
&
getPeaks
()
const
;
virtual
bool
hasIntegratedPeaks
()
const
;
virtual
size_t
getMemorySize
()
const
;
// ====================================== ITableWorkspace Methods ==================================
...
...
Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
View file @
be63fb12
...
...
@@ -265,6 +265,20 @@ namespace DataObjects
return
peaks
;
}
/** Getter for the integration status.
@return TRUE if it has been integrated using a peak integration algorithm.
*/
bool
PeaksWorkspace
::
hasIntegratedPeaks
()
const
{
bool
ret
=
false
;
const
std
::
string
peaksIntegrated
=
"PeaksIntegrated"
;
if
(
this
->
run
().
hasProperty
(
peaksIntegrated
))
{
ret
=
boost
::
lexical_cast
<
bool
>
(
this
->
run
().
getProperty
(
peaksIntegrated
)
->
value
());
}
return
ret
;
}
//---------------------------------------------------------------------------------------------
/// Return the memory used in bytes
size_t
PeaksWorkspace
::
getMemorySize
()
const
...
...
Code/Mantid/Framework/DataObjects/test/PeaksWorkspaceTest.h
View file @
be63fb12
...
...
@@ -269,6 +269,28 @@ public:
TSM_ASSERT_THROWS_NOTHING
(
"should clearly delete pw"
,
delete
pw
);
}
void
test_hasIntegratedPeaks_without_property
()
{
PeaksWorkspace
ws
;
TSM_ASSERT
(
"Should not indicate that there are integrated peaks without property."
,
!
ws
.
hasIntegratedPeaks
());
}
void
test_hasIntegratedPeaks_with_property_when_false
()
{
PeaksWorkspace
ws
;
bool
hasIntegratedPeaks
=
false
;
ws
.
mutableRun
().
addProperty
(
"PeaksIntegrated"
,
hasIntegratedPeaks
);
TS_ASSERT_EQUALS
(
hasIntegratedPeaks
,
ws
.
hasIntegratedPeaks
());
}
void
test_hasIntegratedPeaks_with_property_when_true
()
{
PeaksWorkspace
ws
;
bool
hasIntegratedPeaks
=
true
;
ws
.
mutableRun
().
addProperty
(
"PeaksIntegrated"
,
hasIntegratedPeaks
);
TS_ASSERT_EQUALS
(
hasIntegratedPeaks
,
ws
.
hasIntegratedPeaks
());
}
PeaksWorkspaceTest
()
{
FrameworkManager
::
Instance
();
...
...
Code/Mantid/Framework/MDEvents/src/IntegratePeaksMD.cpp
View file @
be63fb12
...
...
@@ -308,6 +308,9 @@ namespace MDEvents
<<
std
::
endl
;
}
// This flag is used by the PeaksWorkspace to evaluate whether it has been integrated.
peakWS
->
mutableRun
().
addProperty
(
"PeaksIntegrated"
,
true
,
true
);
// These flags are specific to the algorithm.
peakWS
->
mutableRun
().
addProperty
(
"PeakRadius"
,
PeakRadius
,
true
);
peakWS
->
mutableRun
().
addProperty
(
"BackgroundInnerRadius"
,
BackgroundInnerRadius
,
true
);
peakWS
->
mutableRun
().
addProperty
(
"BackgroundOuterRadius"
,
BackgroundOuterRadius
,
true
);
...
...
Code/Mantid/Framework/MDEvents/test/IntegratePeaksMDTest.h
View file @
be63fb12
...
...
@@ -293,6 +293,7 @@ public:
TS_ASSERT_EQUALS
(
peakRadius
,
actualPeakRadius
);
TS_ASSERT_EQUALS
(
backgroundOutterRadius
,
actualBackgroundOutterRadius
);
TS_ASSERT_EQUALS
(
backgroundInnerRadius
,
actualBackgroundInnerRadius
);
TS_ASSERT
(
outWS
->
hasIntegratedPeaks
());
}
};
...
...
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