From c49657f78f01a9ed71260391baf3dbf32de4bcd0 Mon Sep 17 00:00:00 2001 From: Nick Draper <nick.draper@stfc.ac.uk> Date: Fri, 26 Feb 2016 16:14:57 +0000 Subject: [PATCH] Many updates of specIndex, specInd, spIndex re #15450 --- .../CalculateFlatBackground.h | 4 +- .../Algorithms/inc/MantidAlgorithms/GetEi.h | 4 +- .../inc/MantidAlgorithms/MedianDetectorTest.h | 4 +- .../Algorithms/inc/MantidAlgorithms/Q1D2.h | 8 +- .../Algorithms/inc/MantidAlgorithms/Qhelper.h | 36 +-------- .../src/CalculateFlatBackground.cpp | 20 ++--- .../src/DetectorEfficiencyVariation.cpp | 28 +++---- .../src/GetDetOffsetsMultiPeaks.cpp | 2 +- Framework/Algorithms/src/GetEi.cpp | 18 ++--- Framework/Algorithms/src/GetEi2.cpp | 2 +- .../Algorithms/src/MedianDetectorTest.cpp | 30 +++---- Framework/Algorithms/src/Q1D2.cpp | 20 ++--- Framework/Algorithms/src/Qhelper.cpp | 8 +- Framework/Algorithms/src/SumSpectra.cpp | 8 +- .../Algorithms/PlotPeakByLogValue.h | 2 +- .../src/Algorithms/PlotPeakByLogValue.cpp | 8 +- .../inc/MantidDataHandling/GroupDetectors2.h | 2 +- .../inc/MantidDataHandling/LoadISISNexus2.h | 6 +- .../inc/MantidDataHandling/SaveSPE.h | 2 +- .../DataHandling/src/GroupDetectors2.cpp | 80 +++++++++---------- Framework/DataHandling/src/LoadISISNexus2.cpp | 38 ++++----- .../DataHandling/src/LoadNexusMonitors2.cpp | 18 ++--- Framework/DataHandling/src/SaveSPE.cpp | 6 +- .../plugins/algorithms/EnggFitPeaks.py | 2 +- .../plugins/algorithms/MSDFit.py | 4 +- .../IndirectTransmissionMonitor.py | 4 +- .../MantidQtAPI/QwtWorkspaceSpectrumData.h | 4 +- MantidQt/API/src/QwtWorkspaceSpectrumData.cpp | 12 +-- .../Indirect/ApplyPaalmanPings.h | 2 +- .../Indirect/ContainerSubtraction.h | 2 +- .../Indirect/IndirectTab.h | 6 +- .../CustomInterfaces/src/DataComparison.cpp | 16 ++-- .../src/Indirect/ApplyPaalmanPings.cpp | 14 ++-- .../src/Indirect/ContainerSubtraction.cpp | 14 ++-- .../CustomInterfaces/src/Indirect/ConvFit.cpp | 10 +-- .../src/Indirect/IndirectTab.cpp | 18 ++--- .../CustomInterfaces/src/Indirect/IqtFit.cpp | 10 +-- .../CustomInterfaces/src/Indirect/MSDFit.cpp | 10 +-- .../inc/MantidQtMantidWidgets/PreviewPlot.h | 6 +- .../algorithms/CalMuonDetectorPhases-v1.rst | 4 +- .../algorithms/CopyDetectorMapping-v1.rst | 2 +- docs/source/algorithms/GroupDetectors-v1.rst | 4 +- .../algorithms/PlotPeakByLogValue-v1.rst | 2 +- docs/source/interfaces/DataComparison.rst | 10 +-- 44 files changed, 239 insertions(+), 271 deletions(-) diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h index 19e133456a0..de26795826f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateFlatBackground.h @@ -85,8 +85,8 @@ private: void convertToDistribution(API::MatrixWorkspace_sptr workspace); void restoreDistributionState(API::MatrixWorkspace_sptr workspace); void checkRange(double &startX, double &endX); - void getSpecInds(std::vector<int> &output, const int workspaceTotal); - double Mean(const API::MatrixWorkspace_const_sptr WS, const int specInd, + void getWsInds(std::vector<int> &output, const int workspaceTotal); + double Mean(const API::MatrixWorkspace_const_sptr WS, const int wsInd, const double startX, const double endX, double &variance) const; double LinearFit(API::MatrixWorkspace_sptr WS, int spectrum, double startX, double endX); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h b/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h index 767cfe75131..56e27550cbd 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h @@ -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> getMonitorSpecIndexs(API::MatrixWorkspace_const_sptr WS, + std::vector<size_t> getMonitorWsIndexs(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 specInd, double start, double end); + void extractSpec(int64_t wsInd, double start, double end); void getPeakEstimates(double &height, int64_t ¢reInd, double &background) const; double findHalfLoc(MantidVec::size_type startInd, const double height, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h b/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h index 1eae85511e9..ca8fa632926 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h @@ -108,9 +108,9 @@ private: /// over-reading double m_hiFrac; /// The index of the first spectrum to calculate - int m_minSpec; + int m_minWsIndex; /// The index of the last spectrum to calculate - int m_maxSpec; + int m_maxWsIndex; /// Start point for integration double m_rangeLower; /// End point for integration diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h b/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h index 524f337d584..757d69dcd1e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h @@ -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 specInd, + void calculateNormalization(const size_t wavStart, const size_t wsIndex, 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 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, 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 specIndex, + void normToMask(const size_t offSet, const size_t wsIndex, const MantidVec::iterator theNorms, 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 double extraLength) const; void getQBinPlus1(const MantidVec &OutQs, const double QToFind, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h b/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h index 1bfb19eec54..31ea20c0a7e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h @@ -48,46 +48,14 @@ public: size_t waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS, 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, 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 diff --git a/Framework/Algorithms/src/CalculateFlatBackground.cpp b/Framework/Algorithms/src/CalculateFlatBackground.cpp index 77c7133582e..dbada54f0c7 100644 --- a/Framework/Algorithms/src/CalculateFlatBackground.cpp +++ b/Framework/Algorithms/src/CalculateFlatBackground.cpp @@ -97,9 +97,9 @@ void CalculateFlatBackground::exec() { double 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 - this->getSpecInds(specInds, numHists); + this->getWsInds(wsInds, 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>(specInds.size())); + const double toFitsize(static_cast<double>(wsInds.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 = specInds.begin(); specIt != specInds.end(); ++specIt) { + for (specIt = wsInds.begin(); specIt != wsInds.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>(specInds.end() - specInds.begin()) % progStep == 0) { + if (static_cast<int>(wsInds.end() - wsInds.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::getSpecInds(std::vector<int> &output, +void CalculateFlatBackground::getWsInds(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 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 * 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 specInd, const double startX, + const int wsInd, const double startX, const double endX, double &variance) const { - const MantidVec &XS = WS->readX(specInd), &YS = WS->readY(specInd); - const MantidVec &ES = WS->readE(specInd); + const MantidVec &XS = WS->readX(wsInd), &YS = WS->readY(wsInd); + const MantidVec &ES = WS->readE(wsInd); // 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()) { diff --git a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp index ce73a8be47c..7f3bc29f328 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp @@ -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 maxSpecIndex = static_cast<int>(whiteBeam1->getNumberHistograms()) - 1; - if (maxSpecIndex != + int maxWsIndex = static_cast<int>(whiteBeam1->getNumberHistograms()) - 1; + if (maxWsIndex != 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 > maxSpecIndex)) { + startWsIndex = getProperty("StartWorkspaceIndex"); + if ((startWsIndex < 0) || (startWsIndex > maxWsIndex)) { g_log.warning("StartWorkspaceIndex out of range, changed to 0"); - minSpec = 0; + startWsIndex = 0; } - maxSpec = getProperty("EndWorkspaceIndex"); - if (maxSpec == Mantid::EMPTY_INT()) - maxSpec = maxSpecIndex; - if ((maxSpec < 0) || (maxSpec > maxSpecIndex)) { + endWsIndex = getProperty("EndWorkspaceIndex"); + if (endWsIndex == Mantid::EMPTY_INT()) + endWsIndex = maxWsIndex; + if ((endWsIndex < 0) || (endWsIndex > maxWsIndex)) { g_log.warning( "EndWorkspaceIndex out of range, changed to max Workspace number"); - maxSpec = maxSpecIndex; + endWsIndex = maxWsIndex; } - if ((maxSpec < minSpec)) { + if ((endWsIndex < startWsIndex)) { g_log.warning( "EndWorkspaceIndex can not be less than the StartWorkspaceIndex, " "changed to max Workspace number"); - maxSpec = maxSpecIndex; + endWsIndex = maxWsIndex; } } diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index dc555af11fc..924a3ca1733 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -847,7 +847,7 @@ int GetDetOffsetsMultiPeaks::fitSpectra( // throw if minD >= maxD std::stringstream ess; ess << "Stuff went wrong with wkspIndex=" << wi - << " specIndex=" << inputW->getSpectrum(wi)->getSpectrumNo(); + << " specNum=" << inputW->getSpectrum(wi)->getSpectrumNo(); throw std::runtime_error(ess.str()); } diff --git a/Framework/Algorithms/src/GetEi.cpp b/Framework/Algorithms/src/GetEi.cpp index 8813fb4656b..dc0ef292a9c 100644 --- a/Framework/Algorithms/src/GetEi.cpp +++ b/Framework/Algorithms/src/GetEi.cpp @@ -108,7 +108,7 @@ void GetEi::exec() { << "%\n"; // 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() << "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::getMonitorSpecIndexs( +std::vector<size_t> GetEi::getMonitorWsIndexs( 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::getMonitorSpecIndexs()", specNum1); + throw Exception::NotFoundError("GetEi::getMonitorWsIndexs()", 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::getMonitorSpecIndexs()", specNum2); + throw Exception::NotFoundError("GetEi::getMonitorWsIndexs()", 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 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 * 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 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 * @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 specInd, double start, double end) { +void GetEi::extractSpec(int64_t wsInd, 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", specInd); - childAlg->setProperty("EndWorkspaceIndex", specInd); + childAlg->setProperty("StartWorkspaceIndex", wsInd); + childAlg->setProperty("EndWorkspaceIndex", wsInd); childAlg->executeAsChildAlg(); m_tempWS = childAlg->getProperty("OutputWorkspace"); diff --git a/Framework/Algorithms/src/GetEi2.cpp b/Framework/Algorithms/src/GetEi2.cpp index 39d7ec2ebba..fa67e7b7f81 100644 --- a/Framework/Algorithms/src/GetEi2.cpp +++ b/Framework/Algorithms/src/GetEi2.cpp @@ -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 vaild + * @throw out_of_range if start, end or ws_index are set outside of the valid * 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 diff --git a/Framework/Algorithms/src/MedianDetectorTest.cpp b/Framework/Algorithms/src/MedianDetectorTest.cpp index 1ddd7ae0b5d..e9b40b3cc07 100644 --- a/Framework/Algorithms/src/MedianDetectorTest.cpp +++ b/Framework/Algorithms/src/MedianDetectorTest.cpp @@ -17,7 +17,7 @@ using namespace Geometry; /// Default constructor MedianDetectorTest::MedianDetectorTest() : 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) {} 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_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 if (m_solidAngle) { - MatrixWorkspace_sptr solidAngle = getSolidAngles(m_minSpec, m_maxSpec); + MatrixWorkspace_sptr solidAngle = getSolidAngles(m_minWsIndex, m_maxWsIndex); if (solidAngle != nullptr) { countsWS = countsWS / solidAngle; } @@ -145,25 +145,25 @@ void MedianDetectorTest::exec() { */ void MedianDetectorTest::retrieveProperties() { 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_minSpec = getProperty("StartWorkspaceIndex"); - if ((m_minSpec < 0) || (m_minSpec > maxSpecIndex)) { + m_minWsIndex = getProperty("StartWorkspaceIndex"); + if ((m_minWsIndex < 0) || (m_minWsIndex > maxWsIndex)) { g_log.warning("StartSpectrum out of range, changed to 0"); - m_minSpec = 0; + m_minWsIndex = 0; } - m_maxSpec = getProperty("EndWorkspaceIndex"); - if (m_maxSpec == EMPTY_INT()) - m_maxSpec = maxSpecIndex; - if ((m_maxSpec < 0) || (m_maxSpec > maxSpecIndex)) { + m_maxWsIndex = getProperty("EndWorkspaceIndex"); + if (m_maxWsIndex == EMPTY_INT()) + m_maxWsIndex = maxWsIndex; + if ((m_maxWsIndex < 0) || (m_maxWsIndex > maxWsIndex)) { 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 " "to max spectrum number"); - m_maxSpec = maxSpecIndex; + m_maxWsIndex = maxWsIndex; } m_loFrac = getProperty("LowThreshold"); @@ -299,7 +299,7 @@ int MedianDetectorTest::doDetectorTests( const double minSigma = getProperty("SignificanceTest"); // 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)); int steps(0); diff --git a/Framework/Algorithms/src/Q1D2.cpp b/Framework/Algorithms/src/Q1D2.cpp index 76cfb294f80..9953d783cac 100644 --- a/Framework/Algorithms/src/Q1D2.cpp +++ b/Framework/Algorithms/src/Q1D2.cpp @@ -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 index number of the first bin in the input wavelengths * that is actually being used -* @param[in] specIndex the spectrum to calculate +* @param[in] wsIndex 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 specIndex, +void Q1D2::normToMask(const size_t offSet, const size_t wsIndex, const MantidVec::iterator theNorms, const MantidVec::iterator errorSquared) const { // if any bins are masked it is normally a small proportion - if (m_dataWS->hasMaskedBins(specIndex)) { + if (m_dataWS->hasMaskedBins(wsIndex)) { // Get a reference to the list of masked bins - const MatrixWorkspace::MaskList &mask = m_dataWS->maskedBins(specIndex); + const MatrixWorkspace::MaskList &mask = m_dataWS->maskedBins(wsIndex); // 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] specInd the spectrum to calculate +* @param[in] wsInd 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 specInd, const bool doGravity, +void Q1D2::convertWavetoQ(const size_t wsInd, 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(specInd); + IDetector_const_sptr det = m_dataWS->getDetector(wsInd); // wavelengths (lamda) to be converted to Q - auto waves = m_dataWS->readX(specInd).cbegin() + offset; + auto waves = m_dataWS->readX(wsInd).cbegin() + offset; // going from bin boundaries to bin centered x-values the size goes down one - const MantidVec::const_iterator end = m_dataWS->readX(specInd).end() - 1; + const MantidVec::const_iterator end = m_dataWS->readX(wsInd).end() - 1; if (doGravity) { GravitySANSHelper grav(m_dataWS, det, extraLength); for (; waves != end; ++Qs, ++waves) { diff --git a/Framework/Algorithms/src/Qhelper.cpp b/Framework/Algorithms/src/Qhelper.cpp index 5e56dae7006..e27b86cc2fc 100644 --- a/Framework/Algorithms/src/Qhelper.cpp +++ b/Framework/Algorithms/src/Qhelper.cpp @@ -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 specInd spectrum that is being analysed +* @param wsInd 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 specInd) const { + const size_t wsInd) 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(specInd)->getPos(); + const V3D posOnBank = dataWS->getDetector(wsInd)->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(specInd); + const MantidVec &Xs = dataWS->readX(wsInd); return std::lower_bound(Xs.begin(), Xs.end(), WMin) - Xs.begin(); } diff --git a/Framework/Algorithms/src/SumSpectra.cpp b/Framework/Algorithms/src/SumSpectra.cpp index b074affc596..ce3dacbc222 100644 --- a/Framework/Algorithms/src/SumSpectra.cpp +++ b/Framework/Algorithms/src/SumSpectra.cpp @@ -98,7 +98,7 @@ void SumSpectra::exec() { m_maxSpec = m_numberOfSpectra - 1; } - // Something for m_maxSpec was given but it is out of range? + // Something for m_maxWsIndex 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_minSpec; i <= m_maxSpec; ++i) + // for (int i = m_minWsIndex; i <= m_maxWsIndex; ++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_minSpec; i <= m_maxSpec; ++i) + // for (int i = m_minWsIndex; i <= m_maxWsIndex; ++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_minSpec; i <= m_maxSpec; ++i) + // for (int i = m_minWsIndex; i <= m_maxWsIndex; ++i) for (auto it = indices.begin(); it != indices.end(); ++it) { int i = *it; // Don't go outside the range. diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h index 45a48ed3acb..f735f63e4ae 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h @@ -111,7 +111,7 @@ private: /// Create a minimizer string based on template string provided std::string getMinimizerString(const std::string &wsName, - const std::string &specIndex); + const std::string &wsIndex); /// Base name of output workspace std::string m_baseName; diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index d4d4c0e08cc..1252b5e4ea0 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -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 specIndex Index of spectrum being fitted + * @param wsIndex Index of spectrum being fitted * @return Formatted minimizer string */ std::string PlotPeakByLogValue::getMinimizerString(const std::string &wsName, - const std::string &specIndex) { + const std::string &wsIndex) { std::string format = getPropertyValue("Minimizer"); - std::string wsBaseName = wsName + "_" + specIndex; + std::string wsBaseName = wsName + "_" + wsIndex; boost::replace_all(format, "$wsname", wsName); - boost::replace_all(format, "$wsindex", specIndex); + boost::replace_all(format, "$wsindex", wsIndex); boost::replace_all(format, "$basename", wsBaseName); boost::replace_all(format, "$outputname", m_baseName); diff --git a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h index 6cd4182c325..5869e7f1ebe 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h @@ -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_GroupSpecInds; + storage_map m_GroupWsInds; // Implement abstract Algorithm methods void init() override; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h index ac114c48168..f6de811033b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h @@ -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> &specInd2specNum_map, + const std::map<int64_t, specnum_t> &wsInd2specNum_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_specInd2specNum_map; + /// map of workspace Index to spectra Number (spectraID) + std::map<int64_t, specnum_t> m_wsInd2specNum_map; /// spectra Number to detector ID (multi)map API::SpectrumDetectorMapping m_spec2det_map; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h b/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h index 3fcab90edf4..b7ace77d642 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h @@ -74,7 +74,7 @@ private: void writeHists(const API::MatrixWorkspace_const_sptr WS, FILE *const outFile); void writeHist(const API::MatrixWorkspace_const_sptr WS, FILE *const outFile, - const int specIn) const; + const int wsIn) const; void writeMaskFlags(FILE *const outFile) const; void writeBins(const MantidVec &Vs, FILE *const outFile) const; void writeValue(const double value, FILE *const outFile) const; diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 83e41544354..a301dc1c41e 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -147,7 +147,7 @@ void GroupDetectors2::exec() { const size_t numUnGrouped = keepAll ? unGroupedSet.size() - 1 : 0; MatrixWorkspace_sptr outputWS = WorkspaceFactory::Instance().create( - inputWS, m_GroupSpecInds.size() + numUnGrouped, inputWS->readX(0).size(), + inputWS, m_GroupWsInds.size() + numUnGrouped, inputWS->readX(0).size(), inputWS->blocksize()); // prepare to move the requested histograms into groups, first estimate how @@ -213,7 +213,7 @@ void GroupDetectors2::execEvent() { // Make a brand new EventWorkspace EventWorkspace_sptr outputWS = boost::dynamic_pointer_cast<EventWorkspace>( WorkspaceFactory::Instance().create( - "EventWorkspace", m_GroupSpecInds.size() + numUnGrouped, + "EventWorkspace", m_GroupWsInds.size() + numUnGrouped, inputWS->readX(0).size(), inputWS->blocksize())); // Copy geometry over. WorkspaceFactory::Instance().initializeFromParent(inputWS, outputWS, true); @@ -257,7 +257,7 @@ void GroupDetectors2::execEvent() { void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, std::vector<int64_t> &unUsedSpec) { // this is the map that we are going to fill - m_GroupSpecInds.clear(); + m_GroupWsInds.clear(); // There are several properties that may contain the user data go through them // in order of precedence @@ -333,7 +333,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, // only look at these other parameters if the file wasn't set if (!spectraList.empty()) { - m_GroupSpecInds[0] = workspace->getIndicesFromSpectra(spectraList); + m_GroupWsInds[0] = workspace->getIndicesFromSpectra(spectraList); g_log.debug() << "Converted " << spectraList.size() << " spectra numbers into spectra indices to be combined\n"; } else { // go through the rest of the properties in order of decreasing @@ -341,18 +341,18 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, if (!detectorList.empty()) { // we are going to group on the basis of detector IDs, convert from // detectors to workspace indices - m_GroupSpecInds[0] = workspace->getIndicesFromDetectorIDs(detectorList); - g_log.debug() << "Found " << m_GroupSpecInds[0].size() + m_GroupWsInds[0] = workspace->getIndicesFromDetectorIDs(detectorList); + g_log.debug() << "Found " << m_GroupWsInds[0].size() << " spectra indices from the list of " << detectorList.size() << " detectors\n"; } else if (!indexList.empty()) { - m_GroupSpecInds[0] = indexList; - g_log.debug() << "Read in " << m_GroupSpecInds[0].size() + m_GroupWsInds[0] = indexList; + g_log.debug() << "Read in " << m_GroupWsInds[0].size() << " spectra indices to be combined\n"; } // check we don't have an index that is too high for the workspace size_t maxIn = static_cast<size_t>(workspace->getNumberHistograms() - 1); - auto indices0 = m_GroupSpecInds[0]; + auto indices0 = m_GroupWsInds[0]; auto it = indices0.begin(); for (; it != indices0.end(); ++it) { if (*it > maxIn) { @@ -365,7 +365,7 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, } } - if (m_GroupSpecInds[0].empty()) { + if (m_GroupWsInds[0].empty()) { g_log.information() << name() << ": File, WorkspaceIndexList, SpectraList, " "and DetectorList properties are all " "empty\n"; @@ -375,10 +375,10 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, // up date unUsedSpec, this is used to find duplicates and when the user has // set KeepUngroupedSpectra - auto indices0 = m_GroupSpecInds[0]; + auto indices0 = m_GroupWsInds[0]; auto index = indices0.begin(); for (; index != indices0.end(); - ++index) { // the vector<int> m_GroupSpecInds[0] must not index contain + ++index) { // the vector<int> m_GroupWsInds[0] must not index contain // numbers that don't exist in the workspaace if (unUsedSpec[*index] != USED) { unUsedSpec[*index] = USED; @@ -443,10 +443,10 @@ void GroupDetectors2::processFile(std::string fname, bool ignoreGroupNo = getProperty("IgnoreGroupNumber"); readFile(specs2index, File, lineNum, unUsedSpec, ignoreGroupNo); - if (m_GroupSpecInds.size() != static_cast<size_t>(totalNumberOfGroups)) { + if (m_GroupWsInds.size() != static_cast<size_t>(totalNumberOfGroups)) { g_log.warning() << "The input file header states there are " << totalNumberOfGroups << " but the file contains " - << m_GroupSpecInds.size() << " groups\n"; + << m_GroupWsInds.size() << " groups\n"; } } // add some more info to the error messages, including the line number, to @@ -474,8 +474,8 @@ void GroupDetectors2::processFile(std::string fname, } File.close(); g_log.debug() << "Closed file " << fname << " after reading in " - << m_GroupSpecInds.size() << " groups\n"; - m_FracCompl += fileReadProg(m_GroupSpecInds.size(), specs2index.size()); + << m_GroupWsInds.size() << " groups\n"; + m_FracCompl += fileReadProg(m_GroupWsInds.size(), specs2index.size()); return; } @@ -510,9 +510,9 @@ void GroupDetectors2::processXMLFile(std::string fname, std::map<int, std::vector<int>> mGroupSpectraMap = loader.getGroupSpectraMap(); - // 3. Build m_GroupSpecInds + // 3. Build m_GroupWsInds for (const auto &det : mGroupDetectorsMap) { - m_GroupSpecInds.emplace(det.first, std::vector<size_t>()); + m_GroupWsInds.emplace(det.first, std::vector<size_t>()); } // 4. Detector IDs @@ -520,8 +520,8 @@ void GroupDetectors2::processXMLFile(std::string fname, int groupid = det.first; const std::vector<detid_t> &detids = det.second; - auto sit = m_GroupSpecInds.find(groupid); - if (sit == m_GroupSpecInds.end()) + auto sit = m_GroupWsInds.find(groupid); + if (sit == m_GroupWsInds.end()) continue; std::vector<size_t> &wsindexes = sit->second; @@ -548,8 +548,8 @@ void GroupDetectors2::processXMLFile(std::string fname, std::vector<int> spectra = pit->second; storage_map::iterator sit; - sit = m_GroupSpecInds.find(groupid); - if (sit == m_GroupSpecInds.end()) + sit = m_GroupWsInds.find(groupid); + if (sit == m_GroupWsInds.end()) continue; std::vector<size_t> &wsindexes = sit->second; @@ -629,13 +629,13 @@ void GroupDetectors2::processGroupingWorkspace( } } - // Build m_GroupSpecInds (group -> list of ws indices) + // Build m_GroupWsInds (group -> list of ws indices) for (auto &dit : group2WSIndexSetmap) { size_t groupid = dit.first; std::set<size_t> &targetWSIndexSet = dit.second; std::vector<size_t> tempv; tempv.assign(targetWSIndexSet.begin(), targetWSIndexSet.end()); - m_GroupSpecInds.insert( + m_GroupWsInds.insert( std::make_pair(static_cast<specnum_t>(groupid), tempv)); } @@ -696,14 +696,14 @@ void GroupDetectors2::processMatrixWorkspace( } } - // Build m_GroupSpecInds (group -> list of ws indices) + // Build m_GroupWsInds (group -> list of ws indices) for (auto &dit : group2WSIndexSetmap) { size_t groupid = dit.first; std::set<size_t> &targetWSIndexSet = dit.second; if (!targetWSIndexSet.empty()) { std::vector<size_t> tempv; tempv.assign(targetWSIndexSet.begin(), targetWSIndexSet.end()); - m_GroupSpecInds.insert( + m_GroupWsInds.insert( std::make_pair(static_cast<specnum_t>(groupid), tempv)); } } @@ -800,7 +800,7 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File, // the value of this map is the list of spectra numbers that will be // combined into a group - m_GroupSpecInds[spectrumNo].reserve(numberOfSpectra); + m_GroupWsInds[spectrumNo].reserve(numberOfSpectra); do { if (!File) throw std::invalid_argument("Premature end of file, found number of " @@ -808,11 +808,11 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File, "list"); std::getline(File, thisLine), lineNum++; // the spectra numbers that will be included in the group - readSpectraIndexes(thisLine, specs2index, m_GroupSpecInds[spectrumNo], + readSpectraIndexes(thisLine, specs2index, m_GroupWsInds[spectrumNo], unUsedSpec); - } while (static_cast<int>(m_GroupSpecInds[spectrumNo].size()) < + } while (static_cast<int>(m_GroupWsInds[spectrumNo].size()) < numberOfSpectra); - if (static_cast<int>(m_GroupSpecInds[spectrumNo].size()) != + if (static_cast<int>(m_GroupWsInds[spectrumNo].size()) != numberOfSpectra) { // it makes no sense to continue reading the file, // we'll stop here throw std::invalid_argument( @@ -821,8 +821,8 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File, boost::lexical_cast<std::string>(lineNum)); } // make regular progress reports and check for a cancellation notification - if ((m_GroupSpecInds.size() % INTERVAL) == 1) { - fileReadProg(m_GroupSpecInds.size(), specs2index.size()); + if ((m_GroupWsInds.size() % INTERVAL) == 1) { + fileReadProg(m_GroupWsInds.size(), specs2index.size()); } } } @@ -921,10 +921,10 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, bhv = 1; API::MatrixWorkspace_sptr beh = API::WorkspaceFactory::Instance().create( - "Workspace2D", static_cast<int>(m_GroupSpecInds.size()), 1, 1); + "Workspace2D", static_cast<int>(m_GroupWsInds.size()), 1, 1); g_log.debug() << name() << ": Preparing to group spectra into " - << m_GroupSpecInds.size() << " groups\n"; + << m_GroupWsInds.size() << " groups\n"; // where we are copying spectra to, we start copying to the start of the // output workspace @@ -932,8 +932,8 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, // Only used for averaging behaviour. We may have a 1:1 map where a Divide // would be waste as it would be just dividing by 1 bool requireDivide(false); - for (storage_map::const_iterator it = m_GroupSpecInds.begin(); - it != m_GroupSpecInds.end(); ++it) { + for (storage_map::const_iterator it = m_GroupWsInds.begin(); + it != m_GroupWsInds.end(); ++it) { // This is the grouped spectrum ISpectrum *outSpec = outputWS->getSpectrum(outIndex); @@ -1031,10 +1031,10 @@ GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, bhv = 1; API::MatrixWorkspace_sptr beh = API::WorkspaceFactory::Instance().create( - "Workspace2D", static_cast<int>(m_GroupSpecInds.size()), 1, 1); + "Workspace2D", static_cast<int>(m_GroupWsInds.size()), 1, 1); g_log.debug() << name() << ": Preparing to group spectra into " - << m_GroupSpecInds.size() << " groups\n"; + << m_GroupWsInds.size() << " groups\n"; // where we are copying spectra to, we start copying to the start of the // output workspace @@ -1042,8 +1042,8 @@ GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, // Only used for averaging behaviour. We may have a 1:1 map where a Divide // would be waste as it would be just dividing by 1 bool requireDivide(false); - for (storage_map::const_iterator it = m_GroupSpecInds.begin(); - it != m_GroupSpecInds.end(); ++it) { + for (storage_map::const_iterator it = m_GroupWsInds.begin(); + it != m_GroupWsInds.end(); ++it) { // This is the grouped spectrum EventList &outEL = outputWS->getEventList(outIndex); diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index c5a66a7f103..76834ba45f4 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -52,7 +52,7 @@ using std::size_t; LoadISISNexus2::LoadISISNexus2() : m_filename(), m_instrument_name(), m_samplename(), m_detBlockInfo(), m_monBlockInfo(), m_loadBlockInfo(), m_have_detector(false), - m_load_selected_spectra(false), m_specInd2specNum_map(), m_spec2det_map(), + m_load_selected_spectra(false), m_wsInd2specNum_map(), m_spec2det_map(), m_entrynumber(0), m_tof_data(), m_proton_charge(0.), m_spec(), m_spec_end(nullptr), m_monitors(), m_logCreator(), m_progress(), m_cppFile() {} @@ -210,7 +210,7 @@ void LoadISISNexus2::exec() { checkOptionalProperties(ExcluedMonitorsSpectra); // Fill up m_spectraBlocks size_t total_specs = - prepareSpectraBlocks(m_monitors, m_specInd2specNum_map, m_loadBlockInfo); + prepareSpectraBlocks(m_monitors, m_wsInd2specNum_map, m_loadBlockInfo); m_progress = boost::make_shared<API::Progress>( this, 0.0, 1.0, total_specs * m_detBlockInfo.numberOfPeriods); @@ -332,7 +332,7 @@ void LoadISISNexus2::exec() { WorkspaceFactory::Instance().create(period_free_workspace)); m_spectraBlocks.clear(); - m_specInd2specNum_map.clear(); + m_wsInd2specNum_map.clear(); std::vector<int64_t> dummyS1; // at the moment here we clear this map to enable possibility to load // monitors from the spectra block (wiring table bug). @@ -343,7 +343,7 @@ void LoadISISNexus2::exec() { m_monBlockInfo.spectraID_max, dummyS1, ExcluedMonitorsSpectra); // lo - prepareSpectraBlocks(m_monitors, m_specInd2specNum_map, m_monBlockInfo); + prepareSpectraBlocks(m_monitors, m_wsInd2specNum_map, m_monBlockInfo); int64_t firstentry = (m_entrynumber > 0) ? m_entrynumber : 1; loadPeriodData(firstentry, entry, monitor_workspace, true); @@ -406,7 +406,7 @@ void LoadISISNexus2::exec() { m_tof_data.reset(); m_spec.reset(); m_monitors.clear(); - m_specInd2specNum_map.clear(); + m_wsInd2specNum_map.clear(); } // Function object for remove_if STL algorithm @@ -588,7 +588,7 @@ void LoadISISNexus2::buildSpectraInd2SpectraNumMap( specnum_t spec_num = static_cast<specnum_t>(*it); if (SpectraExcluded.find(spec_num) == SpectraExcluded.end()) { - m_specInd2specNum_map.insert( + m_wsInd2specNum_map.insert( std::pair<int64_t, specnum_t>(ic, spec_num)); ic++; } @@ -599,7 +599,7 @@ void LoadISISNexus2::buildSpectraInd2SpectraNumMap( for (int64_t i = range_min; i < range_max + 1; i++) { specnum_t spec_num = static_cast<specnum_t>(i); if (SpectraExcluded.find(spec_num) == SpectraExcluded.end()) { - m_specInd2specNum_map.insert( + m_wsInd2specNum_map.insert( std::pair<int64_t, specnum_t>(ic, spec_num)); ic++; } @@ -628,16 +628,16 @@ bool compareSpectraBlocks(const LoadISISNexus2::SpectraBlock &block1, */ size_t LoadISISNexus2::prepareSpectraBlocks( std::map<int64_t, std::string> &monitors, - const std::map<int64_t, specnum_t> &specInd2specNum_map, + const std::map<int64_t, specnum_t> &wsInd2specNum_map, const DataBlock &LoadBlock) { std::vector<int64_t> includedMonitors; // fill in the data block descriptor vector - if (!specInd2specNum_map.empty()) { - auto itSpec = specInd2specNum_map.begin(); + if (!wsInd2specNum_map.empty()) { + auto itSpec = wsInd2specNum_map.begin(); int64_t hist = itSpec->second; SpectraBlock block(hist, hist, false, ""); itSpec++; - for (; itSpec != specInd2specNum_map.end(); ++itSpec) { + for (; itSpec != wsInd2specNum_map.end(); ++itSpec) { // try to put all consecutive numbers in same block auto it_mon = monitors.find(hist); @@ -659,7 +659,7 @@ size_t LoadISISNexus2::prepareSpectraBlocks( } // push the last block - hist = specInd2specNum_map.rbegin()->second; + hist = wsInd2specNum_map.rbegin()->second; block.last = hist; auto it_mon = monitors.find(hist); @@ -670,7 +670,7 @@ size_t LoadISISNexus2::prepareSpectraBlocks( } m_spectraBlocks.push_back(block); - return specInd2specNum_map.size(); + return wsInd2specNum_map.size(); } // here we are only if ranges are not supplied @@ -759,10 +759,10 @@ void LoadISISNexus2::loadPeriodData( // local_workspace->getAxis(1)->setValue(hist_index, // static_cast<specnum_t>(it->first)); auto spec = local_workspace->getSpectrum(hist_index); - specnum_t specID = m_specInd2specNum_map.at(hist_index); + specnum_t specNum = m_wsInd2specNum_map.at(hist_index); spec->setDetectorIDs( - m_spec2det_map.getDetectorIDsForSpectrumNo(specID)); - spec->setSpectrumNo(specID); + m_spec2det_map.getDetectorIDsForSpectrumNo(specNum)); + spec->setSpectrumNo(specNum); } NXFloat timeBins = monitor.openNXFloat("time_of_flight"); @@ -859,11 +859,11 @@ void LoadISISNexus2::loadBlock(NXDataSetTyped<int> &data, int64_t blocksize, // local_workspace->getAxis(1)->setValue(hist, // static_cast<specnum_t>(spec_num)); auto spec = local_workspace->getSpectrum(hist); - specnum_t specID = m_specInd2specNum_map.at(hist); + specnum_t specNum = m_wsInd2specNum_map.at(hist); // set detectors corresponding to spectra Number - spec->setDetectorIDs(m_spec2det_map.getDetectorIDsForSpectrumNo(specID)); + spec->setDetectorIDs(m_spec2det_map.getDetectorIDsForSpectrumNo(specNum)); // set correct spectra Number - spec->setSpectrumNo(specID); + spec->setSpectrumNo(specNum); } ++hist; diff --git a/Framework/DataHandling/src/LoadNexusMonitors2.cpp b/Framework/DataHandling/src/LoadNexusMonitors2.cpp index 03f572d7c90..66662fe4aca 100644 --- a/Framework/DataHandling/src/LoadNexusMonitors2.cpp +++ b/Framework/DataHandling/src/LoadNexusMonitors2.cpp @@ -639,27 +639,27 @@ void LoadNexusMonitors2::splitMutiPeriodHistrogramData( xLength, yLength); // assign x values - restart at start for all periods - for (size_t specIndex = 0; specIndex < numSpectra; specIndex++) { - MantidVec &outputVec = wsPeriod->dataX(specIndex); - const MantidVec &inputVec = m_workspace->readX(specIndex); + for (size_t wsIndex = 0; wsIndex < numSpectra; wsIndex++) { + MantidVec &outputVec = wsPeriod->dataX(wsIndex); + const MantidVec &inputVec = m_workspace->readX(wsIndex); for (size_t index = 0; index < xLength; index++) { outputVec[index] = inputVec[index]; } } // assign y values - use the values offset by the period number - for (size_t specIndex = 0; specIndex < numSpectra; specIndex++) { - MantidVec &outputVec = wsPeriod->dataY(specIndex); - const MantidVec &inputVec = m_workspace->readY(specIndex); + for (size_t wsIndex = 0; wsIndex < numSpectra; wsIndex++) { + MantidVec &outputVec = wsPeriod->dataY(wsIndex); + const MantidVec &inputVec = m_workspace->readY(wsIndex); for (size_t index = 0; index < yLength; index++) { outputVec[index] = inputVec[(yLength * i) + index]; } } // assign E values - for (size_t specIndex = 0; specIndex < numSpectra; specIndex++) { - MantidVec &outputVec = wsPeriod->dataE(specIndex); - const MantidVec &inputVec = m_workspace->readE(specIndex); + for (size_t wsIndex = 0; wsIndex < numSpectra; wsIndex++) { + MantidVec &outputVec = wsPeriod->dataE(wsIndex); + const MantidVec &inputVec = m_workspace->readE(wsIndex); for (size_t index = 0; index < yLength; index++) { outputVec[index] = inputVec[(yLength * i) + index]; } diff --git a/Framework/DataHandling/src/SaveSPE.cpp b/Framework/DataHandling/src/SaveSPE.cpp index 651fc5162a6..557cb4417aa 100644 --- a/Framework/DataHandling/src/SaveSPE.cpp +++ b/Framework/DataHandling/src/SaveSPE.cpp @@ -283,11 +283,11 @@ void SaveSPE::check_and_copy_spectra(const MantidVec &inSignal, /** Write the bin values and errors in a single histogram spectra to the file * @param WS :: the workspace to being saved * @param outFile :: the file object to write to -* @param specIn :: the index number of the histogram to write +* @param wsIn :: the index number of the histogram to write */ void SaveSPE::writeHist(const API::MatrixWorkspace_const_sptr WS, - FILE *const outFile, const int specIn) const { - check_and_copy_spectra(WS->readY(specIn), WS->readE(specIn), m_tSignal, + FILE *const outFile, const int wsIn) const { + check_and_copy_spectra(WS->readY(wsIn), WS->readE(wsIn), m_tSignal, m_tError); FPRINTF_WITH_EXCEPTION(outFile, "%s", Y_HEADER); writeBins(m_tSignal, outFile); diff --git a/Framework/PythonInterface/plugins/algorithms/EnggFitPeaks.py b/Framework/PythonInterface/plugins/algorithms/EnggFitPeaks.py index 0db5d28170c..c391c08c17d 100644 --- a/Framework/PythonInterface/plugins/algorithms/EnggFitPeaks.py +++ b/Framework/PythonInterface/plugins/algorithms/EnggFitPeaks.py @@ -354,7 +354,7 @@ class EnggFitPeaks(PythonAlgorithm): @param expectedPeaks :: vector of expected peaks, in dSpacing units @param in_wks :: input workspace with the relevant instrument/geometry - @param wks_index spectrum index + @param wks_index workspace index Returns: a vector of ToF values converted from the input (dSpacing) vector. diff --git a/Framework/PythonInterface/plugins/algorithms/MSDFit.py b/Framework/PythonInterface/plugins/algorithms/MSDFit.py index d2bc7d01dfa..4770dd879b1 100644 --- a/Framework/PythonInterface/plugins/algorithms/MSDFit.py +++ b/Framework/PythonInterface/plugins/algorithms/MSDFit.py @@ -78,10 +78,10 @@ class MSDFit(DataProcessorAlgorithm): spec_max = self.getProperty('SpecMax').value if spec_min < 0: - issues['SpecMin'] = 'Minimum spectrum index must be greater than or equal to 0' + issues['SpecMin'] = 'Minimum spectrum number must be greater than or equal to 0' if spec_max > workspace.getNumberHistograms(): - issues['SpecMax'] = 'Maximum spectrum index must be less than number of spectra in workspace' + issues['SpecMax'] = 'Maximum spectrum number must be less than number of spectra in workspace' if spec_min > spec_max: msg = 'SpecMin must be less then SpecMax' diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py index 23eeb56b94e..c6a80085a30 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectTransmissionMonitor.py @@ -127,9 +127,9 @@ class IndirectTransmissionMonitor(PythonAlgorithm): return monitor_1_idx, monitor_2_idx, detector_1_idx - def _get_detector_spectrum_index(self, workspace, detector_id): + def _get_detector_workspace_index(self, workspace, detector_id): """ - Returns the spectrum index for a given detector ID in a workspace. + Returns the workspace index for a given detector ID in a workspace. @param workspace Workspace to find detector in @param detector_id Detector ID to search for diff --git a/MantidQt/API/inc/MantidQtAPI/QwtWorkspaceSpectrumData.h b/MantidQt/API/inc/MantidQtAPI/QwtWorkspaceSpectrumData.h index 8e9037f849c..b6a994eef7a 100644 --- a/MantidQt/API/inc/MantidQtAPI/QwtWorkspaceSpectrumData.h +++ b/MantidQt/API/inc/MantidQtAPI/QwtWorkspaceSpectrumData.h @@ -19,7 +19,7 @@ class EXPORT_OPT_MANTIDQT_API QwtWorkspaceSpectrumData : public MantidQwtMatrixWorkspaceData { public: QwtWorkspaceSpectrumData(const Mantid::API::MatrixWorkspace &workspace, - int specIndex, const bool logScale, + int wsIndex, const bool logScale, const bool plotAsDistribution); //! @return Pointer to a copy (virtual copy constructor) @@ -81,7 +81,7 @@ private: friend class MantidMatrixCurve; /// Spectrum index in the workspace - int m_spec; + int m_wsIndex; /// Copy of the X vector Mantid::MantidVec m_X; /// Copy of the Y vector diff --git a/MantidQt/API/src/QwtWorkspaceSpectrumData.cpp b/MantidQt/API/src/QwtWorkspaceSpectrumData.cpp index 55880e7bd53..145cd6ae6aa 100644 --- a/MantidQt/API/src/QwtWorkspaceSpectrumData.cpp +++ b/MantidQt/API/src/QwtWorkspaceSpectrumData.cpp @@ -8,16 +8,16 @@ /** * Construct a QwtWorkspaceSpectrumData object with a source workspace * @param workspace The workspace containing the data - * @param specIndex Index of the spectrum to plot + * @param wsIndex Index of the spectrum to plot * @param logScale If true, plot a log scale * @param plotAsDistribution If true and the data is histogram and not already a * distribution then plot the Y values/X bin-width */ QwtWorkspaceSpectrumData::QwtWorkspaceSpectrumData( - const Mantid::API::MatrixWorkspace &workspace, int specIndex, + const Mantid::API::MatrixWorkspace &workspace, int wsIndex, const bool logScale, const bool plotAsDistribution) - : m_spec(specIndex), m_X(workspace.readX(specIndex)), - m_Y(workspace.readY(specIndex)), m_E(workspace.readE(specIndex)), + : m_wsIndex(wsIndex), m_X(workspace.readX(wsIndex)), + m_Y(workspace.readY(wsIndex)), m_E(workspace.readE(wsIndex)), m_xTitle(), m_yTitle(), m_isHistogram(workspace.isHistogramData()), m_dataIsNormalized(workspace.isDistribution()), m_binCentres(false), m_logScale(logScale), m_isDistribution(false), m_isWaterfall(false), @@ -47,7 +47,7 @@ QwtWorkspaceSpectrumData *QwtWorkspaceSpectrumData::copy() const { */ QwtWorkspaceSpectrumData *QwtWorkspaceSpectrumData::copyWithNewSource( const Mantid::API::MatrixWorkspace &workspace) const { - return new QwtWorkspaceSpectrumData(workspace, m_spec, m_logScale, + return new QwtWorkspaceSpectrumData(workspace, m_wsIndex, m_logScale, m_isDistribution); } @@ -170,7 +170,7 @@ void QwtWorkspaceSpectrumData::setWaterfallPlot(bool on) { m_isWaterfall = on; } QwtWorkspaceSpectrumData &QwtWorkspaceSpectrumData:: operator=(const QwtWorkspaceSpectrumData &rhs) { if (this != &rhs) { - m_spec = rhs.m_spec; + m_wsIndex = rhs.m_wsIndex; m_X = rhs.m_X; m_Y = rhs.m_Y; m_E = rhs.m_E; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyPaalmanPings.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyPaalmanPings.h index ff9c02c688d..65b0ba1d4e9 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyPaalmanPings.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ApplyPaalmanPings.h @@ -19,7 +19,7 @@ private slots: /// Handles a new sample being loaded void newData(const QString &dataName); /// Updates the preview mini plot - void plotPreview(int specIndex); + void plotPreview(int wsIndex); /// Handle abs. correction algorithm completion void absCorComplete(bool error); /// Handle convert units and save algorithm completion diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h index b3f48fd3fc2..531d0835c6d 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h @@ -16,7 +16,7 @@ private slots: /// Handles a new sample being loaded void newData(const QString &dataName); /// Updates the preview mini plot - void plotPreview(int specIndex); + void plotPreview(int wsIndex); /// Handle abs. correction algorithm completion void absCorComplete(bool error); /// Handle convert units and save algorithm completion diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h index d5ddd8eb716..c39d6fee9ad 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/IndirectTab.h @@ -103,7 +103,7 @@ protected: /// Plot a spectrum plot with a given ws index void plotSpectrum(const QStringList &workspaceNames, int wsIndex = 0); /// Plot a spectrum plot of a given workspace - void plotSpectrum(const QString &workspaceName, int specIndex = 0); + void plotSpectrum(const QString &workspaceName, int wsIndex = 0); /// Plot a spectrum plot with a given spectra range void plotSpectrum(const QStringList &workspaceNames, int specStart, @@ -112,9 +112,9 @@ protected: void plotSpectrum(const QString &workspaceName, int specStart, int specEnd); /// Plot a time bin plot given a list of workspace names - void plotTimeBin(const QStringList &workspaceNames, int specIndex = 0); + void plotTimeBin(const QStringList &workspaceNames, int binIndex = 0); /// Plot a time bin plot of a given workspace - void plotTimeBin(const QString &workspaceName, int specIndex = 0); + void plotTimeBin(const QString &workspaceName, int binIndex = 0); /// Plot a contour plot of a given workspace void plot2D(const QString &workspaceName); diff --git a/MantidQt/CustomInterfaces/src/DataComparison.cpp b/MantidQt/CustomInterfaces/src/DataComparison.cpp index 409786ad797..f3ca8efbfea 100644 --- a/MantidQt/CustomInterfaces/src/DataComparison.cpp +++ b/MantidQt/CustomInterfaces/src/DataComparison.cpp @@ -332,8 +332,8 @@ void DataComparison::removeAllData() */ void DataComparison::plotWorkspaces() { - int globalSpecIndex = m_uiForm.sbSpectrum->value(); - int maxGlobalSpecIndex = 0; + int globalWsIndex = m_uiForm.sbSpectrum->value(); + int maxGlobalWsIndex = 0; int numRows = m_uiForm.twCurrentData->rowCount(); for(int row = 0; row < numRows; row++) @@ -347,14 +347,14 @@ void DataComparison::plotWorkspaces() // Calculate spectrum number QSpinBox *specOffsetSpin = dynamic_cast<QSpinBox *>(m_uiForm.twCurrentData->cellWidget(row, SPEC_OFFSET)); int specOffset = specOffsetSpin->value(); - int wsIndex = globalSpecIndex - specOffset; + int wsIndex = globalWsIndex - specOffset; g_log.debug() << "Workspace index for workspace " << workspaceName.toStdString() << " is " << wsIndex << ", with offset " << specOffset << std::endl; // See if this workspace extends the reach of the global spectrum selector - int maxGlobalSpecIndexForWs = numSpec + specOffset - 1; - if(maxGlobalSpecIndexForWs > maxGlobalSpecIndex) - maxGlobalSpecIndex = maxGlobalSpecIndexForWs; + int maxGlobalWsIndexForWs = numSpec + specOffset - 1; + if(maxGlobalWsIndexForWs > maxGlobalWsIndex) + maxGlobalWsIndex = maxGlobalWsIndexForWs; // Check the workspace index is in range if(wsIndex >= numSpec || wsIndex < 0) @@ -401,8 +401,8 @@ void DataComparison::plotWorkspaces() m_plot->replot(); // Set the max value for global spectrum spin box - m_uiForm.sbSpectrum->setMaximum(maxGlobalSpecIndex); - m_uiForm.sbSpectrum->setSuffix(" / " + QString::number(maxGlobalSpecIndex)); + m_uiForm.sbSpectrum->setMaximum(maxGlobalWsIndex); + m_uiForm.sbSpectrum->setSuffix(" / " + QString::number(maxGlobalWsIndex)); } diff --git a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp index fb4189a4a75..aa38989b496 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ApplyPaalmanPings.cpp @@ -487,21 +487,21 @@ void ApplyPaalmanPings::handleGeometryChange(int index) { /** * Replots the preview plot. * - * @param specIndex Spectrum index to plot + * @param wsIndex Spectrum index to plot */ -void ApplyPaalmanPings::plotPreview(int specIndex) { +void ApplyPaalmanPings::plotPreview(int wsIndex) { bool useCan = m_uiForm.ckUseCan->isChecked(); m_uiForm.ppPreview->clear(); // Plot sample m_uiForm.ppPreview->addSpectrum( - "Sample", m_uiForm.dsSample->getCurrentDataName(), specIndex, Qt::black); + "Sample", m_uiForm.dsSample->getCurrentDataName(), wsIndex, Qt::black); // Plot result if (!m_pythonExportWsName.empty()) m_uiForm.ppPreview->addSpectrum( - "Corrected", QString::fromStdString(m_pythonExportWsName), specIndex, + "Corrected", QString::fromStdString(m_pythonExportWsName), wsIndex, Qt::green); // Scale can @@ -523,16 +523,16 @@ void ApplyPaalmanPings::plotPreview(int specIndex) { // Plot container if (m_uiForm.ckScaleCan->isChecked()) { m_uiForm.ppPreview->addSpectrum("Container", "__container_corrected", - specIndex, Qt::red); + wsIndex, Qt::red); } else { if (m_uiForm.ckShiftCan->isChecked()) { m_uiForm.ppPreview->addSpectrum( "Container", (m_uiForm.dsContainer->getCurrentDataName() + "_Shifted"), - specIndex, Qt::red); + wsIndex, Qt::red); } else { m_uiForm.ppPreview->addSpectrum( - "Container", m_uiForm.dsContainer->getCurrentDataName(), specIndex, + "Container", m_uiForm.dsContainer->getCurrentDataName(), wsIndex, Qt::red); } } diff --git a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp index bd690877daf..4b8d0afcc17 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp @@ -280,19 +280,19 @@ void ContainerSubtraction::newData(const QString &dataName) { /** * Replots the preview plot. * - * @param specIndex Spectrum index to plot + * @param wsIndex workspace index to plot */ -void ContainerSubtraction::plotPreview(int specIndex) { +void ContainerSubtraction::plotPreview(int wsIndex) { m_uiForm.ppPreview->clear(); // Plot sample m_uiForm.ppPreview->addSpectrum( - "Sample", m_uiForm.dsSample->getCurrentDataName(), specIndex, Qt::black); + "Sample", m_uiForm.dsSample->getCurrentDataName(), wsIndex, Qt::black); // Plot result if (!m_pythonExportWsName.empty()) m_uiForm.ppPreview->addSpectrum( - "Subtracted", QString::fromStdString(m_pythonExportWsName), specIndex, + "Subtracted", QString::fromStdString(m_pythonExportWsName), wsIndex, Qt::green); const bool shift = m_uiForm.ckShiftCan->isChecked(); @@ -316,16 +316,16 @@ void ContainerSubtraction::plotPreview(int specIndex) { // Plot container if (scale) { m_uiForm.ppPreview->addSpectrum("Container", "__container_corrected", - specIndex, Qt::red); + wsIndex, Qt::red); } else { if (shift) { m_uiForm.ppPreview->addSpectrum( "Container", - (m_uiForm.dsContainer->getCurrentDataName() + "_Shifted"), specIndex, + (m_uiForm.dsContainer->getCurrentDataName() + "_Shifted"), wsIndex, Qt::red); } else { m_uiForm.ppPreview->addSpectrum( - "Container", m_uiForm.dsContainer->getCurrentDataName(), specIndex, + "Container", m_uiForm.dsContainer->getCurrentDataName(), wsIndex, Qt::red); } } diff --git a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp index 7266498fbc0..800e9f27d23 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ConvFit.cpp @@ -477,18 +477,18 @@ void ConvFit::newDataLoaded(const QString wsName) { m_cfInputWS = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( m_cfInputWSName.toStdString()); - int maxSpecIndex = static_cast<int>(m_cfInputWS->getNumberHistograms()) - 1; + int maxWsIndex = static_cast<int>(m_cfInputWS->getNumberHistograms()) - 1; - m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMaximum(maxWsIndex); m_uiForm.spPlotSpectrum->setMinimum(0); m_uiForm.spPlotSpectrum->setValue(0); - m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMaximum(maxWsIndex); m_uiForm.spSpectraMin->setMinimum(0); - m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxWsIndex); m_uiForm.spSpectraMax->setMinimum(0); - m_uiForm.spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setValue(maxWsIndex); updatePlot(); } diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp index eb6cbefd95f..c90fb72d6f9 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectTab.cpp @@ -238,15 +238,15 @@ void IndirectTab::plotSpectrum(const QStringList &workspaceNames, * index. * * @param workspaceName Names of workspace to plot - * @param specIndex Index of spectrum to plot + * @param wsIndex Workspace Index of spectrum to plot */ -void IndirectTab::plotSpectrum(const QString &workspaceName, int specIndex) { +void IndirectTab::plotSpectrum(const QString &workspaceName, int wsIndex) { if (workspaceName.isEmpty()) return; QStringList workspaceNames; workspaceNames << workspaceName; - plotSpectrum(workspaceNames, specIndex); + plotSpectrum(workspaceNames, wsIndex); } /** @@ -324,10 +324,10 @@ void IndirectTab::plot2D(const QString &workspaceName) { * This uses the plotTimeBin function from the Python API. * * @param workspaceNames List of names of workspaces to plot - * @param specIndex Index of spectrum from each workspace to plot + * @param binIndex Index of spectrum from each workspace to plot */ void IndirectTab::plotTimeBin(const QStringList &workspaceNames, - int specIndex) { + int binIndex) { if (workspaceNames.isEmpty()) return; @@ -336,7 +336,7 @@ void IndirectTab::plotTimeBin(const QStringList &workspaceNames, pyInput += "plotTimeBin(['"; pyInput += workspaceNames.join("','"); pyInput += "'], "; - pyInput += QString::number(specIndex); + pyInput += QString::number(binIndex); pyInput += ")\n"; m_pythonRunner.runPythonCode(pyInput); @@ -347,15 +347,15 @@ void IndirectTab::plotTimeBin(const QStringList &workspaceNames, * index. * * @param workspaceName Names of workspace to plot - * @param specIndex Index of spectrum to plot + * @param binIndex Index of spectrum to plot */ -void IndirectTab::plotTimeBin(const QString &workspaceName, int specIndex) { +void IndirectTab::plotTimeBin(const QString &workspaceName, int binIndex) { if (workspaceName.isEmpty()) return; QStringList workspaceNames; workspaceNames << workspaceName; - plotTimeBin(workspaceNames, specIndex); + plotTimeBin(workspaceNames, binIndex); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp index c27c577d2ec..f5396ef9668 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IqtFit.cpp @@ -356,18 +356,18 @@ void IqtFit::newDataLoaded(const QString wsName) { m_ffInputWS = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( m_ffInputWSName.toStdString()); - int maxSpecIndex = static_cast<int>(m_ffInputWS->getNumberHistograms()) - 1; + int maxWsIndex = static_cast<int>(m_ffInputWS->getNumberHistograms()) - 1; - m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMaximum(maxWsIndex); m_uiForm.spPlotSpectrum->setMinimum(0); m_uiForm.spPlotSpectrum->setValue(0); - m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMaximum(maxWsIndex); m_uiForm.spSpectraMin->setMinimum(0); - m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxWsIndex); m_uiForm.spSpectraMax->setMinimum(0); - m_uiForm.spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setValue(maxWsIndex); updatePlot(); } diff --git a/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp b/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp index 9820083fd19..11d6f8f9d82 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/MSDFit.cpp @@ -213,18 +213,18 @@ namespace IDA void MSDFit::newDataLoaded(const QString wsName) { auto ws = Mantid::API::AnalysisDataService::Instance().retrieveWS<const MatrixWorkspace>(wsName.toStdString()); - int maxSpecIndex = static_cast<int>(ws->getNumberHistograms()) - 1; + int maxWsIndex = static_cast<int>(ws->getNumberHistograms()) - 1; - m_uiForm.spPlotSpectrum->setMaximum(maxSpecIndex); + m_uiForm.spPlotSpectrum->setMaximum(maxWsIndex); m_uiForm.spPlotSpectrum->setMinimum(0); m_uiForm.spPlotSpectrum->setValue(0); - m_uiForm.spSpectraMin->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMin->setMaximum(maxWsIndex); m_uiForm.spSpectraMin->setMinimum(0); - m_uiForm.spSpectraMax->setMaximum(maxSpecIndex); + m_uiForm.spSpectraMax->setMaximum(maxWsIndex); m_uiForm.spSpectraMax->setMinimum(0); - m_uiForm.spSpectraMax->setValue(maxSpecIndex); + m_uiForm.spSpectraMax->setValue(maxWsIndex); plotInput(); } diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/PreviewPlot.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/PreviewPlot.h index 72337130719..08894c6360e 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/PreviewPlot.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/PreviewPlot.h @@ -79,10 +79,10 @@ public: void addSpectrum(const QString &curveName, const Mantid::API::MatrixWorkspace_sptr ws, - const size_t specIndex = 0, + const size_t wsIndex = 0, const QColor &curveColour = QColor()); void addSpectrum(const QString &curveName, const QString &wsName, - const size_t specIndex = 0, + const size_t wsIndex = 0, const QColor &curveColour = QColor()); void removeSpectrum(const Mantid::API::MatrixWorkspace_sptr ws); @@ -139,7 +139,7 @@ private: handleReplaceEvent(Mantid::API::WorkspaceAfterReplaceNotification_ptr pNf); void addCurve(PlotCurveConfiguration &curveConfig, - Mantid::API::MatrixWorkspace_sptr ws, const size_t specIndex, + Mantid::API::MatrixWorkspace_sptr ws, const size_t wsIndex, const QColor &curveColour); void removeCurve(QwtPlotItem *curve); diff --git a/docs/source/algorithms/CalMuonDetectorPhases-v1.rst b/docs/source/algorithms/CalMuonDetectorPhases-v1.rst index a90bf7b0e80..0139cfeec29 100644 --- a/docs/source/algorithms/CalMuonDetectorPhases-v1.rst +++ b/docs/source/algorithms/CalMuonDetectorPhases-v1.rst @@ -22,8 +22,8 @@ Before the spectra are fitted, :math:`\omega` is determined by grouping the dete calculating the asymmetry and fitting this to get the frequency. This value of :math:`\omega` is then treated as a fixed constant when fitting the spectra to the function above. -The algorithm outputs a table workspace containing the detector ID (i.e. the -spectrum index), the asymmetry and the phase. This table is intended to be used as the input +The algorithm outputs a table workspace containing the detector ID, the asymmetry and the phase. +This table is intended to be used as the input *PhaseTable* to :ref:`PhaseQuad <algm-PhaseQuad>`. In addition, the fitting results are returned in a workspace group, where each of the items stores the original data (after removing the exponential decay), the data simulated with the fitting function and the difference between data diff --git a/docs/source/algorithms/CopyDetectorMapping-v1.rst b/docs/source/algorithms/CopyDetectorMapping-v1.rst index c554bf61f9a..aee81e88a5e 100644 --- a/docs/source/algorithms/CopyDetectorMapping-v1.rst +++ b/docs/source/algorithms/CopyDetectorMapping-v1.rst @@ -10,7 +10,7 @@ Description ----------- This algorithm will copy the spectra to detector ID mapping form one workspace -to the other, either on a spectrum index or spectrum number basis. +to the other, either on a workspace index or spectrum number basis. Typically if both the workspace to be remapped and the workspace being matched both have their vertical axes in spectrum number then the IndexBySpectrumNumber diff --git a/docs/source/algorithms/GroupDetectors-v1.rst b/docs/source/algorithms/GroupDetectors-v1.rst index f6d278f4303..ed1e39e9247 100644 --- a/docs/source/algorithms/GroupDetectors-v1.rst +++ b/docs/source/algorithms/GroupDetectors-v1.rst @@ -12,9 +12,9 @@ Description This algorithm sums, bin-by-bin, multiple spectra into a single spectra. The errors are summed in quadrature and the algorithm checks that the bin boundaries in X are the same. The new summed spectra are created at -the start of the output workspace and have spectra index numbers that +the start of the output workspace and have workspace index numbers that start at zero and increase in the order the groups are specified. Each -new group takes the spectra numbers from the first input spectrum +new group takes the spectra number from the first input spectrum specified for that group. All detectors from the grouped spectra will be moved to belong to the new spectrum. diff --git a/docs/source/algorithms/PlotPeakByLogValue-v1.rst b/docs/source/algorithms/PlotPeakByLogValue-v1.rst index e36ae1d68f1..5a8111b601f 100644 --- a/docs/source/algorithms/PlotPeakByLogValue-v1.rst +++ b/docs/source/algorithms/PlotPeakByLogValue-v1.rst @@ -69,7 +69,7 @@ Minimizer setup It is possible to supply a fully configured minimizer via the Minimizer property, this can also include several flags that are used to indicate the -workspace name and spectrum index that has been fitted (useful for fitting using +workspace name and workspace index that has been fitted (useful for fitting using a minimizer that output workspaces (i.e. FABADA)). The possible flags are: diff --git a/docs/source/interfaces/DataComparison.rst b/docs/source/interfaces/DataComparison.rst index 8fe27838481..ab2de0a702a 100644 --- a/docs/source/interfaces/DataComparison.rst +++ b/docs/source/interfaces/DataComparison.rst @@ -45,15 +45,15 @@ Data Table :align: right The data table shows a list of the current data shown on the plot including the -workspace name and currently plotted spectrum index. This also allows the curve +workspace name and currently plotted workspace index. This also allows the curve colour to be changed manually. -This also allows a spectrum index offset to be set on a per workspace basis, +This also allows a workspace index offset to be set on a per workspace basis, this allows workspaces to be aligned relative to each other in the venet that -the spectra that you want to compare do not have the same spectrum index in each +the spectra that you want to compare do not have the same workspace index in each workspace. -The value of the offset for a workspace defines the spectrum index that the +The value of the offset for a workspace defines the workspace index that the first spectum will line up to relative to the spectrum selection spin box. At least one offset value must be zero (this is set check for automatically after an offset value has been changed). @@ -67,7 +67,7 @@ View The view section contains a set of tools for manipulating the plot and selecting spectra to plot via the *Spectrum* spin box, this is shown as the current -spectra index out of the maximum spectra index after the offsets are applied. +workspace index out of the maximum workspace index after the offsets are applied. The *Pan* and *Zoom* buttons are usd to enable and disable the pan and zoom tools; pan allows you to drag the plot area to show a specific section of the -- GitLab