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
a8a7dbd4
Commit
a8a7dbd4
authored
Oct 23, 2013
by
Vickie Lynch
Browse files
Refs #7650 get coordinates from input MD workspaces
parent
98c0b337
Changes
7
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/Crystal/src/PeakIntensityVsRadius.cpp
View file @
a8a7dbd4
...
...
@@ -118,8 +118,7 @@ namespace Crystal
propOptions
.
push_back
(
"Q (sample frame)"
);
propOptions
.
push_back
(
"HKL"
);
declareProperty
(
"CoordinatesToUse"
,
"Q (lab frame)"
,
boost
::
make_shared
<
StringListValidator
>
(
propOptions
),
"Which coordinates of the peak center do you wish to use to integrate the peak? This should match the InputWorkspace's dimensions."
);
"Deprecated: algorithm uses the InputWorkspace's coordinates."
);
declareProperty
(
"RadiusStart"
,
0.0
,
"Radius at which to start integrating."
);
declareProperty
(
"RadiusEnd"
,
1.0
,
"Radius at which to stop integrating."
);
...
...
Code/Mantid/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp
View file @
a8a7dbd4
...
...
@@ -67,8 +67,7 @@ namespace MDAlgorithms
propOptions
.
push_back
(
"Q (sample frame)"
);
propOptions
.
push_back
(
"HKL"
);
declareProperty
(
"CoordinatesToUse"
,
"HKL"
,
boost
::
make_shared
<
StringListValidator
>
(
propOptions
),
"Which coordinates of the peak center do you wish to use to find the center? This should match the InputWorkspace's dimensions."
);
"Deprecated: algorithm uses the InputWorkspace's coordinates."
);
declareProperty
(
new
PropertyWithValue
<
double
>
(
"PeakRadius"
,
1.0
,
Direction
::
Input
),
"Fixed radius around each peak position in which to calculate the centroid."
);
...
...
@@ -99,10 +98,15 @@ namespace MDAlgorithms
if
(
peakWS
!=
inPeakWS
)
peakWS
=
inPeakWS
->
clone
();
/// Value of the CoordinatesToUse property.
std
::
string
CoordinatesToUse
=
getPropertyValue
(
"CoordinatesToUse"
);
std
::
string
CoordinatesToUseStr
=
getPropertyValue
(
"CoordinatesToUse"
);
int
CoordinatesToUse
=
ws
->
getSpecialCoordinateSystem
();
if
(
CoordinatesToUse
==
1
&&
CoordinatesToUseStr
!=
"Q (lab frame)"
)
g_log
.
warning
()
<<
"Warning: used Q (lab frame) coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
else
if
(
CoordinatesToUse
==
2
&&
CoordinatesToUseStr
!=
"Q (sample frame)"
)
g_log
.
warning
()
<<
"Warning: used Q (sample frame) coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
else
if
(
CoordinatesToUse
==
3
&&
CoordinatesToUseStr
!=
"HKL"
)
g_log
.
warning
()
<<
"Warning: used HKL coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
// TODO: Confirm that the coordinates requested match those in the MDEventWorkspace
/// Radius to use around peaks
double
PeakRadius
=
getProperty
(
"PeakRadius"
);
...
...
@@ -117,11 +121,11 @@ namespace MDAlgorithms
// Get the peak center as a position in the dimensions of the workspace
V3D
pos
;
if
(
CoordinatesToUse
==
"Q (lab frame)"
)
if
(
CoordinatesToUse
==
1
)
//
"Q (lab frame)"
pos
=
p
.
getQLabFrame
();
else
if
(
CoordinatesToUse
==
"Q (sample frame)"
)
else
if
(
CoordinatesToUse
==
2
)
//
"Q (sample frame)"
pos
=
p
.
getQSampleFrame
();
else
if
(
CoordinatesToUse
==
"HKL"
)
else
if
(
CoordinatesToUse
==
3
)
//
"HKL"
pos
=
p
.
getHKL
();
// Build the sphere transformation
...
...
@@ -152,17 +156,17 @@ namespace MDAlgorithms
V3D
vecCentroid
(
centroid
[
0
],
centroid
[
1
],
centroid
[
2
]);
// Save it back in the peak object, in the dimension specified.
if
(
CoordinatesToUse
==
"Q (lab frame)"
)
if
(
CoordinatesToUse
==
1
)
//
"Q (lab frame)"
{
p
.
setQLabFrame
(
vecCentroid
,
detectorDistance
);
p
.
findDetector
();
}
else
if
(
CoordinatesToUse
==
"Q (sample frame)"
)
else
if
(
CoordinatesToUse
==
2
)
//
"Q (sample frame)"
{
p
.
setQSampleFrame
(
vecCentroid
,
detectorDistance
);
p
.
findDetector
();
}
else
if
(
CoordinatesToUse
==
"HKL"
)
else
if
(
CoordinatesToUse
==
3
)
//
"HKL"
{
p
.
setHKL
(
vecCentroid
);
}
...
...
Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp
View file @
a8a7dbd4
...
...
@@ -139,8 +139,7 @@ namespace MDAlgorithms
propOptions
.
push_back
(
"Q (sample frame)"
);
propOptions
.
push_back
(
"HKL"
);
declareProperty
(
"CoordinatesToUse"
,
"Q (lab frame)"
,
boost
::
make_shared
<
StringListValidator
>
(
propOptions
),
"Which coordinates of the peak center do you wish to use to integrate the peak? This should match the InputWorkspace's dimensions."
);
"Deprecated: algorithm uses the InputWorkspace's coordinates."
);
declareProperty
(
new
PropertyWithValue
<
double
>
(
"PeakRadius"
,
1.0
,
Direction
::
Input
),
"Fixed radius around each peak position in which to integrate (in the same units as the workspace)."
);
...
...
@@ -214,9 +213,15 @@ namespace MDAlgorithms
peakWS
=
inPeakWS
->
clone
();
/// Value of the CoordinatesToUse property.
std
::
string
CoordinatesToUse
=
getPropertyValue
(
"CoordinatesToUse"
);
// TODO: Confirm that the coordinates requested match those in the MDEventWorkspace
std
::
string
CoordinatesToUseStr
=
getPropertyValue
(
"CoordinatesToUse"
);
int
CoordinatesToUse
=
ws
->
getSpecialCoordinateSystem
();
g_log
.
warning
()
<<
" Warning"
<<
CoordinatesToUse
<<
std
::
endl
;
if
(
CoordinatesToUse
==
1
&&
CoordinatesToUseStr
!=
"Q (lab frame)"
)
g_log
.
warning
()
<<
"Warning: used Q (lab frame) coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
else
if
(
CoordinatesToUse
==
2
&&
CoordinatesToUseStr
!=
"Q (sample frame)"
)
g_log
.
warning
()
<<
"Warning: used Q (sample frame) coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
else
if
(
CoordinatesToUse
==
3
&&
CoordinatesToUseStr
!=
"HKL"
)
g_log
.
warning
()
<<
"Warning: used HKL coordinates for MD workspace, not CoordinatesToUse from input "
<<
std
::
endl
;
/// Radius to use around peaks
double
PeakRadius
=
getProperty
(
"PeakRadius"
);
...
...
@@ -301,11 +306,11 @@ namespace MDAlgorithms
// Get the peak center as a position in the dimensions of the workspace
V3D
pos
;
if
(
CoordinatesToUse
==
"Q (lab frame)"
)
if
(
CoordinatesToUse
==
1
)
//
"Q (lab frame)"
pos
=
p
.
getQLabFrame
();
else
if
(
CoordinatesToUse
==
"Q (sample frame)"
)
else
if
(
CoordinatesToUse
==
2
)
//
"Q (sample frame)"
pos
=
p
.
getQSampleFrame
();
else
if
(
CoordinatesToUse
==
"HKL"
)
else
if
(
CoordinatesToUse
==
3
)
//
"HKL"
pos
=
p
.
getHKL
();
// Get the instrument and its detectors
...
...
Code/Mantid/Framework/MDAlgorithms/test/CentroidPeaksMDTest.h
View file @
a8a7dbd4
...
...
@@ -150,10 +150,19 @@ public:
if
(
CoordinatesToUse
==
"HKL"
)
{
mdews
->
setCoordinateSystem
(
Mantid
::
API
::
HKL
);
doRun
(
V3D
(
0.
,
0.
,
0.
),
1.0
,
V3D
(
0.
,
0.
,
0.
),
"Start at the center, get the center"
);
doRun
(
V3D
(
0.2
,
0.2
,
0.2
),
1.8
,
V3D
(
0.
,
0.
,
0.
),
"Somewhat off center"
);
}
else
if
(
CoordinatesToUse
==
"Q (lab frame)"
)
{
mdews
->
setCoordinateSystem
(
Mantid
::
API
::
QLab
);
}
else
if
(
CoordinatesToUse
==
"Q (sample frame)"
)
{
mdews
->
setCoordinateSystem
(
Mantid
::
API
::
QSample
);
}
doRun
(
V3D
(
2.
,
3.
,
4.
),
1.0
,
V3D
(
2.
,
3.
,
4.
),
"Start at the center, get the center"
);
...
...
Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMDTest.h
View file @
a8a7dbd4
...
...
@@ -112,6 +112,7 @@ public:
MDEventWorkspace3Lean
::
sptr
mdews
=
AnalysisDataService
::
Instance
().
retrieveWS
<
MDEventWorkspace3Lean
>
(
"IntegratePeaksMDTest_MDEWS"
);
mdews
->
setCoordinateSystem
(
Mantid
::
API
::
HKL
);
TS_ASSERT_EQUALS
(
mdews
->
getNPoints
(),
3000
);
TS_ASSERT_DELTA
(
mdews
->
getBox
()
->
getSignal
(),
3000.0
,
1e-2
);
...
...
Code/Mantid/scripts/SCD_Reduction/ReduceOneSCD_Run.py
View file @
a8a7dbd4
...
...
@@ -213,6 +213,27 @@ if use_sphere_integration:
BackgroundInnerRadius
=
bkg_inner_radius
,
PeaksWorkspace
=
peaks_ws
,
IntegrateIfOnEdge
=
integrate_if_edge_peak
)
elif
use_cylinder_integration
:
#
# Integrate found or predicted peaks in Q space using spheres, and save
# integrated intensities, with Niggli indexing. First get an un-weighted
# workspace to do raw integration (we don't need high resolution or
# LorentzCorrection to do the raw sphere integration )
#
MDEW
=
ConvertToMD
(
InputWorkspace
=
event_ws
,
QDimensions
=
"Q3D"
,
dEAnalysisMode
=
"Elastic"
,
QConversionScales
=
"Q in A^-1"
,
LorentzCorrection
=
'0'
,
MinValues
=
minVals
,
MaxValues
=
maxVals
,
SplitInto
=
'2'
,
SplitThreshold
=
'500'
,
MaxRecursionDepth
=
'10'
)
peaks_ws
=
IntegratePeaksMD
(
InputWorkspace
=
MDEW
,
PeakRadius
=
peak_radius
,
CoordinatesToUse
=
"Q (sample frame)"
,
BackgroundOuterRadius
=
bkg_outer_radius
,
BackgroundInnerRadius
=
bkg_inner_radius
,
PeaksWorkspace
=
peaks_ws
,
IntegrateIfOnEdge
=
integrate_if_edge_peak
,
Cylinder
=
True
,
CylinderLength
=
cylinder_length
,
PercentBackground
=
cylinder_percent_bkg
,
ProfileFunction
=
cylinder_profile_fit
)
elif
use_fit_peaks_integration
:
event_ws
=
Rebin
(
InputWorkspace
=
event_ws
,
...
...
Code/Mantid/scripts/SCD_Reduction/ReduceSCD.config
View file @
a8a7dbd4
...
...
@@ -96,6 +96,7 @@ max_pred_dspacing 2.5
# use_*****_integration flag True.
#
use_sphere_integration
True
use_cylinder_integration
False
use_ellipse_integration
False
use_fit_peaks_integration
False
...
...
@@ -108,6 +109,15 @@ peak_radius 0.18 # for sphere integration only
bkg_inner_radius
0
.
18
# for sphere or ellipse integration
bkg_outer_radius
0
.
23
# for sphere or ellipse integration
integrate_if_edge_peak
True
# for sphere integration only
#
## Specify cylinder integration control parameters. Check that these
## are correct, if use_cylinder_integration is True.
## Otherwise the values aren't used.
##
#
cylinder_length
0
.
40
# for cylinder integration
cylinder_percent_bkg
0
# for cylinder integration
cylinder_profile_fit
Gaussian
# for cylinder integration
#
# Specify ellispe integration control parameters
...
...
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