From 24eba3e744e9875481ee18a53fbde1b79ca96b0d Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Tue, 15 Dec 2015 13:36:31 +0100 Subject: [PATCH] New PySuite, GUISuite functional tests SimulationWithMasks --- .../FunctionalTestRegistry.cpp | 8 +++++++ Core/StandardSamples/SimulationRegistry.cpp | 2 +- Core/StandardSamples/StandardSimulations.cpp | 24 +++++++++---------- Core/StandardSamples/StandardSimulations.h | 2 +- Core/Tools/src/PyGenTools.cpp | 4 ++-- Core/Tools/src/PyGenVisitor.cpp | 3 +-- Tests/FunctionalTests/TestGUI/CMakeLists.txt | 1 + .../FunctionalTests/TestPyCore/CMakeLists.txt | 1 + 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Core/StandardSamples/FunctionalTestRegistry.cpp b/Core/StandardSamples/FunctionalTestRegistry.cpp index 260709b55df..9857af0a27b 100644 --- a/Core/StandardSamples/FunctionalTestRegistry.cpp +++ b/Core/StandardSamples/FunctionalTestRegistry.cpp @@ -267,6 +267,14 @@ FunctionalTestRegistry::FunctionalTestRegistry() "None", 1e-10); + add("SimulationWithMasks", + "Various masks are added to the simulation", + "GISASWithMasks", + "CylindersAndPrismsBuilder", + "None", + 1e-10); + + } void FunctionalTestRegistry::add(const std::string &test_name, diff --git a/Core/StandardSamples/SimulationRegistry.cpp b/Core/StandardSamples/SimulationRegistry.cpp index 6c885b065c7..0b99e00d34f 100644 --- a/Core/StandardSamples/SimulationRegistry.cpp +++ b/Core/StandardSamples/SimulationRegistry.cpp @@ -35,7 +35,7 @@ SimulationRegistry::SimulationRegistry() "GISAS simulation with small detector and detector resolution"); - registerItem("MiniGISASWithMasks", StandardSimulations::MiniGISASWithMasks, + registerItem("GISASWithMasks", StandardSimulations::GISASWithMasks, "GISAS simulation with small detector and various masks"); registerItem("MaxiGISAS", StandardSimulations::MaxiGISAS, diff --git a/Core/StandardSamples/StandardSimulations.cpp b/Core/StandardSamples/StandardSimulations.cpp index 4dcd4537380..108083cb1e8 100644 --- a/Core/StandardSamples/StandardSimulations.cpp +++ b/Core/StandardSamples/StandardSimulations.cpp @@ -97,7 +97,7 @@ GISASSimulation *StandardSimulations::MiniGISASBeamDivergence() return result; } -GISASSimulation *StandardSimulations::MiniGISASWithMasks() +GISASSimulation *StandardSimulations::GISASWithMasks() { GISASSimulation *result = new GISASSimulation(); result->setDetectorParameters(100, -1.0*Units::degree, 1.0*Units::degree, @@ -112,19 +112,19 @@ GISASSimulation *StandardSimulations::MiniGISASWithMasks() result->addMask(Geometry::Ellipse(0.0*deg, 1.0*deg, 0.5*deg, 0.5*deg), false); result->addMask(Geometry::Ellipse(0.11*deg, 1.25*deg, 0.05*deg, 0.05*deg), true); - std::vector<std::vector<double> > points = { - {0.0*deg, 1.0*deg}, {0.5*deg, 1.2*deg}, {0.5*deg, 0.8*deg}, {0.0*deg, 1.0*deg} - }; - result->addMask(Geometry::Polygon(points), true); +// std::vector<std::vector<double> > points = { +// {0.0*deg, 1.0*deg}, {0.5*deg, 1.2*deg}, {0.5*deg, 0.8*deg}, {0.0*deg, 1.0*deg} +// }; +// result->addMask(Geometry::Polygon(points), true); - result->addMask(Geometry::Rectangle(0.45*deg, 0.95*deg, 0.55*deg, 1.05*deg), false); - result->addMask(Geometry::Rectangle(0.61*deg, 0.95*deg, 0.71*deg, 1.05*deg), false); - result->addMask(Geometry::Rectangle(0.75*deg, 0.95*deg, 0.85*deg, 1.05*deg), false); +// result->addMask(Geometry::Rectangle(0.45*deg, 0.95*deg, 0.55*deg, 1.05*deg), false); +// result->addMask(Geometry::Rectangle(0.61*deg, 0.95*deg, 0.71*deg, 1.05*deg), false); +// result->addMask(Geometry::Rectangle(0.75*deg, 0.95*deg, 0.85*deg, 1.05*deg), false); - // more stuff - result->addMask(Geometry::Ellipse(-0.5*deg, 1.5*deg, 0.3*deg, 0.1*deg, 45.*deg), false); - result->addMask(Geometry::VerticalLine(-0.6*deg), true); - result->addMask(Geometry::HorizontalLine(0.3*deg), false); +// // more masks +// result->addMask(Geometry::Ellipse(-0.5*deg, 1.5*deg, 0.3*deg, 0.1*deg, 45.*deg), false); +// result->addMask(Geometry::VerticalLine(-0.6*deg), true); +// result->addMask(Geometry::HorizontalLine(0.3*deg), false); return result; diff --git a/Core/StandardSamples/StandardSimulations.h b/Core/StandardSamples/StandardSimulations.h index fcef03ab1cb..8bfe4281810 100644 --- a/Core/StandardSamples/StandardSimulations.h +++ b/Core/StandardSamples/StandardSimulations.h @@ -31,7 +31,7 @@ GISASSimulation *BasicGISAS00(); GISASSimulation *MiniGISAS(); GISASSimulation *MiniGISASBeamDivergence(); GISASSimulation *MiniGISASDetectorResolution(); -GISASSimulation *MiniGISASWithMasks(); +GISASSimulation *GISASWithMasks(); GISASSimulation *MaxiGISAS(); GISASSimulation *MaxiGISAS00(); GISASSimulation *IsGISAXSSimulation1(); diff --git a/Core/Tools/src/PyGenTools.cpp b/Core/Tools/src/PyGenTools.cpp index a9427aceb4d..3d3115e71ef 100644 --- a/Core/Tools/src/PyGenTools.cpp +++ b/Core/Tools/src/PyGenTools.cpp @@ -61,9 +61,9 @@ std::string PyGenTools::printBool(double value) { std::ostringstream inter; if(value) { - inter << "true"; + inter << "True"; } else { - inter << "false"; + inter << "False"; } return inter.str(); } diff --git a/Core/Tools/src/PyGenVisitor.cpp b/Core/Tools/src/PyGenVisitor.cpp index 177d7de3725..e4266aecd7c 100644 --- a/Core/Tools/src/PyGenVisitor.cpp +++ b/Core/Tools/src/PyGenVisitor.cpp @@ -1341,11 +1341,10 @@ std::string PyGenVisitor::defineMasks(const GISASSimulation *simulation) const result << "\n"; for(size_t i_mask=0; i_mask<detectorMask->getNumberOfMasks(); ++i_mask) { bool mask_value(false); -// result << indent() << "simulation.addMask("; const Geometry::IShape2D *shape = detectorMask->getMaskShape(i_mask, mask_value); -// result << indent() << PyGenTools::getRepresentation(shape); result << PyGenTools::getRepresentation(indent(), shape, mask_value); } + result << "\n"; } return result.str(); diff --git a/Tests/FunctionalTests/TestGUI/CMakeLists.txt b/Tests/FunctionalTests/TestGUI/CMakeLists.txt index 7d119e1cd12..b4c507f2744 100644 --- a/Tests/FunctionalTests/TestGUI/CMakeLists.txt +++ b/Tests/FunctionalTests/TestGUI/CMakeLists.txt @@ -54,6 +54,7 @@ set(list_of_tests "GUISuite/BoxCompositionRotateZ" "GUISuite/BoxCompositionRotateZandY" "GUISuite/BoxStackComposition" + "GUISuite/SimulationWithMasks" ) # Adding executables. diff --git a/Tests/FunctionalTests/TestPyCore/CMakeLists.txt b/Tests/FunctionalTests/TestPyCore/CMakeLists.txt index 6f2005ed371..ce8be3cb568 100644 --- a/Tests/FunctionalTests/TestPyCore/CMakeLists.txt +++ b/Tests/FunctionalTests/TestPyCore/CMakeLists.txt @@ -97,6 +97,7 @@ set(list_of_tests "PySuite/BoxCompositionRotateZ" "PySuite/BoxCompositionRotateZandY" "PySuite/BoxStackComposition" + "PySuite/SimulationWithMasks" ) # Adding executables. -- GitLab