Skip to content

Commit

Permalink
refs #4013 Minor modifications including more realistic reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Nov 3, 2011
1 parent f2cfc76 commit b0b5eae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace Mantid
/// Query the NearestNeighbours object for a given spectrum index using a search radius
std::map<specid_t, double> getNeighbours(specid_t spec, const double radius) const;
/// Query the NearestNeighbours object for a given spectrum index using the direct number of nearest neighbours
std::map<specid_t, double> getNeighbours(specid_t spec, const int nNeighbours) const;
std::map<specid_t, double> getNeighboursExact(specid_t spec, const int nNeighbours) const;
//@}

/// Const access to the spectra-detector map
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ namespace Mantid
* @param nNeighbours :: unsigned int, number of neighbours to include.
* @return map of DetectorID to distance for the nearest neighbours
*/
std::map<specid_t, double> MatrixWorkspace::getNeighbours(specid_t spec, const int nNeighbours) const
std::map<specid_t, double> MatrixWorkspace::getNeighboursExact(specid_t spec, const int nNeighbours) const
{
if ( !m_nearestNeighbours )
{
Expand Down
9 changes: 6 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/NormaliseByVanadium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace Algorithms
PARALLEL_CRITICAL(NearestNeighboursSearch)
{
//CPUTimer tim;
specIdMap = vanadiumWS->getNeighbours(inSpec, neighbours); //This is not threadsafe!
specIdMap = vanadiumWS->getNeighboursExact(inSpec, neighbours); //This is not threadsafe!
// std::cout << tim << " to get nearest neighbours." << std::endl;
}
std::map<specid_t, double>::iterator it = specIdMap.begin();
Expand All @@ -118,7 +118,7 @@ namespace Algorithms
vanSumTOF_WS = vanSumTOF_WS/yAvgWS;

//Mask detectors outside of limits
IAlgorithm_sptr constrainAlg = this->createSubAlgorithm("FindDetectorsOutsideLimits", 0.80, 0.90, true, 1);
IAlgorithm_sptr constrainAlg = this->createSubAlgorithm("FindDetectorsOutsideLimits", 0.80, 0.85, true, 1);
constrainAlg->setProperty("InputWorkspace", vanSumTOF_WS);
constrainAlg->setPropertyValue("OutputWorkspace", "ConstrainedWS");
constrainAlg->setProperty("HighThreshold", pow((double)10, (double)300));
Expand All @@ -127,13 +127,16 @@ namespace Algorithms
MatrixWorkspace_sptr constrainedWS = constrainAlg->getProperty("OutputWorkspace");

//Mask detectors outside of limits
IAlgorithm_sptr maskdetectorsAlg = this->createSubAlgorithm("MaskDetectors", 0.90, 1, true, 1);
IAlgorithm_sptr maskdetectorsAlg = this->createSubAlgorithm("MaskDetectors", 0.85, 0.90, true, 1);
maskdetectorsAlg->setProperty("Workspace", vanSumTOF_WS);
maskdetectorsAlg->setProperty("MaskedWorkspace", constrainedWS);
maskdetectorsAlg->executeAsSubAlg();

//Divide the sample workspace by the smoothed vanadium workspace.
sampleWS = sampleWS / vanSumTOF_WS;

progress.report(1, "Complete");
//Finally set the output workspace.
setProperty("OutputWorkspace", sampleWS);
}

Expand Down

0 comments on commit b0b5eae

Please sign in to comment.