Skip to content

Commit

Permalink
refs #6865 W-matrix fixed and the tests can now be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Apr 22, 2013
1 parent 2a3f548 commit 6c74e5d
Showing 1 changed file with 114 additions and 115 deletions.
229 changes: 114 additions & 115 deletions Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,155 +268,154 @@ static void destroySuite(ConvertToMDTestPerformance * suite) { delete suite; }

void test_EventNoUnitsConv()
{
TS_WARN("Disabled untill meged with #6852");

//NumericAxis *pAxis0 = new NumericAxis(2);
//pAxis0->setUnit("DeltaE");
//inWsEv->replaceAxis(0,pAxis0);

//MDWSDescription WSD;
//std::vector<double> min(4,-1e+30),max(4,1e+30);
//WSD.setMinMax(min,max);

//WSD.buildFromMatrixWS(inWsEv,"Q3D","Indirect");

//WSD.m_PreprDetTable =pDetLoc_events;
//WSD.m_RotMatrix = Rot;
//// this one comes from ticket #6852 and would not exist in clear branch.
//WSD.addProperty("RUN_INDEX",10,true);

//// create new target MD workspace
//pTargWS->releaseWorkspace();
//pTargWS->createEmptyMDWS(WSD);

//ConvToMDSelector AlgoSelector;
//pConvMethods = AlgoSelector.convSelector(inWsEv);
//TS_ASSERT_THROWS_NOTHING(pConvMethods->initialize(WSD,pTargWS));

//pMockAlgorithm->resetProgress(numHist);
////Clock.elapsedCPU();
//std::time (&start);
//TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
//std::time (&end);
//double sec = std::difftime (end,start);
//TS_WARN("Time to complete: <EventWSType,Q3D,Indir,ConvertNo,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");


NumericAxis *pAxis0 = new NumericAxis(2);
pAxis0->setUnit("DeltaE");
inWsEv->replaceAxis(0,pAxis0);

MDWSDescription WSD;
std::vector<double> min(4,-1e+30),max(4,1e+30);
WSD.setMinMax(min,max);

WSD.buildFromMatrixWS(inWsEv,"Q3D","Indirect");

WSD.m_PreprDetTable =pDetLoc_events;
WSD.m_RotMatrix = Rot;
// this one comes from ticket #6852 and would not exist in clear branch.
WSD.addProperty("RUN_INDEX",10,true);

// create new target MD workspace
pTargWS->releaseWorkspace();
pTargWS->createEmptyMDWS(WSD);

ConvToMDSelector AlgoSelector;
pConvMethods = AlgoSelector.convSelector(inWsEv);
TS_ASSERT_THROWS_NOTHING(pConvMethods->initialize(WSD,pTargWS));

pMockAlgorithm->resetProgress(numHist);
//Clock.elapsedCPU();
std::time (&start);
TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
std::time (&end);
double sec = std::difftime (end,start);
TS_WARN("Time to complete: <EventWSType,Q3D,Indir,ConvertNo,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
}

void test_EventFromTOFConv()
{
TS_WARN("Disabled untill meged with #6852");


//NumericAxis *pAxis0 = new NumericAxis(2);
//pAxis0->setUnit("TOF");
//inWsEv->replaceAxis(0,pAxis0);
NumericAxis *pAxis0 = new NumericAxis(2);
pAxis0->setUnit("TOF");
inWsEv->replaceAxis(0,pAxis0);

//MDWSDescription WSD;
//std::vector<double> min(4,-1e+30),max(4,1e+30);
//WSD.setMinMax(min,max);
//WSD.buildFromMatrixWS(inWsEv,"Q3D","Indirect");

//WSD.m_PreprDetTable =pDetLoc_events;
//WSD.m_RotMatrix = Rot;
//// this one comes from ticket #6852 and would not exist in clear branch.
//WSD.addProperty("RUN_INDEX",10,true);

//// create new target MD workspace
//pTargWS->releaseWorkspace();
//pTargWS->createEmptyMDWS(WSD);


//ConvToMDSelector AlgoSelector;
//pConvMethods = AlgoSelector.convSelector(inWsEv);
//pConvMethods->initialize(WSD,pTargWS);

//pMockAlgorithm->resetProgress(numHist);
////Clock.elapsedCPU();
//std::time (&start);
//TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
//std::time (&end);
//double sec = std::difftime (end,start);
////float sec = Clock.elapsedCPU();
//TS_WARN("Time to complete: <EventWSType,Q3D,Indir,ConvFromTOF,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
MDWSDescription WSD;
std::vector<double> min(4,-1e+30),max(4,1e+30);
WSD.setMinMax(min,max);
WSD.buildFromMatrixWS(inWsEv,"Q3D","Indirect");

WSD.m_PreprDetTable =pDetLoc_events;
WSD.m_RotMatrix = Rot;
// this one comes from ticket #6852 and would not exist in clear branch.
WSD.addProperty("RUN_INDEX",10,true);

// create new target MD workspace
pTargWS->releaseWorkspace();
pTargWS->createEmptyMDWS(WSD);


ConvToMDSelector AlgoSelector;
pConvMethods = AlgoSelector.convSelector(inWsEv);
pConvMethods->initialize(WSD,pTargWS);

pMockAlgorithm->resetProgress(numHist);
//Clock.elapsedCPU();
std::time (&start);
TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
std::time (&end);
double sec = std::difftime (end,start);
//float sec = Clock.elapsedCPU();
TS_WARN("Time to complete: <EventWSType,Q3D,Indir,ConvFromTOF,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
}
void test_HistoFromTOFConv()
{
TS_WARN("Disabled untill meged with #6852");

//NumericAxis *pAxis0 = new NumericAxis(2);
//pAxis0->setUnit("TOF");
//inWs2D->replaceAxis(0,pAxis0);
NumericAxis *pAxis0 = new NumericAxis(2);
pAxis0->setUnit("TOF");
inWs2D->replaceAxis(0,pAxis0);

//MDWSDescription WSD;
//std::vector<double> min(4,-1e+30),max(4,1e+30);
//WSD.setMinMax(min,max);
MDWSDescription WSD;
std::vector<double> min(4,-1e+30),max(4,1e+30);
WSD.setMinMax(min,max);

//WSD.buildFromMatrixWS(inWs2D,"Q3D","Indirect");
WSD.buildFromMatrixWS(inWs2D,"Q3D","Indirect");

//WSD.m_PreprDetTable =pDetLoc_histo;
//WSD.m_RotMatrix = Rot;
//// this one comes from ticket #6852 and would not exist in clear branch.
//WSD.addProperty("RUN_INDEX",10,true);
WSD.m_PreprDetTable =pDetLoc_histo;
WSD.m_RotMatrix = Rot;
// this one comes from ticket #6852 and would not exist in clear branch.
WSD.addProperty("RUN_INDEX",10,true);

//// create new target MD workspace
//pTargWS->releaseWorkspace();
//pTargWS->createEmptyMDWS(WSD);
// create new target MD workspace
pTargWS->releaseWorkspace();
pTargWS->createEmptyMDWS(WSD);


//pTargWS->createEmptyMDWS(WSD);
pTargWS->createEmptyMDWS(WSD);

//ConvToMDSelector AlgoSelector;
//pConvMethods = AlgoSelector.convSelector(inWs2D);
//pConvMethods->initialize(WSD,pTargWS);
ConvToMDSelector AlgoSelector;
pConvMethods = AlgoSelector.convSelector(inWs2D);
pConvMethods->initialize(WSD,pTargWS);

//pMockAlgorithm->resetProgress(numHist);
////Clock.elapsedCPU();
//std::time (&start);
//TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
//std::time (&end);
//double sec = std::difftime (end,start);
pMockAlgorithm->resetProgress(numHist);
//Clock.elapsedCPU();
std::time (&start);
TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
std::time (&end);
double sec = std::difftime (end,start);

//TS_WARN("Time to complete: <Ws2DHistoType,Q3D,Indir,ConvFromTOF,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
TS_WARN("Time to complete: <Ws2DHistoType,Q3D,Indir,ConvFromTOF,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
}

void test_HistoNoUnitsConv()
{

TS_WARN("Disabled untill meged with #6852");


//NumericAxis *pAxis0 = new NumericAxis(2);
//pAxis0->setUnit("DeltaE");
//inWs2D->replaceAxis(0,pAxis0);
NumericAxis *pAxis0 = new NumericAxis(2);
pAxis0->setUnit("DeltaE");
inWs2D->replaceAxis(0,pAxis0);

//MDWSDescription WSD;
//std::vector<double> min(4,-1e+30),max(4,1e+30);
//WSD.setMinMax(min,max);
MDWSDescription WSD;
std::vector<double> min(4,-1e+30),max(4,1e+30);
WSD.setMinMax(min,max);

//WSD.buildFromMatrixWS(inWs2D,"Q3D","Indirect");
WSD.buildFromMatrixWS(inWs2D,"Q3D","Indirect");

//WSD.m_PreprDetTable =pDetLoc_histo;
//WSD.m_RotMatrix = Rot;
//// this one comes from ticket #6852 and would not exist in clear branch.
//WSD.addProperty("RUN_INDEX",10,true);
WSD.m_PreprDetTable =pDetLoc_histo;
WSD.m_RotMatrix = Rot;
// this one comes from ticket #6852 and would not exist in clear branch.
WSD.addProperty("RUN_INDEX",10,true);

//// create new target MD workspace
//pTargWS->releaseWorkspace();
//pTargWS->createEmptyMDWS(WSD);
// create new target MD workspace
pTargWS->releaseWorkspace();
pTargWS->createEmptyMDWS(WSD);


//pTargWS->createEmptyMDWS(WSD);
pTargWS->createEmptyMDWS(WSD);

//ConvToMDSelector AlgoSelector;
//pConvMethods = AlgoSelector.convSelector(inWs2D);
//pConvMethods->initialize(WSD,pTargWS);
ConvToMDSelector AlgoSelector;
pConvMethods = AlgoSelector.convSelector(inWs2D);
pConvMethods->initialize(WSD,pTargWS);

//pMockAlgorithm->resetProgress(numHist);
////Clock.elapsedCPU();
//std::time (&start);
//TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
//std::time (&end);
//double sec = std::difftime (end,start);
pMockAlgorithm->resetProgress(numHist);
//Clock.elapsedCPU();
std::time (&start);
TS_ASSERT_THROWS_NOTHING(pConvMethods->runConversion(pMockAlgorithm->getProgress()));
std::time (&end);
double sec = std::difftime (end,start);

//TS_WARN("Time to complete: <Ws2DHistoType,Q3D,Indir,ConvertNo,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
TS_WARN("Time to complete: <Ws2DHistoType,Q3D,Indir,ConvertNo,CrystType>: "+boost::lexical_cast<std::string>(sec)+" sec");
}


Expand Down

0 comments on commit 6c74e5d

Please sign in to comment.