diff --git a/App/inc/TestPolarizedDWBAZeroMag.h b/App/inc/TestPolarizedDWBAZeroMag.h index 54c41963eab6d55a6b5d4785e8ac76dc59f7856b..66e66f91f1254c8d53098a830575c52944bafad0 100644 --- a/App/inc/TestPolarizedDWBAZeroMag.h +++ b/App/inc/TestPolarizedDWBAZeroMag.h @@ -47,6 +47,8 @@ private: }; std::string m_data_path; + OutputData<double> *m_result; + }; #endif /* TESTPOLARIZEDDWBAZEROMAG_H_ */ diff --git a/App/src/TestPolarizedDWBAZeroMag.cpp b/App/src/TestPolarizedDWBAZeroMag.cpp index eec915c8deaba30fb3ea99da800cc0f67a54ee73..6e2f572926963c083c7eff0730b4667e73d43e6a 100644 --- a/App/src/TestPolarizedDWBAZeroMag.cpp +++ b/App/src/TestPolarizedDWBAZeroMag.cpp @@ -20,6 +20,7 @@ #include "Simulation.h" #include "Units.h" #include "Utils.h" +#include "SimulationRegistry.h" TestPolarizedDWBAZeroMag::TestPolarizedDWBAZeroMag() : IFunctionalTest("TestPolarizedDWBAZeroMag") @@ -32,44 +33,52 @@ TestPolarizedDWBAZeroMag::TestPolarizedDWBAZeroMag() void TestPolarizedDWBAZeroMag::execute() { // building simulation - Simulation simulation(mp_options); - simulation.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, - 100, 0.0*Units::degree, 2.0*Units::degree, - true); - simulation.setBeamParameters(1.0*Units::angstrom, 0.2*Units::degree, - 0.0*Units::degree); + //Simulation simulation(mp_options); + //simulation.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, + // 100, 0.0*Units::degree, 2.0*Units::degree, + // true); + //simulation.setBeamParameters(1.0*Units::angstrom, 0.2*Units::degree, + // 0.0*Units::degree); + + SimulationRegistry sim_registry; + Simulation *simulation = sim_registry.createSimulation("PolarizedDWBAZeroMag"); + // test1 - ISample *sample = SampleFactory::createSample( - "PolarizedDWBAZeroMagTestCase"); - simulation.setSample(*sample); - simulation.runSimulation(); - OutputDataIOFactory::writeIntensityData(*simulation.getOutputData(), - "this_cylinder_DWBA_pol.ima"); - delete sample; +// ISample *sample = SampleFactory::createSample( +// "PolarizedDWBAZeroMagTestCase"); +// simulation.setSample(*sample); + + simulation->runSimulation(); + m_result = simulation->getIntensityData(); + +// OutputDataIOFactory::writeIntensityData(*m_result, +// "this_cylinder_DWBA_pol.ima"); +// delete sample; } void TestPolarizedDWBAZeroMag::finalise() { - std::vector< CompareStruct > tocompare; - tocompare.push_back( CompareStruct( - getOutputPath()+"isgi_cylinder_DWBA.ima.gz", - "this_cylinder_DWBA_pol.ima", - "Cylinder DWBA Formfactor with matrix calculation") ); - - for(size_t i=0; i<tocompare.size(); ++i) { - OutputData<double> *isgi_data = OutputDataIOFactory::readIntensityData( - tocompare[i].isginame); - OutputData<double> *our_data = OutputDataIOFactory::readIntensityData( - tocompare[i].thisname); - - IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, - tocompare[i].descr, tocompare[i].descr); - - delete isgi_data; - delete our_data; - } +// std::vector< CompareStruct > tocompare; +// tocompare.push_back( CompareStruct( +// getOutputPath()+"isgi_cylinder_DWBA.ima.gz", +// "this_cylinder_DWBA_pol.ima", +// "Cylinder DWBA Formfactor with matrix calculation") ); + +// for(size_t i=0; i<tocompare.size(); ++i) { +// OutputData<double> *isgi_data = OutputDataIOFactory::readIntensityData( +// tocompare[i].isginame); +// OutputData<double> *our_data = OutputDataIOFactory::readIntensityData( +// tocompare[i].thisname); + + OutputData<double> *reference = OutputDataIOFactory::readIntensityData( + getOutputPath()+"isgi_cylinder_DWBA.ima.gz"); + + IsGISAXSTools::drawOutputDataComparisonResults(*m_result, *reference, + "zzz"); + + delete reference; } diff --git a/Core/StandardSamples/SampleBuilderFactory.cpp b/Core/StandardSamples/SampleBuilderFactory.cpp index c46e6baa8a17fdfdbc3cde2073816f1ac6456860..038f2ea142822c63adf799b573b6242877e44570 100644 --- a/Core/StandardSamples/SampleBuilderFactory.cpp +++ b/Core/StandardSamples/SampleBuilderFactory.cpp @@ -73,7 +73,7 @@ SampleBuilderFactory::SampleBuilderFactory() registerItem( "PolarizedDWBAZeroMag", IFactoryCreateFunction<PolarizedDWBAZeroMagBuilder, ISampleBuilder>, - "cylinder DWBA form factor with matrix calculation"); + "polarized DWBA with zero magnetic field"); } diff --git a/Core/StandardSamples/SimulationRegistry.cpp b/Core/StandardSamples/SimulationRegistry.cpp index 2f70cc42cb328caa19da3d6a30441d423cc10f59..37776b8a9b6c8262e4a8f5ffc14e86635ea0c83a 100644 --- a/Core/StandardSamples/SimulationRegistry.cpp +++ b/Core/StandardSamples/SimulationRegistry.cpp @@ -13,7 +13,7 @@ SimulationRegistry::SimulationRegistry() registerItem( "PolarizedDWBAZeroMag", StandardSimulations::PolarizedDWBAZeroMag, - "cylinder DWBA form factor with matrix calculation"); + "polarized DWBA with zero magnetic field"); } diff --git a/Tests/FunctionalTests/TestPyCore/polarizeddwbazeromag.py b/Tests/FunctionalTests/TestPyCore/polarizeddwbazeromag.py index 432028afb4c9dd1e06a99f55c8cd9f14576a81dc..99d7d9d477ddbaa407fef0b90bca32003b300ee4 100644 --- a/Tests/FunctionalTests/TestPyCore/polarizeddwbazeromag.py +++ b/Tests/FunctionalTests/TestPyCore/polarizeddwbazeromag.py @@ -92,7 +92,7 @@ def runTest(): diff = GetDifference(result, reference) status = "OK" if(diff > 2e-10 or numpy.isnan(diff)): status = "FAILED" - return "PolarizedDWBAZeroMag", "cylinder DWBA form factor with matrix calculation", status + return "PolarizedDWBAZeroMag", "functional test: polarized DWBA with zero magnetic field", status #-------------------------------------------------------------