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
c49657f7
Commit
c49657f7
authored
Feb 26, 2016
by
Nick Draper
Browse files
Many updates of specIndex, specInd, spIndex
re #15450
parent
f7f9f03c
Changes
44
Hide whitespace changes
Inline
Side-by-side
Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h
View file @
c49657f7
...
...
@@ -85,8 +85,8 @@ private:
void
convertToDistribution
(
API
::
MatrixWorkspace_sptr
workspace
);
void
restoreDistributionState
(
API
::
MatrixWorkspace_sptr
workspace
);
void
checkRange
(
double
&
startX
,
double
&
endX
);
void
get
Spec
Inds
(
std
::
vector
<
int
>
&
output
,
const
int
workspaceTotal
);
double
Mean
(
const
API
::
MatrixWorkspace_const_sptr
WS
,
const
int
s
pec
Ind
,
void
get
Ws
Inds
(
std
::
vector
<
int
>
&
output
,
const
int
workspaceTotal
);
double
Mean
(
const
API
::
MatrixWorkspace_const_sptr
WS
,
const
int
w
sInd
,
const
double
startX
,
const
double
endX
,
double
&
variance
)
const
;
double
LinearFit
(
API
::
MatrixWorkspace_sptr
WS
,
int
spectrum
,
double
startX
,
double
endX
);
...
...
Framework/Algorithms/inc/MantidAlgorithms/GetEi.h
View file @
c49657f7
...
...
@@ -86,13 +86,13 @@ private:
void
getGeometry
(
API
::
MatrixWorkspace_const_sptr
WS
,
specnum_t
mon0Spec
,
specnum_t
mon1Spec
,
double
&
monitor0Dist
,
double
&
monitor1Dist
)
const
;
std
::
vector
<
size_t
>
getMonitor
Spec
Indexs
(
API
::
MatrixWorkspace_const_sptr
WS
,
std
::
vector
<
size_t
>
getMonitor
Ws
Indexs
(
API
::
MatrixWorkspace_const_sptr
WS
,
specnum_t
specNum1
,
specnum_t
specNum2
)
const
;
double
timeToFly
(
double
s
,
double
E_KE
)
const
;
double
getPeakCentre
(
API
::
MatrixWorkspace_const_sptr
WS
,
const
int64_t
monitIn
,
const
double
peakTime
);
void
extractSpec
(
int64_t
s
pec
Ind
,
double
start
,
double
end
);
void
extractSpec
(
int64_t
w
sInd
,
double
start
,
double
end
);
void
getPeakEstimates
(
double
&
height
,
int64_t
&
centreInd
,
double
&
background
)
const
;
double
findHalfLoc
(
MantidVec
::
size_type
startInd
,
const
double
height
,
...
...
Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h
View file @
c49657f7
...
...
@@ -108,9 +108,9 @@ private:
/// over-reading
double
m_hiFrac
;
/// The index of the first spectrum to calculate
int
m_min
Spec
;
int
m_min
WsIndex
;
/// The index of the last spectrum to calculate
int
m_max
Spec
;
int
m_max
WsIndex
;
/// Start point for integration
double
m_rangeLower
;
/// End point for integration
...
...
Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h
View file @
c49657f7
...
...
@@ -69,7 +69,7 @@ private:
API
::
MatrixWorkspace_sptr
setUpOutputWorkspace
(
const
std
::
vector
<
double
>
&
binParams
)
const
;
// these are the steps that are run on each individual spectrum
void
calculateNormalization
(
const
size_t
wavStart
,
const
size_t
s
pec
Ind
,
void
calculateNormalization
(
const
size_t
wavStart
,
const
size_t
w
sInd
ex
,
API
::
MatrixWorkspace_const_sptr
pixelAdj
,
API
::
MatrixWorkspace_const_sptr
wavePixelAdj
,
double
const
*
const
binNorms
,
...
...
@@ -77,16 +77,16 @@ private:
const
MantidVec
::
iterator
norm
,
const
MantidVec
::
iterator
normETo2
)
const
;
void
pixelWeight
(
API
::
MatrixWorkspace_const_sptr
pixelAdj
,
const
size_t
s
pec
Index
,
double
&
weight
,
double
&
error
)
const
;
const
size_t
w
sIndex
,
double
&
weight
,
double
&
error
)
const
;
void
addWaveAdj
(
const
double
*
c
,
const
double
*
Dc
,
MantidVec
::
iterator
bInOut
,
MantidVec
::
iterator
e2InOut
)
const
;
void
addWaveAdj
(
const
double
*
c
,
const
double
*
Dc
,
MantidVec
::
iterator
bInOut
,
MantidVec
::
iterator
e2InOut
,
MantidVec
::
const_iterator
,
MantidVec
::
const_iterator
)
const
;
void
normToMask
(
const
size_t
offSet
,
const
size_t
s
pec
Index
,
void
normToMask
(
const
size_t
offSet
,
const
size_t
w
sIndex
,
const
MantidVec
::
iterator
theNorms
,
const
MantidVec
::
iterator
errorSquared
)
const
;
void
convertWavetoQ
(
const
size_t
s
pec
Ind
,
const
bool
doGravity
,
void
convertWavetoQ
(
const
size_t
w
sInd
,
const
bool
doGravity
,
const
size_t
offset
,
MantidVec
::
iterator
Qs
,
const
double
extraLength
)
const
;
void
getQBinPlus1
(
const
MantidVec
&
OutQs
,
const
double
QToFind
,
...
...
Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h
View file @
c49657f7
...
...
@@ -48,46 +48,14 @@ public:
size_t
waveLengthCutOff
(
API
::
MatrixWorkspace_const_sptr
dataWS
,
const
double
RCut
,
const
double
WCut
,
const
size_t
s
pec
Ind
)
const
;
const
size_t
w
sInd
)
const
;
void
outputParts
(
API
::
Algorithm
*
alg
,
API
::
MatrixWorkspace_sptr
sumOfCounts
,
API
::
MatrixWorkspace_sptr
sumOfNormFactors
);
private:
/// the experimental workspace with counts across the detector
/* API::MatrixWorkspace_const_sptr m_dataWS;
///The radius cut off, should be value of the property RadiusCut. A value of
zero here will disable the cut off and all wavelengths are used
double m_RCut;
///The wavelength cut off divided by the radius cut is used in the
calculation of the first wavelength to include, it's value is only used if
RadiusCut > 0
double m_WCutOver;
void initizeCutOffs(const double RCut, const double WCut);
API::MatrixWorkspace_sptr setUpOutputWorkspace(const std::vector<double> &
binParams) const;
//these are the steps that are run on each individual spectrum
size_t waveLengthCutOff(const size_t specInd) const;
void calculateNormalization(const size_t wavStart, const size_t specInd,
API::MatrixWorkspace_const_sptr pixelAdj, double const * const binNorms,
double const * const binNormEs, const MantidVec::iterator norm, const
MantidVec::iterator normETo2) const;
void pixelWeight(API::MatrixWorkspace_const_sptr pixelAdj, const size_t
specIndex, double & weight, double & error) const;
void addWaveAdj(const double * c, const double * Dc, MantidVec::iterator
bInOut, MantidVec::iterator e2InOut) const;
void normToMask(const size_t offSet, const size_t specIndex, const
MantidVec::iterator theNorms, const MantidVec::iterator errorSquared) const;
void convertWavetoQ(const size_t specInd, const bool doGravity, const size_t
offset, MantidVec::iterator Qs) const;
void getQBinPlus1(const MantidVec & OutQs, const double QToFind,
MantidVec::const_iterator & loc) const;
void normalize(const MantidVec & normSum, const MantidVec & normError2,
MantidVec & YOut, MantidVec & errors) const;*/
};
}
// namespace Algorithms
...
...
Framework/Algorithms/src/CalculateFlatBackground.cpp
View file @
c49657f7
...
...
@@ -97,9 +97,9 @@ void CalculateFlatBackground::exec() {
double
startX
,
endX
;
this
->
checkRange
(
startX
,
endX
);
std
::
vector
<
int
>
s
pec
Inds
=
getProperty
(
"WorkspaceIndexList"
);
std
::
vector
<
int
>
w
sInds
=
getProperty
(
"WorkspaceIndexList"
);
// check if the user passed an empty list, if so all of spec will be processed
this
->
get
Spec
Inds
(
s
pec
Inds
,
numHists
);
this
->
get
Ws
Inds
(
w
sInds
,
numHists
);
// Are we removing the background?
const
bool
removeBackground
=
...
...
@@ -130,14 +130,14 @@ void CalculateFlatBackground::exec() {
// these are used to report information to the user, one progress update for
// each percent and a report on the size of the background found
double
prg
(
0.2
),
backgroundTotal
(
0
);
const
double
toFitsize
(
static_cast
<
double
>
(
s
pec
Inds
.
size
()));
const
double
toFitsize
(
static_cast
<
double
>
(
w
sInds
.
size
()));
const
int
progStep
(
static_cast
<
int
>
(
ceil
(
toFitsize
/
80.0
)));
// Now loop over the required spectra
std
::
vector
<
int
>::
const_iterator
specIt
;
// local cache for global variable
bool
skipMonitors
(
m_skipMonitors
);
for
(
specIt
=
s
pec
Inds
.
begin
();
specIt
!=
s
pec
Inds
.
end
();
++
specIt
)
{
for
(
specIt
=
w
sInds
.
begin
();
specIt
!=
w
sInds
.
end
();
++
specIt
)
{
const
int
currentSpec
=
*
specIt
;
try
{
if
(
skipMonitors
)
{
// this will fail in Windows ReleaseWithDebug info
...
...
@@ -211,7 +211,7 @@ void CalculateFlatBackground::exec() {
}
// make regular progress reports and check for canceling the algorithm
if
(
static_cast
<
int
>
(
s
pec
Inds
.
end
()
-
s
pec
Inds
.
begin
())
%
progStep
==
0
)
{
if
(
static_cast
<
int
>
(
w
sInds
.
end
()
-
w
sInds
.
begin
())
%
progStep
==
0
)
{
interruption_point
();
prg
+=
(
progStep
*
0.7
/
toFitsize
);
progress
(
prg
);
...
...
@@ -308,7 +308,7 @@ void CalculateFlatBackground::checkRange(double &startX, double &endX) {
* @param workspaceTotal :: required to be the total number of spectra in the
* workspace
*/
void
CalculateFlatBackground
::
get
Spec
Inds
(
std
::
vector
<
int
>
&
output
,
void
CalculateFlatBackground
::
get
Ws
Inds
(
std
::
vector
<
int
>
&
output
,
const
int
workspaceTotal
)
{
if
(
output
.
size
()
>
0
)
{
return
;
...
...
@@ -323,7 +323,7 @@ void CalculateFlatBackground::getSpecInds(std::vector<int> &output,
* variance (error^2) of that
* number
* @param WS :: points to the input workspace
* @param s
pec
Ind :: index of the spectrum to process
* @param
w
sInd :: index of the spectrum to process
* @param startX :: a X-value in the first bin that will be considered, must not
* be greater endX
* @param endX :: a X-value in the last bin that will be considered, must not
...
...
@@ -337,11 +337,11 @@ void CalculateFlatBackground::getSpecInds(std::vector<int> &output,
* spectra
*/
double
CalculateFlatBackground
::
Mean
(
const
API
::
MatrixWorkspace_const_sptr
WS
,
const
int
s
pec
Ind
,
const
double
startX
,
const
int
w
sInd
,
const
double
startX
,
const
double
endX
,
double
&
variance
)
const
{
const
MantidVec
&
XS
=
WS
->
readX
(
s
pec
Ind
),
&
YS
=
WS
->
readY
(
s
pec
Ind
);
const
MantidVec
&
ES
=
WS
->
readE
(
s
pec
Ind
);
const
MantidVec
&
XS
=
WS
->
readX
(
w
sInd
),
&
YS
=
WS
->
readY
(
w
sInd
);
const
MantidVec
&
ES
=
WS
->
readE
(
w
sInd
);
// the function checkRange should already have checked that startX <= endX,
// but we still need to check values weren't out side the ranges
if
(
endX
>
XS
.
back
()
||
startX
<
XS
.
front
())
{
...
...
Framework/Algorithms/src/DetectorEfficiencyVariation.cpp
View file @
c49657f7
...
...
@@ -136,8 +136,8 @@ void DetectorEfficiencyVariation::exec() {
*/
void
DetectorEfficiencyVariation
::
retrieveProperties
(
API
::
MatrixWorkspace_sptr
&
whiteBeam1
,
API
::
MatrixWorkspace_sptr
&
whiteBeam2
,
double
&
variation
,
int
&
minSpec
,
int
&
maxSpec
)
{
API
::
MatrixWorkspace_sptr
&
whiteBeam2
,
double
&
variation
,
int
&
startWsIndex
,
int
&
endWsIndex
)
{
whiteBeam1
=
getProperty
(
"WhiteBeamBase"
);
whiteBeam2
=
getProperty
(
"WhiteBeamCompare"
);
if
(
whiteBeam1
->
getInstrument
()
->
getName
()
!=
...
...
@@ -145,8 +145,8 @@ void DetectorEfficiencyVariation::retrieveProperties(
throw
std
::
invalid_argument
(
"The two input white beam vanadium workspaces "
"must be from the same instrument"
);
}
int
max
Spec
Index
=
static_cast
<
int
>
(
whiteBeam1
->
getNumberHistograms
())
-
1
;
if
(
max
Spec
Index
!=
int
max
Ws
Index
=
static_cast
<
int
>
(
whiteBeam1
->
getNumberHistograms
())
-
1
;
if
(
max
Ws
Index
!=
static_cast
<
int
>
(
whiteBeam2
->
getNumberHistograms
())
-
1
)
{
// we would get a crash later on if this were not true
throw
std
::
invalid_argument
(
"The input white beam vanadium workspaces must "
...
...
@@ -155,24 +155,24 @@ void DetectorEfficiencyVariation::retrieveProperties(
variation
=
getProperty
(
"Variation"
);
minSpec
=
getProperty
(
"StartWorkspaceIndex"
);
if
((
minSpec
<
0
)
||
(
minSpec
>
max
Spec
Index
))
{
startWsIndex
=
getProperty
(
"StartWorkspaceIndex"
);
if
((
startWsIndex
<
0
)
||
(
startWsIndex
>
max
Ws
Index
))
{
g_log
.
warning
(
"StartWorkspaceIndex out of range, changed to 0"
);
minSpec
=
0
;
startWsIndex
=
0
;
}
maxSpec
=
getProperty
(
"EndWorkspaceIndex"
);
if
(
maxSpec
==
Mantid
::
EMPTY_INT
())
maxSpec
=
max
Spec
Index
;
if
((
maxSpec
<
0
)
||
(
maxSpec
>
max
Spec
Index
))
{
endWsIndex
=
getProperty
(
"EndWorkspaceIndex"
);
if
(
endWsIndex
==
Mantid
::
EMPTY_INT
())
endWsIndex
=
max
Ws
Index
;
if
((
endWsIndex
<
0
)
||
(
endWsIndex
>
max
Ws
Index
))
{
g_log
.
warning
(
"EndWorkspaceIndex out of range, changed to max Workspace number"
);
maxSpec
=
max
Spec
Index
;
endWsIndex
=
max
Ws
Index
;
}
if
((
maxSpec
<
minSpec
))
{
if
((
endWsIndex
<
startWsIndex
))
{
g_log
.
warning
(
"EndWorkspaceIndex can not be less than the StartWorkspaceIndex, "
"changed to max Workspace number"
);
maxSpec
=
max
Spec
Index
;
endWsIndex
=
max
Ws
Index
;
}
}
...
...
Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
View file @
c49657f7
...
...
@@ -847,7 +847,7 @@ int GetDetOffsetsMultiPeaks::fitSpectra(
// throw if minD >= maxD
std
::
stringstream
ess
;
ess
<<
"Stuff went wrong with wkspIndex="
<<
wi
<<
" spec
Index
="
<<
inputW
->
getSpectrum
(
wi
)
->
getSpectrumNo
();
<<
" spec
Num
="
<<
inputW
->
getSpectrum
(
wi
)
->
getSpectrumNo
();
throw
std
::
runtime_error
(
ess
.
str
());
}
...
...
Framework/Algorithms/src/GetEi.cpp
View file @
c49657f7
...
...
@@ -108,7 +108,7 @@ void GetEi::exec() {
<<
"%
\n
"
;
// get the histograms created by the monitors
std
::
vector
<
size_t
>
indexes
=
getMonitor
Spec
Indexs
(
inWS
,
mon1Spec
,
mon2Spec
);
std
::
vector
<
size_t
>
indexes
=
getMonitor
Ws
Indexs
(
inWS
,
mon1Spec
,
mon2Spec
);
g_log
.
information
()
<<
"Looking for a peak in the first monitor spectrum, spectra index "
...
...
@@ -207,7 +207,7 @@ void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec,
* @throw NotFoundError if one of the requested spectrum numbers was not found
* in the workspace
*/
std
::
vector
<
size_t
>
GetEi
::
getMonitor
Spec
Indexs
(
std
::
vector
<
size_t
>
GetEi
::
getMonitor
Ws
Indexs
(
API
::
MatrixWorkspace_const_sptr
WS
,
specnum_t
specNum1
,
specnum_t
specNum2
)
const
{
// getting spectra numbers from detector IDs is
// hard because the map works the other way,
...
...
@@ -223,7 +223,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
// workspace, we can't continue from here
g_log
.
error
()
<<
"Couldn't find the first monitor spectrum, number "
<<
specNum1
<<
std
::
endl
;
throw
Exception
::
NotFoundError
(
"GetEi::getMonitor
Spec
Indexs()"
,
specNum1
);
throw
Exception
::
NotFoundError
(
"GetEi::getMonitor
Ws
Indexs()"
,
specNum1
);
}
// nowe the second monitor
...
...
@@ -233,7 +233,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
// workspace, we can't continue from here
g_log
.
error
()
<<
"Couldn't find the second monitor spectrum, number "
<<
specNum2
<<
std
::
endl
;
throw
Exception
::
NotFoundError
(
"GetEi::getMonitor
Spec
Indexs()"
,
specNum2
);
throw
Exception
::
NotFoundError
(
"GetEi::getMonitor
Ws
Indexs()"
,
specNum2
);
}
wsInds
.
push_back
(
specNumTemp
[
0
]);
...
...
@@ -307,17 +307,17 @@ double GetEi::getPeakCentre(API::MatrixWorkspace_const_sptr WS,
}
/** Calls CropWorkspace as a Child Algorithm and passes to it the InputWorkspace
* property
* @param s
pec
Ind :: the index number of the histogram to extract
* @param
w
sInd :: the index number of the histogram to extract
* @param start :: the number of the first bin to include (starts counting bins
* at 0)
* @param end :: the number of the last bin to include (starts counting bins at
* 0)
* @throw out_of_range if start, end or s
pec
Ind are set outside of the va
i
ld
* @throw out_of_range if start, end or
w
sInd are set outside of the val
i
d
* range for the workspace
* @throw runtime_error if the algorithm just falls over
* @throw invalid_argument if the input workspace does not have common binning
*/
void
GetEi
::
extractSpec
(
int64_t
s
pec
Ind
,
double
start
,
double
end
)
{
void
GetEi
::
extractSpec
(
int64_t
w
sInd
,
double
start
,
double
end
)
{
IAlgorithm_sptr
childAlg
=
createChildAlgorithm
(
"CropWorkspace"
,
100
*
m_fracCompl
,
100
*
(
m_fracCompl
+
CROP
));
m_fracCompl
+=
CROP
;
...
...
@@ -326,8 +326,8 @@ void GetEi::extractSpec(int64_t specInd, double start, double end) {
getProperty
(
"InputWorkspace"
));
childAlg
->
setProperty
(
"XMin"
,
start
);
childAlg
->
setProperty
(
"XMax"
,
end
);
childAlg
->
setProperty
(
"StartWorkspaceIndex"
,
s
pec
Ind
);
childAlg
->
setProperty
(
"EndWorkspaceIndex"
,
s
pec
Ind
);
childAlg
->
setProperty
(
"StartWorkspaceIndex"
,
w
sInd
);
childAlg
->
setProperty
(
"EndWorkspaceIndex"
,
w
sInd
);
childAlg
->
executeAsChildAlg
();
m_tempWS
=
childAlg
->
getProperty
(
"OutputWorkspace"
);
...
...
Framework/Algorithms/src/GetEi2.cpp
View file @
c49657f7
...
...
@@ -344,7 +344,7 @@ double GetEi2::calculatePeakPosition(size_t ws_index, double t_min,
* @param end :: the number of the last bin to include (starts counting bins at
* 0)
* @return The cropped workspace
* @throw out_of_range if start, end or
specInd
are set outside of the va
i
ld
* @throw out_of_range if start, end or
ws_index
are set outside of the val
i
d
* range for the workspace
* @throw runtime_error if the algorithm just falls over
* @throw invalid_argument if the input workspace does not have common binning
...
...
Framework/Algorithms/src/MedianDetectorTest.cpp
View file @
c49657f7
...
...
@@ -17,7 +17,7 @@ using namespace Geometry;
/// Default constructor
MedianDetectorTest
::
MedianDetectorTest
()
:
DetectorDiagnostic
(),
m_inputWS
(),
m_loFrac
(
0.1
),
m_hiFrac
(
1.5
),
m_min
Spec
(
0
),
m_max
Spec
(
EMPTY_INT
()),
m_rangeLower
(
0.0
),
m_min
WsIndex
(
0
),
m_max
WsIndex
(
EMPTY_INT
()),
m_rangeLower
(
0.0
),
m_rangeUpper
(
0.0
),
m_solidAngle
(
false
)
{}
const
std
::
string
MedianDetectorTest
::
category
()
const
{
return
"Diagnostics"
;
}
...
...
@@ -96,11 +96,11 @@ void MedianDetectorTest::exec() {
// masking and will be used to record any
// required masking from this algorithm
MatrixWorkspace_sptr
countsWS
=
integrateSpectra
(
m_inputWS
,
m_min
Spec
,
m_maxSpec
,
m_rangeLower
,
m_rangeUpper
,
true
);
m_inputWS
,
m_min
WsIndex
,
m_maxWsIndex
,
m_rangeLower
,
m_rangeUpper
,
true
);
// 0. Correct for solid angle, if desired
if
(
m_solidAngle
)
{
MatrixWorkspace_sptr
solidAngle
=
getSolidAngles
(
m_min
Spec
,
m_maxSpec
);
MatrixWorkspace_sptr
solidAngle
=
getSolidAngles
(
m_min
WsIndex
,
m_maxWsIndex
);
if
(
solidAngle
!=
nullptr
)
{
countsWS
=
countsWS
/
solidAngle
;
}
...
...
@@ -145,25 +145,25 @@ void MedianDetectorTest::exec() {
*/
void
MedianDetectorTest
::
retrieveProperties
()
{
m_inputWS
=
getProperty
(
"InputWorkspace"
);
int
max
Spec
Index
=
static_cast
<
int
>
(
m_inputWS
->
getNumberHistograms
())
-
1
;
int
max
Ws
Index
=
static_cast
<
int
>
(
m_inputWS
->
getNumberHistograms
())
-
1
;
m_parents
=
getProperty
(
"LevelsUp"
);
m_min
Spec
=
getProperty
(
"StartWorkspaceIndex"
);
if
((
m_min
Spec
<
0
)
||
(
m_min
Spec
>
max
Spec
Index
))
{
m_min
WsIndex
=
getProperty
(
"StartWorkspaceIndex"
);
if
((
m_min
WsIndex
<
0
)
||
(
m_min
WsIndex
>
max
Ws
Index
))
{
g_log
.
warning
(
"StartSpectrum out of range, changed to 0"
);
m_min
Spec
=
0
;
m_min
WsIndex
=
0
;
}
m_max
Spec
=
getProperty
(
"EndWorkspaceIndex"
);
if
(
m_max
Spec
==
EMPTY_INT
())
m_max
Spec
=
max
Spec
Index
;
if
((
m_max
Spec
<
0
)
||
(
m_max
Spec
>
max
Spec
Index
))
{
m_max
WsIndex
=
getProperty
(
"EndWorkspaceIndex"
);
if
(
m_max
WsIndex
==
EMPTY_INT
())
m_max
WsIndex
=
max
Ws
Index
;
if
((
m_max
WsIndex
<
0
)
||
(
m_max
WsIndex
>
max
Ws
Index
))
{
g_log
.
warning
(
"EndSpectrum out of range, changed to max spectrum number"
);
m_max
Spec
=
max
Spec
Index
;
m_max
WsIndex
=
max
Ws
Index
;
}
if
((
m_max
Spec
<
m_min
Spec
))
{
if
((
m_max
WsIndex
<
m_min
WsIndex
))
{
g_log
.
warning
(
"EndSpectrum can not be less than the StartSpectrum, changed "
"to max spectrum number"
);
m_max
Spec
=
max
Spec
Index
;
m_max
WsIndex
=
max
Ws
Index
;
}
m_loFrac
=
getProperty
(
"LowThreshold"
);
...
...
@@ -299,7 +299,7 @@ int MedianDetectorTest::doDetectorTests(
const
double
minSigma
=
getProperty
(
"SignificanceTest"
);
// prepare to report progress
const
int
numSpec
(
m_max
Spec
-
m_min
Spec
);
const
int
numSpec
(
m_max
WsIndex
-
m_min
WsIndex
);
const
int
progStep
=
static_cast
<
int
>
(
ceil
(
numSpec
/
30.0
));
int
steps
(
0
);
...
...
Framework/Algorithms/src/Q1D2.cpp
View file @
c49657f7
...
...
@@ -520,21 +520,21 @@ void Q1D2::addWaveAdj(const double *c, const double *Dc,
}
/** Scaled to bin masking, to the normalization
* @param[in] offSet the inex number of the first bin in the input wavelengths
* @param[in] offSet the in
d
ex number of the first bin in the input wavelengths
* that is actually being used
* @param[in] s
pec
Index the spectrum to calculate
* @param[in]
w
sIndex the spectrum to calculate
* @param[in,out] theNorms normalization for each bin, this is multiplied by the
* proportion that is not masked and the normalization workspace
* @param[in,out] errorSquared the running total of the square of the
* uncertainty in the normalization
*/
void
Q1D2
::
normToMask
(
const
size_t
offSet
,
const
size_t
s
pec
Index
,
void
Q1D2
::
normToMask
(
const
size_t
offSet
,
const
size_t
w
sIndex
,
const
MantidVec
::
iterator
theNorms
,
const
MantidVec
::
iterator
errorSquared
)
const
{
// if any bins are masked it is normally a small proportion
if
(
m_dataWS
->
hasMaskedBins
(
s
pec
Index
))
{
if
(
m_dataWS
->
hasMaskedBins
(
w
sIndex
))
{
// Get a reference to the list of masked bins
const
MatrixWorkspace
::
MaskList
&
mask
=
m_dataWS
->
maskedBins
(
s
pec
Index
);
const
MatrixWorkspace
::
MaskList
&
mask
=
m_dataWS
->
maskedBins
(
w
sIndex
);
// Now iterate over the list, adjusting the weights for the affected bins
MatrixWorkspace
::
MaskList
::
const_iterator
it
;
for
(
it
=
mask
.
begin
();
it
!=
mask
.
end
();
++
it
)
{
...
...
@@ -556,7 +556,7 @@ void Q1D2::normToMask(const size_t offSet, const size_t specIndex,
/** Fills a vector with the Q values calculated from the wavelength bin centers
* from the input workspace and
* the workspace geometry as Q = 4*pi*sin(theta)/lambda
* @param[in] s
pec
Ind the spectrum to calculate
* @param[in]
w
sInd the spectrum to calculate
* @param[in] doGravity if to include gravity in the calculation of Q
* @param[in] offset index number of the first input bin to use
* @param[in] extraLength for gravitational correction
...
...
@@ -565,17 +565,17 @@ void Q1D2::normToMask(const size_t offSet, const size_t specIndex,
* @throw NotFoundError if the detector associated with the spectrum is not
* found in the instrument definition
*/
void
Q1D2
::
convertWavetoQ
(
const
size_t
s
pec
Ind
,
const
bool
doGravity
,
void
Q1D2
::
convertWavetoQ
(
const
size_t
w
sInd
,
const
bool
doGravity
,
const
size_t
offset
,
MantidVec
::
iterator
Qs
,
const
double
extraLength
)
const
{
static
const
double
FOUR_PI
=
4.0
*
M_PI
;
IDetector_const_sptr
det
=
m_dataWS
->
getDetector
(
s
pec
Ind
);
IDetector_const_sptr
det
=
m_dataWS
->
getDetector
(
w
sInd
);
// wavelengths (lamda) to be converted to Q
auto
waves
=
m_dataWS
->
readX
(
s
pec
Ind
).
cbegin
()
+
offset
;
auto
waves
=
m_dataWS
->
readX
(
w
sInd
).
cbegin
()
+
offset
;
// going from bin boundaries to bin centered x-values the size goes down one
const
MantidVec
::
const_iterator
end
=
m_dataWS
->
readX
(
s
pec
Ind
).
end
()
-
1
;
const
MantidVec
::
const_iterator
end
=
m_dataWS
->
readX
(
w
sInd
).
end
()
-
1
;
if
(
doGravity
)
{
GravitySANSHelper
grav
(
m_dataWS
,
det
,
extraLength
);
for
(;
waves
!=
end
;
++
Qs
,
++
waves
)
{
...
...
Framework/Algorithms/src/Qhelper.cpp
View file @
c49657f7
...
...
@@ -144,12 +144,12 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS,
* @param RCut the radius cut off, should be value of the property RadiusCut
* (unit is mm)
* @param WCut this wavelength cut off, should be equal to the value WaveCut
* @param s
pec
Ind spectrum that is being analysed
* @param
w
sInd spectrum that is being analysed
* @return index number of the first bin to include in the calculation
*/
size_t
Qhelper
::
waveLengthCutOff
(
API
::
MatrixWorkspace_const_sptr
dataWS
,
const
double
RCut
,
const
double
WCut
,
const
size_t
s
pec
Ind
)
const
{
const
size_t
w
sInd
)
const
{
double
l_WCutOver
=
0.0
;
double
l_RCut
=
0.0
;
// locally we store RCut in units of meters
if
(
RCut
>
0
&&
WCut
>
0
)
{
...
...
@@ -163,12 +163,12 @@ size_t Qhelper::waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS,
}
// get the distance of between this detector and the origin, which should be
// the along the beam center
const
V3D
posOnBank
=
dataWS
->
getDetector
(
s
pec
Ind
)
->
getPos
();
const
V3D
posOnBank
=
dataWS
->
getDetector
(
w
sInd
)
->
getPos
();
double
R
=
(
posOnBank
.
X
()
*
posOnBank
.
X
())
+
(
posOnBank
.
Y
()
*
posOnBank
.
Y
());
R
=
std
::
sqrt
(
R
);
const
double
WMin
=
l_WCutOver
*
(
l_RCut
-
R
);
const
MantidVec
&
Xs
=
dataWS
->
readX
(
s
pec
Ind
);
const
MantidVec
&
Xs
=
dataWS
->
readX
(
w
sInd
);
return
std
::
lower_bound
(
Xs
.
begin
(),
Xs
.
end
(),
WMin
)
-
Xs
.
begin
();
}
...
...
Framework/Algorithms/src/SumSpectra.cpp
View file @
c49657f7
...
...
@@ -98,7 +98,7 @@ void SumSpectra::exec() {
m_maxSpec
=
m_numberOfSpectra
-
1
;
}
// Something for m_max
Spec
was given but it is out of range?
// Something for m_max
WsIndex
was given but it is out of range?
if
(
!
isEmpty
(
m_maxSpec
)
&&
(
m_maxSpec
>
m_numberOfSpectra
-
1
||
m_maxSpec
<
m_minSpec
))
{
g_log
.
warning
(
"EndWorkspaceIndex out of range! Set to max Workspace Index"
);
...
...
@@ -239,7 +239,7 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace,
numZeros
=
0
;
// Loop over spectra
// for (int i = m_min
Spec
; i <= m_max
Spec
; ++i)
// for (int i = m_min
WsIndex
; i <= m_max
WsIndex
; ++i)
for
(
auto
it
=
this
->
m_indices
.
begin
();
it
!=
this
->
m_indices
.
end
();
++
it
)
{
int
i
=
*
it
;
// Don't go outside the range.
...
...
@@ -353,7 +353,7 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace,
numZeros
=
0
;
// Loop over spectra
// for (int i = m_min
Spec
; i <= m_max
Spec
; ++i)
// for (int i = m_min
WsIndex
; i <= m_max
WsIndex
; ++i)
for
(
auto
it
=
m_indices
.
begin
();
it
!=
m_indices
.
end
();
++
it
)
{
int
i
=
*
it
;
// Don't go outside the range.
...
...
@@ -450,7 +450,7 @@ void SumSpectra::execEvent(EventWorkspace_const_sptr localworkspace,
size_t
numSpectra
(
0
);
size_t
numMasked
(
0
);
size_t
numZeros
(
0
);
// for (int i = m_min
Spec
; i <= m_max
Spec
; ++i)
// for (int i = m_min
WsIndex
; i <= m_max
WsIndex
; ++i)
for
(
auto
it
=
indices
.
begin
();
it
!=
indices
.
end
();
++
it
)
{
int
i
=
*
it
;
// Don't go outside the range.
...
...
Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h
View file @
c49657f7
...
...
@@ -111,7 +111,7 @@ private:
/// Create a minimizer string based on template string provided
std
::
string
getMinimizerString
(
const
std
::
string
&
wsName
,
const
std
::
string
&
s
pec
Index
);
const
std
::
string
&
w
sIndex
);
/// Base name of output workspace
std
::
string
m_baseName
;
...
...
Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp
View file @
c49657f7
...
...
@@ -587,16 +587,16 @@ PlotPeakByLogValue::makeNames() const {
* Formats the minimizer string for a given spectrum from a given workspace.
*
* @param wsName Name of workspace being fitted
* @param s
pec
Index Index of spectrum being fitted
* @param
w
sIndex Index of spectrum being fitted
* @return Formatted minimizer string
*/
std
::
string
PlotPeakByLogValue
::
getMinimizerString
(
const
std
::
string
&
wsName
,
const
std
::
string
&
s
pec
Index
)
{
const
std
::
string
&
w
sIndex
)
{
std
::
string
format
=
getPropertyValue
(
"Minimizer"
);
std
::
string
wsBaseName
=
wsName
+
"_"
+
s
pec
Index
;
std
::
string
wsBaseName
=
wsName
+
"_"
+
w
sIndex
;
boost
::
replace_all
(
format
,
"$wsname"
,
wsName
);
boost
::
replace_all
(
format
,
"$wsindex"
,
s
pec
Index
);
boost
::
replace_all
(
format
,
"$wsindex"
,
w
sIndex
);
boost
::
replace_all
(
format
,
"$basename"
,
wsBaseName
);
boost
::
replace_all
(
format
,
"$outputname"
,
m_baseName
);
...
...
Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h
View file @
c49657f7
...
...
@@ -161,7 +161,7 @@ private:
double
m_FracCompl
;
/// stores lists of spectra indexes to group, although we never do an index
/// search on it
storage_map
m_Group
Spec
Inds
;
storage_map
m_Group
Ws
Inds
;
// Implement abstract Algorithm methods
void
init
()
override
;
...
...
Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h
View file @
c49657f7
...
...
@@ -140,7 +140,7 @@ private:
/// Prepare a vector of SpectraBlock structures to simplify loading
size_t
prepareSpectraBlocks
(
std
::
map
<
int64_t
,
std
::
string
>
&
monitors
,
const
std
::
map
<
int64_t
,
specnum_t
>
&
s
pec
Ind2specNum_map
,
const
std
::
map
<
int64_t
,
specnum_t
>
&
w
sInd2specNum_map
,
const
DataBlock
&
LoadBlock
);
/// Run LoadInstrument as a ChildAlgorithm
void
runLoadInstrument
(
DataObjects
::
Workspace2D_sptr
&
);
...
...
@@ -202,8 +202,8 @@ private:
/// if true, a spectra list or range of spectra is supplied
bool
m_load_selected_spectra
;
/// map of
spectra
Index to spectra Number (spectraID)
std
::
map
<
int64_t
,
specnum_t
>
m_s
pec
Ind2specNum_map
;
/// map of
workspace
Index to spectra Number (spectraID)
std
::
map