Skip to content

Commit

Permalink
Refs #9410 add zero spectra for edge pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed May 20, 2014
1 parent 998a746 commit ef67014
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions Code/Mantid/Framework/Algorithms/src/SmoothNeighbours.cpp
Expand Up @@ -851,18 +851,29 @@ void SmoothNeighbours::spreadPixels(MatrixWorkspace_sptr outws)

//Copy geometry over.
API::WorkspaceFactory::Instance().initializeFromParent(inWS, outws2, false);
// Go through all the input workspace
for (int outWIi=0; outWIi<int(numberOfSpectra); outWIi++)
{
ISpectrum * inSpec = inWS->getSpectrum(outWIi);
MantidVec & inX = inSpec->dataX();

std::set<detid_t> thesedetids = inSpec->getDetectorIDs();
ISpectrum * outSpec2 = outws2->getSpectrum(outWIi);
MantidVec & outX = outSpec2->dataX();
outX = inX;
outSpec2->addDetectorIDs(thesedetids);
// Zero the Y and E vectors
outSpec2->clearData();
outSpec2->dataY().assign(YLength,0.0);
outSpec2->dataE().assign(YLength,0.0);
}


// Go through all the output workspace
const size_t numberOfSpectra2 = outws->getNumberHistograms();
for (int outWIi=0; outWIi<int(numberOfSpectra2); outWIi++)
{
ISpectrum * outSpec = outws->getSpectrum(outWIi);
/*
g_log.notice() << "[DBx555] Original spectrum number for wsindex " << outWIi
<< " = " << outSpec->getSpectrumNo() << std::endl;
outSpec->setSpectrumNo(outWIi+1);
*/

const ISpectrum * outSpec = outws->getSpectrum(outWIi);

// Which are the neighbours?
std::vector< weightedNeighbour > & neighbours = m_neighbours[outWIi];
Expand All @@ -871,24 +882,18 @@ void SmoothNeighbours::spreadPixels(MatrixWorkspace_sptr outws)
{
size_t inWI = it->first;

const ISpectrum * inSpec = inWS->getSpectrum(inWI);

std::set<detid_t> thesedetids = inSpec->getDetectorIDs();
ISpectrum * outSpec2 = outws2->getSpectrum(inWI);
outSpec2->addDetectorIDs(thesedetids);
// Reset the Y and E vectors
outSpec2->clearData();
MantidVec & out2Y = outSpec2->dataY();
MantidVec & out2E = outSpec2->dataE();
MantidVec & out2X = outSpec2->dataX();
MantidVec & outY = outSpec->dataY();
MantidVec & outE = outSpec->dataE();
MantidVec & outX = outSpec->dataX();
const MantidVec & outY = outSpec->dataY();
const MantidVec & outE = outSpec->dataE();
const MantidVec & outX = outSpec->dataX();
out2Y = outY;
out2E = outE;
out2X = outX;


} //(each neighbour)
}
this->setProperty("OutputWorkspace", outws2);
Expand Down Expand Up @@ -953,9 +958,8 @@ void SmoothNeighbours::execEvent(Mantid::DataObjects::EventWorkspace_sptr ws)
//Give the 0-th X bins to all the output spectra.
Kernel::cow_ptr<MantidVec> outX = inWS->refX(0);
outWS->setAllX( outX );
if(expandSumAllPixels) spreadPixels(outWS);
}



} // namespace Algorithms
} // namespace Mantid

0 comments on commit ef67014

Please sign in to comment.