Commit c49657f7 authored by Nick Draper's avatar Nick Draper
Browse files

Many updates of specIndex, specInd, spIndex

re #15450
parent f7f9f03c
...@@ -85,8 +85,8 @@ private: ...@@ -85,8 +85,8 @@ private:
void convertToDistribution(API::MatrixWorkspace_sptr workspace); void convertToDistribution(API::MatrixWorkspace_sptr workspace);
void restoreDistributionState(API::MatrixWorkspace_sptr workspace); void restoreDistributionState(API::MatrixWorkspace_sptr workspace);
void checkRange(double &startX, double &endX); void checkRange(double &startX, double &endX);
void getSpecInds(std::vector<int> &output, const int workspaceTotal); void getWsInds(std::vector<int> &output, const int workspaceTotal);
double Mean(const API::MatrixWorkspace_const_sptr WS, const int specInd, double Mean(const API::MatrixWorkspace_const_sptr WS, const int wsInd,
const double startX, const double endX, double &variance) const; const double startX, const double endX, double &variance) const;
double LinearFit(API::MatrixWorkspace_sptr WS, int spectrum, double startX, double LinearFit(API::MatrixWorkspace_sptr WS, int spectrum, double startX,
double endX); double endX);
......
...@@ -86,13 +86,13 @@ private: ...@@ -86,13 +86,13 @@ private:
void getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec, void getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec,
specnum_t mon1Spec, double &monitor0Dist, specnum_t mon1Spec, double &monitor0Dist,
double &monitor1Dist) const; double &monitor1Dist) const;
std::vector<size_t> getMonitorSpecIndexs(API::MatrixWorkspace_const_sptr WS, std::vector<size_t> getMonitorWsIndexs(API::MatrixWorkspace_const_sptr WS,
specnum_t specNum1, specnum_t specNum1,
specnum_t specNum2) const; specnum_t specNum2) const;
double timeToFly(double s, double E_KE) const; double timeToFly(double s, double E_KE) const;
double getPeakCentre(API::MatrixWorkspace_const_sptr WS, double getPeakCentre(API::MatrixWorkspace_const_sptr WS,
const int64_t monitIn, const double peakTime); const int64_t monitIn, const double peakTime);
void extractSpec(int64_t specInd, double start, double end); void extractSpec(int64_t wsInd, double start, double end);
void getPeakEstimates(double &height, int64_t &centreInd, void getPeakEstimates(double &height, int64_t &centreInd,
double &background) const; double &background) const;
double findHalfLoc(MantidVec::size_type startInd, const double height, double findHalfLoc(MantidVec::size_type startInd, const double height,
......
...@@ -108,9 +108,9 @@ private: ...@@ -108,9 +108,9 @@ private:
/// over-reading /// over-reading
double m_hiFrac; double m_hiFrac;
/// The index of the first spectrum to calculate /// The index of the first spectrum to calculate
int m_minSpec; int m_minWsIndex;
/// The index of the last spectrum to calculate /// The index of the last spectrum to calculate
int m_maxSpec; int m_maxWsIndex;
/// Start point for integration /// Start point for integration
double m_rangeLower; double m_rangeLower;
/// End point for integration /// End point for integration
......
...@@ -69,7 +69,7 @@ private: ...@@ -69,7 +69,7 @@ private:
API::MatrixWorkspace_sptr API::MatrixWorkspace_sptr
setUpOutputWorkspace(const std::vector<double> &binParams) const; setUpOutputWorkspace(const std::vector<double> &binParams) const;
// these are the steps that are run on each individual spectrum // these are the steps that are run on each individual spectrum
void calculateNormalization(const size_t wavStart, const size_t specInd, void calculateNormalization(const size_t wavStart, const size_t wsIndex,
API::MatrixWorkspace_const_sptr pixelAdj, API::MatrixWorkspace_const_sptr pixelAdj,
API::MatrixWorkspace_const_sptr wavePixelAdj, API::MatrixWorkspace_const_sptr wavePixelAdj,
double const *const binNorms, double const *const binNorms,
...@@ -77,16 +77,16 @@ private: ...@@ -77,16 +77,16 @@ private:
const MantidVec::iterator norm, const MantidVec::iterator norm,
const MantidVec::iterator normETo2) const; const MantidVec::iterator normETo2) const;
void pixelWeight(API::MatrixWorkspace_const_sptr pixelAdj, void pixelWeight(API::MatrixWorkspace_const_sptr pixelAdj,
const size_t specIndex, double &weight, double &error) const; const size_t wsIndex, double &weight, double &error) const;
void addWaveAdj(const double *c, const double *Dc, MantidVec::iterator bInOut, void addWaveAdj(const double *c, const double *Dc, MantidVec::iterator bInOut,
MantidVec::iterator e2InOut) const; MantidVec::iterator e2InOut) const;
void addWaveAdj(const double *c, const double *Dc, MantidVec::iterator bInOut, void addWaveAdj(const double *c, const double *Dc, MantidVec::iterator bInOut,
MantidVec::iterator e2InOut, MantidVec::const_iterator, MantidVec::iterator e2InOut, MantidVec::const_iterator,
MantidVec::const_iterator) const; MantidVec::const_iterator) const;
void normToMask(const size_t offSet, const size_t specIndex, void normToMask(const size_t offSet, const size_t wsIndex,
const MantidVec::iterator theNorms, const MantidVec::iterator theNorms,
const MantidVec::iterator errorSquared) const; const MantidVec::iterator errorSquared) const;
void convertWavetoQ(const size_t specInd, const bool doGravity, void convertWavetoQ(const size_t wsInd, const bool doGravity,
const size_t offset, MantidVec::iterator Qs, const size_t offset, MantidVec::iterator Qs,
const double extraLength) const; const double extraLength) const;
void getQBinPlus1(const MantidVec &OutQs, const double QToFind, void getQBinPlus1(const MantidVec &OutQs, const double QToFind,
......
...@@ -48,46 +48,14 @@ public: ...@@ -48,46 +48,14 @@ public:
size_t waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS, size_t waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS,
const double RCut, const double WCut, const double RCut, const double WCut,
const size_t specInd) const; const size_t wsInd) const;
void outputParts(API::Algorithm *alg, API::MatrixWorkspace_sptr sumOfCounts, void outputParts(API::Algorithm *alg, API::MatrixWorkspace_sptr sumOfCounts,
API::MatrixWorkspace_sptr sumOfNormFactors); API::MatrixWorkspace_sptr sumOfNormFactors);
private: private:
/// the experimental workspace with counts across the detector /// 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 } // namespace Algorithms
......
...@@ -97,9 +97,9 @@ void CalculateFlatBackground::exec() { ...@@ -97,9 +97,9 @@ void CalculateFlatBackground::exec() {
double startX, endX; double startX, endX;
this->checkRange(startX, endX); this->checkRange(startX, endX);
std::vector<int> specInds = getProperty("WorkspaceIndexList"); std::vector<int> wsInds = getProperty("WorkspaceIndexList");
// check if the user passed an empty list, if so all of spec will be processed // check if the user passed an empty list, if so all of spec will be processed
this->getSpecInds(specInds, numHists); this->getWsInds(wsInds, numHists);
// Are we removing the background? // Are we removing the background?
const bool removeBackground = const bool removeBackground =
...@@ -130,14 +130,14 @@ void CalculateFlatBackground::exec() { ...@@ -130,14 +130,14 @@ void CalculateFlatBackground::exec() {
// these are used to report information to the user, one progress update for // 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 // each percent and a report on the size of the background found
double prg(0.2), backgroundTotal(0); double prg(0.2), backgroundTotal(0);
const double toFitsize(static_cast<double>(specInds.size())); const double toFitsize(static_cast<double>(wsInds.size()));
const int progStep(static_cast<int>(ceil(toFitsize / 80.0))); const int progStep(static_cast<int>(ceil(toFitsize / 80.0)));
// Now loop over the required spectra // Now loop over the required spectra
std::vector<int>::const_iterator specIt; std::vector<int>::const_iterator specIt;
// local cache for global variable // local cache for global variable
bool skipMonitors(m_skipMonitors); bool skipMonitors(m_skipMonitors);
for (specIt = specInds.begin(); specIt != specInds.end(); ++specIt) { for (specIt = wsInds.begin(); specIt != wsInds.end(); ++specIt) {
const int currentSpec = *specIt; const int currentSpec = *specIt;
try { try {
if (skipMonitors) { // this will fail in Windows ReleaseWithDebug info if (skipMonitors) { // this will fail in Windows ReleaseWithDebug info
...@@ -211,7 +211,7 @@ void CalculateFlatBackground::exec() { ...@@ -211,7 +211,7 @@ void CalculateFlatBackground::exec() {
} }
// make regular progress reports and check for canceling the algorithm // make regular progress reports and check for canceling the algorithm
if (static_cast<int>(specInds.end() - specInds.begin()) % progStep == 0) { if (static_cast<int>(wsInds.end() - wsInds.begin()) % progStep == 0) {
interruption_point(); interruption_point();
prg += (progStep * 0.7 / toFitsize); prg += (progStep * 0.7 / toFitsize);
progress(prg); progress(prg);
...@@ -308,7 +308,7 @@ void CalculateFlatBackground::checkRange(double &startX, double &endX) { ...@@ -308,7 +308,7 @@ void CalculateFlatBackground::checkRange(double &startX, double &endX) {
* @param workspaceTotal :: required to be the total number of spectra in the * @param workspaceTotal :: required to be the total number of spectra in the
* workspace * workspace
*/ */
void CalculateFlatBackground::getSpecInds(std::vector<int> &output, void CalculateFlatBackground::getWsInds(std::vector<int> &output,
const int workspaceTotal) { const int workspaceTotal) {
if (output.size() > 0) { if (output.size() > 0) {
return; return;
...@@ -323,7 +323,7 @@ void CalculateFlatBackground::getSpecInds(std::vector<int> &output, ...@@ -323,7 +323,7 @@ void CalculateFlatBackground::getSpecInds(std::vector<int> &output,
* variance (error^2) of that * variance (error^2) of that
* number * number
* @param WS :: points to the input workspace * @param WS :: points to the input workspace
* @param specInd :: index of the spectrum to process * @param wsInd :: index of the spectrum to process
* @param startX :: a X-value in the first bin that will be considered, must not * @param startX :: a X-value in the first bin that will be considered, must not
* be greater endX * be greater endX
* @param endX :: a X-value in the last bin that will be considered, must not * @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, ...@@ -337,11 +337,11 @@ void CalculateFlatBackground::getSpecInds(std::vector<int> &output,
* spectra * spectra
*/ */
double CalculateFlatBackground::Mean(const API::MatrixWorkspace_const_sptr WS, double CalculateFlatBackground::Mean(const API::MatrixWorkspace_const_sptr WS,
const int specInd, const double startX, const int wsInd, const double startX,
const double endX, const double endX,
double &variance) const { double &variance) const {
const MantidVec &XS = WS->readX(specInd), &YS = WS->readY(specInd); const MantidVec &XS = WS->readX(wsInd), &YS = WS->readY(wsInd);
const MantidVec &ES = WS->readE(specInd); const MantidVec &ES = WS->readE(wsInd);
// the function checkRange should already have checked that startX <= endX, // the function checkRange should already have checked that startX <= endX,
// but we still need to check values weren't out side the ranges // but we still need to check values weren't out side the ranges
if (endX > XS.back() || startX < XS.front()) { if (endX > XS.back() || startX < XS.front()) {
......
...@@ -136,8 +136,8 @@ void DetectorEfficiencyVariation::exec() { ...@@ -136,8 +136,8 @@ void DetectorEfficiencyVariation::exec() {
*/ */
void DetectorEfficiencyVariation::retrieveProperties( void DetectorEfficiencyVariation::retrieveProperties(
API::MatrixWorkspace_sptr &whiteBeam1, API::MatrixWorkspace_sptr &whiteBeam1,
API::MatrixWorkspace_sptr &whiteBeam2, double &variation, int &minSpec, API::MatrixWorkspace_sptr &whiteBeam2, double &variation, int &startWsIndex,
int &maxSpec) { int &endWsIndex) {
whiteBeam1 = getProperty("WhiteBeamBase"); whiteBeam1 = getProperty("WhiteBeamBase");
whiteBeam2 = getProperty("WhiteBeamCompare"); whiteBeam2 = getProperty("WhiteBeamCompare");
if (whiteBeam1->getInstrument()->getName() != if (whiteBeam1->getInstrument()->getName() !=
...@@ -145,8 +145,8 @@ void DetectorEfficiencyVariation::retrieveProperties( ...@@ -145,8 +145,8 @@ void DetectorEfficiencyVariation::retrieveProperties(
throw std::invalid_argument("The two input white beam vanadium workspaces " throw std::invalid_argument("The two input white beam vanadium workspaces "
"must be from the same instrument"); "must be from the same instrument");
} }
int maxSpecIndex = static_cast<int>(whiteBeam1->getNumberHistograms()) - 1; int maxWsIndex = static_cast<int>(whiteBeam1->getNumberHistograms()) - 1;
if (maxSpecIndex != if (maxWsIndex !=
static_cast<int>(whiteBeam2->getNumberHistograms()) - static_cast<int>(whiteBeam2->getNumberHistograms()) -
1) { // we would get a crash later on if this were not true 1) { // we would get a crash later on if this were not true
throw std::invalid_argument("The input white beam vanadium workspaces must " throw std::invalid_argument("The input white beam vanadium workspaces must "
...@@ -155,24 +155,24 @@ void DetectorEfficiencyVariation::retrieveProperties( ...@@ -155,24 +155,24 @@ void DetectorEfficiencyVariation::retrieveProperties(
variation = getProperty("Variation"); variation = getProperty("Variation");
minSpec = getProperty("StartWorkspaceIndex"); startWsIndex = getProperty("StartWorkspaceIndex");
if ((minSpec < 0) || (minSpec > maxSpecIndex)) { if ((startWsIndex < 0) || (startWsIndex > maxWsIndex)) {
g_log.warning("StartWorkspaceIndex out of range, changed to 0"); g_log.warning("StartWorkspaceIndex out of range, changed to 0");
minSpec = 0; startWsIndex = 0;
} }
maxSpec = getProperty("EndWorkspaceIndex"); endWsIndex = getProperty("EndWorkspaceIndex");
if (maxSpec == Mantid::EMPTY_INT()) if (endWsIndex == Mantid::EMPTY_INT())
maxSpec = maxSpecIndex; endWsIndex = maxWsIndex;
if ((maxSpec < 0) || (maxSpec > maxSpecIndex)) { if ((endWsIndex < 0) || (endWsIndex > maxWsIndex)) {
g_log.warning( g_log.warning(
"EndWorkspaceIndex out of range, changed to max Workspace number"); "EndWorkspaceIndex out of range, changed to max Workspace number");
maxSpec = maxSpecIndex; endWsIndex = maxWsIndex;
} }
if ((maxSpec < minSpec)) { if ((endWsIndex < startWsIndex)) {
g_log.warning( g_log.warning(
"EndWorkspaceIndex can not be less than the StartWorkspaceIndex, " "EndWorkspaceIndex can not be less than the StartWorkspaceIndex, "
"changed to max Workspace number"); "changed to max Workspace number");
maxSpec = maxSpecIndex; endWsIndex = maxWsIndex;
} }
} }
......
...@@ -847,7 +847,7 @@ int GetDetOffsetsMultiPeaks::fitSpectra( ...@@ -847,7 +847,7 @@ int GetDetOffsetsMultiPeaks::fitSpectra(
// throw if minD >= maxD // throw if minD >= maxD
std::stringstream ess; std::stringstream ess;
ess << "Stuff went wrong with wkspIndex=" << wi ess << "Stuff went wrong with wkspIndex=" << wi
<< " specIndex=" << inputW->getSpectrum(wi)->getSpectrumNo(); << " specNum=" << inputW->getSpectrum(wi)->getSpectrumNo();
throw std::runtime_error(ess.str()); throw std::runtime_error(ess.str());
} }
......
...@@ -108,7 +108,7 @@ void GetEi::exec() { ...@@ -108,7 +108,7 @@ void GetEi::exec() {
<< "%\n"; << "%\n";
// get the histograms created by the monitors // get the histograms created by the monitors
std::vector<size_t> indexes = getMonitorSpecIndexs(inWS, mon1Spec, mon2Spec); std::vector<size_t> indexes = getMonitorWsIndexs(inWS, mon1Spec, mon2Spec);
g_log.information() g_log.information()
<< "Looking for a peak in the first monitor spectrum, spectra index " << "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, ...@@ -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 * @throw NotFoundError if one of the requested spectrum numbers was not found
* in the workspace * in the workspace
*/ */
std::vector<size_t> GetEi::getMonitorSpecIndexs( std::vector<size_t> GetEi::getMonitorWsIndexs(
API::MatrixWorkspace_const_sptr WS, specnum_t specNum1, API::MatrixWorkspace_const_sptr WS, specnum_t specNum1,
specnum_t specNum2) const { // getting spectra numbers from detector IDs is specnum_t specNum2) const { // getting spectra numbers from detector IDs is
// hard because the map works the other way, // hard because the map works the other way,
...@@ -223,7 +223,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs( ...@@ -223,7 +223,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
// workspace, we can't continue from here // workspace, we can't continue from here
g_log.error() << "Couldn't find the first monitor spectrum, number " g_log.error() << "Couldn't find the first monitor spectrum, number "
<< specNum1 << std::endl; << specNum1 << std::endl;
throw Exception::NotFoundError("GetEi::getMonitorSpecIndexs()", specNum1); throw Exception::NotFoundError("GetEi::getMonitorWsIndexs()", specNum1);
} }
// nowe the second monitor // nowe the second monitor
...@@ -233,7 +233,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs( ...@@ -233,7 +233,7 @@ std::vector<size_t> GetEi::getMonitorSpecIndexs(
// workspace, we can't continue from here // workspace, we can't continue from here
g_log.error() << "Couldn't find the second monitor spectrum, number " g_log.error() << "Couldn't find the second monitor spectrum, number "
<< specNum2 << std::endl; << specNum2 << std::endl;
throw Exception::NotFoundError("GetEi::getMonitorSpecIndexs()", specNum2); throw Exception::NotFoundError("GetEi::getMonitorWsIndexs()", specNum2);
} }
wsInds.push_back(specNumTemp[0]); wsInds.push_back(specNumTemp[0]);
...@@ -307,17 +307,17 @@ double GetEi::getPeakCentre(API::MatrixWorkspace_const_sptr WS, ...@@ -307,17 +307,17 @@ double GetEi::getPeakCentre(API::MatrixWorkspace_const_sptr WS,
} }
/** Calls CropWorkspace as a Child Algorithm and passes to it the InputWorkspace /** Calls CropWorkspace as a Child Algorithm and passes to it the InputWorkspace
* property * property
* @param specInd :: the index number of the histogram to extract * @param wsInd :: the index number of the histogram to extract
* @param start :: the number of the first bin to include (starts counting bins * @param start :: the number of the first bin to include (starts counting bins
* at 0) * at 0)
* @param end :: the number of the last bin to include (starts counting bins at * @param end :: the number of the last bin to include (starts counting bins at
* 0) * 0)
* @throw out_of_range if start, end or specInd are set outside of the vaild * @throw out_of_range if start, end or wsInd are set outside of the valid
* range for the workspace * range for the workspace
* @throw runtime_error if the algorithm just falls over * @throw runtime_error if the algorithm just falls over
* @throw invalid_argument if the input workspace does not have common binning * @throw invalid_argument if the input workspace does not have common binning
*/ */
void GetEi::extractSpec(int64_t specInd, double start, double end) { void GetEi::extractSpec(int64_t wsInd, double start, double end) {
IAlgorithm_sptr childAlg = createChildAlgorithm( IAlgorithm_sptr childAlg = createChildAlgorithm(
"CropWorkspace", 100 * m_fracCompl, 100 * (m_fracCompl + CROP)); "CropWorkspace", 100 * m_fracCompl, 100 * (m_fracCompl + CROP));
m_fracCompl += CROP; m_fracCompl += CROP;
...@@ -326,8 +326,8 @@ void GetEi::extractSpec(int64_t specInd, double start, double end) { ...@@ -326,8 +326,8 @@ void GetEi::extractSpec(int64_t specInd, double start, double end) {
getProperty("InputWorkspace")); getProperty("InputWorkspace"));
childAlg->setProperty("XMin", start); childAlg->setProperty("XMin", start);
childAlg->setProperty("XMax", end); childAlg->setProperty("XMax", end);
childAlg->setProperty("StartWorkspaceIndex", specInd); childAlg->setProperty("StartWorkspaceIndex", wsInd);
childAlg->setProperty("EndWorkspaceIndex", specInd); childAlg->setProperty("EndWorkspaceIndex", wsInd);
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
m_tempWS = childAlg->getProperty("OutputWorkspace"); m_tempWS = childAlg->getProperty("OutputWorkspace");
......
...@@ -344,7 +344,7 @@ double GetEi2::calculatePeakPosition(size_t ws_index, double t_min, ...@@ -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 * @param end :: the number of the last bin to include (starts counting bins at
* 0) * 0)
* @return The cropped workspace * @return The cropped workspace
* @throw out_of_range if start, end or specInd are set outside of the vaild * @throw out_of_range if start, end or ws_index are set outside of the valid
* range for the workspace * range for the workspace
* @throw runtime_error if the algorithm just falls over * @throw runtime_error if the algorithm just falls over
* @throw invalid_argument if the input workspace does not have common binning * @throw invalid_argument if the input workspace does not have common binning
......
...@@ -17,7 +17,7 @@ using namespace Geometry; ...@@ -17,7 +17,7 @@ using namespace Geometry;
/// Default constructor /// Default constructor
MedianDetectorTest::MedianDetectorTest() MedianDetectorTest::MedianDetectorTest()
: DetectorDiagnostic(), m_inputWS(), m_loFrac(0.1), m_hiFrac(1.5), : DetectorDiagnostic(), m_inputWS(), m_loFrac(0.1), m_hiFrac(1.5),
m_minSpec(0), m_maxSpec(EMPTY_INT()), m_rangeLower(0.0), m_minWsIndex(0), m_maxWsIndex(EMPTY_INT()), m_rangeLower(0.0),
m_rangeUpper(0.0), m_solidAngle(false) {} m_rangeUpper(0.0), m_solidAngle(false) {}
const std::string MedianDetectorTest::category() const { return "Diagnostics"; } const std::string MedianDetectorTest::category() const { return "Diagnostics"; }
...@@ -96,11 +96,11 @@ void MedianDetectorTest::exec() { ...@@ -96,11 +96,11 @@ void MedianDetectorTest::exec() {
// masking and will be used to record any // masking and will be used to record any
// required masking from this algorithm // required masking from this algorithm
MatrixWorkspace_sptr countsWS = integrateSpectra( MatrixWorkspace_sptr countsWS = integrateSpectra(
m_inputWS, m_minSpec, m_maxSpec, m_rangeLower, m_rangeUpper, true); m_inputWS, m_minWsIndex, m_maxWsIndex, m_rangeLower, m_rangeUpper, true);
// 0. Correct for solid angle, if desired // 0. Correct for solid angle, if desired
if (m_solidAngle) { if (m_solidAngle) {
MatrixWorkspace_sptr solidAngle = getSolidAngles(m_minSpec, m_maxSpec); MatrixWorkspace_sptr solidAngle = getSolidAngles(m_minWsIndex, m_maxWsIndex);
if (solidAngle != nullptr) { if (solidAngle != nullptr) {
countsWS = countsWS / solidAngle; countsWS = countsWS / solidAngle;
} }
...@@ -145,25 +145,25 @@ void MedianDetectorTest::exec() { ...@@ -145,25 +145,25 @@ void MedianDetectorTest::exec() {
*/ */
void MedianDetectorTest::retrieveProperties() { void MedianDetectorTest::retrieveProperties() {
m_inputWS = getProperty("InputWorkspace"); m_inputWS = getProperty("InputWorkspace");
int maxSpecIndex = static_cast<int>(m_inputWS->getNumberHistograms()) - 1; int maxWsIndex = static_cast<int>(m_inputWS->getNumberHistograms()) - 1;
m_parents = getProperty("LevelsUp"); m_parents = getProperty("LevelsUp");
m_minSpec = getProperty("StartWorkspaceIndex"); m_minWsIndex = getProperty("StartWorkspaceIndex");
if ((m_minSpec < 0) || (m_minSpec > maxSpecIndex)) { if ((m_minWsIndex < 0) || (m_minWsIndex > maxWsIndex)) {
g_log.warning("StartSpectrum out of range, changed to 0"); g_log.warning("StartSpectrum out of range, changed to 0");
m_minSpec = 0; m_minWsIndex = 0;
} }
m_maxSpec = getProperty("EndWorkspaceIndex"); m_maxWsIndex = getProperty("EndWorkspaceIndex");
if (m_maxSpec == EMPTY_INT()) if (m_maxWsIndex == EMPTY_INT())
m_maxSpec = maxSpecIndex; m_maxWsIndex = maxWsIndex;
if ((m_maxSpec < 0) || (m_maxSpec > maxSpecIndex)) { if ((m_maxWsIndex < 0) || (m_maxWsIndex > maxWsIndex)) {
g_log.warning("EndSpectrum out of range, changed to max spectrum number"); g_log.warning("EndSpectrum out of range, changed to max spectrum number");
m_maxSpec = maxSpecIndex; m_maxWsIndex = maxWsIndex;
} }
if ((m_maxSpec < m_minSpec)) { if ((m_maxWsIndex < m_minWsIndex)) {
g_log.warning("EndSpectrum can not be less than the StartSpectrum, changed " g_log.warning("EndSpectrum can not be less than the StartSpectrum, changed "
"to max spectrum number"); "to max spectrum number");
m_maxSpec = maxSpecIndex; m_maxWsIndex = maxWsIndex;
} }
m_loFrac = getProperty("LowThreshold"); m_loFrac = getProperty("LowThreshold");
...@@ -299,7 +299,7 @@ int MedianDetectorTest::doDetectorTests( ...@@ -299,7 +299,7 @@ int MedianDetectorTest::doDetectorTests(
const double minSigma = getProperty("SignificanceTest"); const double minSigma = getProperty("SignificanceTest");
// prepare to report progress // prepare to report progress
const int numSpec(m_maxSpec - m_minSpec); const int numSpec(m_maxWsIndex - m_minWsIndex);
const int progStep = static_cast<int>(ceil(numSpec / 30.0)); const int progStep = static_cast<int>(ceil(numSpec / 30.0));
int steps(0); int steps(0);
......
...@@ -520,21 +520,21 @@ void Q1D2::addWaveAdj(const double *c, const double *Dc, ...@@ -520,21 +520,21 @@ void Q1D2::addWaveAdj(const double *c, const double *Dc,
} }
/** Scaled to bin masking, to the normalization /** 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 index number of the first bin in the input wavelengths
* that is actually being used * that is actually being used
* @param[in] specIndex the spectrum to calculate * @param[in] wsIndex the spectrum to calculate