From db17a466bf6ae202e0e69e4830a5e897941e350d Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Mon, 18 May 2015 13:03:45 +0200 Subject: [PATCH] Fixed most of the functional tests after redesign --- Core/Algorithms/inc/DWBASimulation.h | 4 ---- Core/Algorithms/inc/Detector.h | 2 +- Core/Algorithms/inc/SimulationElement.h | 4 ++-- Core/Algorithms/src/DWBASimulation.cpp | 2 -- Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp | 4 ++-- Core/Algorithms/src/GISASSimulation.cpp | 6 +++--- Core/Algorithms/src/Instrument.cpp | 1 - Core/Algorithms/src/Simulation.cpp | 2 -- Tests/FunctionalTests/TestPyCore/isgisaxs07.py | 3 --- 9 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Core/Algorithms/inc/DWBASimulation.h b/Core/Algorithms/inc/DWBASimulation.h index 43bb22a4b75..58e9f3e4d4c 100644 --- a/Core/Algorithms/inc/DWBASimulation.h +++ b/Core/Algorithms/inc/DWBASimulation.h @@ -66,10 +66,6 @@ protected: std::vector<SimulationElement>::iterator m_begin_it, m_end_it; mutable OutputData<double> m_dwba_intensity; -#ifndef GCCXML_SKIP_THIS - Eigen::Matrix2cd m_beam_polarization; - Eigen::Matrix2cd m_detector_polarization; -#endif ThreadInfo m_thread_info; SimulationParameters m_sim_params; Simulation *mp_simulation; diff --git a/Core/Algorithms/inc/Detector.h b/Core/Algorithms/inc/Detector.h index b7ab4a6dd08..d4f6932cbd3 100644 --- a/Core/Algorithms/inc/Detector.h +++ b/Core/Algorithms/inc/Detector.h @@ -80,7 +80,7 @@ public: #ifndef GCCXML_SKIP_THIS //! Gets the polarization density matrix (in spin basis along z-axis) - Eigen::Matrix2cd getPolarizationOperator() const + Eigen::Matrix2cd getAnalyzerOperator() const { return m_analyzer_operator; } diff --git a/Core/Algorithms/inc/SimulationElement.h b/Core/Algorithms/inc/SimulationElement.h index 99d4d81e6b7..6e94bcb4889 100644 --- a/Core/Algorithms/inc/SimulationElement.h +++ b/Core/Algorithms/inc/SimulationElement.h @@ -51,13 +51,13 @@ public: } //! Sets the polarization analyzer operator (in spin basis along z-axis) - void setPolarizationOperator(const Eigen::Matrix2cd& polarization_operator) + void setAnalyzerOperator(const Eigen::Matrix2cd& polarization_operator) { m_analyzer_operator = polarization_operator; } //! Gets the polarization analyzer operator (in spin basis along z-axis) - Eigen::Matrix2cd getPolarizationOperator() const + Eigen::Matrix2cd getAnalyzerOperator() const { return m_analyzer_operator; } diff --git a/Core/Algorithms/src/DWBASimulation.cpp b/Core/Algorithms/src/DWBASimulation.cpp index e77b7a420cc..8107de96788 100644 --- a/Core/Algorithms/src/DWBASimulation.cpp +++ b/Core/Algorithms/src/DWBASimulation.cpp @@ -20,8 +20,6 @@ DWBASimulation::DWBASimulation() : m_thread_info() , mp_simulation(0) { - m_beam_polarization.setZero(); - m_detector_polarization.setZero(); } DWBASimulation::~DWBASimulation() diff --git a/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp b/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp index bf9cb57433d..98c1363e572 100644 --- a/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp +++ b/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp @@ -98,8 +98,8 @@ void DecoratedLayerDWBASimulation::calculateCoherentIntensity( // each ffdwba: 1 call to getOutCoeffs if (checkPolarizationPresent()) { // matrix dwba calculation - it->setIntensity(p_strategy->evaluate(k_i, m_beam_polarization, k_f_bin, - m_detector_polarization, alpha_bin, phi_bin) + it->setIntensity(p_strategy->evaluate(k_i, it->getPolarization(), k_f_bin, + it->getAnalyzerOperator(), alpha_bin, phi_bin) * total_surface_density); } else { // scalar dwba calculation diff --git a/Core/Algorithms/src/GISASSimulation.cpp b/Core/Algorithms/src/GISASSimulation.cpp index 64c84c7c9e1..c1bd3f1e505 100644 --- a/Core/Algorithms/src/GISASSimulation.cpp +++ b/Core/Algorithms/src/GISASSimulation.cpp @@ -224,10 +224,10 @@ void GISASSimulation::initSimulationElementVector() m_sim_elements.clear(); Beam beam = m_instrument.getBeam(); double wavelength = beam.getWavelength(); - double alpha_i = beam.getAlpha(); + double alpha_i = - beam.getAlpha(); // Defined to be always positive in Beam double phi_i = beam.getPhi(); Eigen::Matrix2cd beam_polarization = beam.getPolarization(); - Eigen::Matrix2cd analyzer_operator = m_instrument.getDetector().getPolarizationOperator(); + Eigen::Matrix2cd analyzer_operator = m_instrument.getDetector().getAnalyzerOperator(); if (m_instrument.getDetectorDimension()!=2) { throw RuntimeErrorException("GISASSimulation::initSimulationElementVector: " @@ -250,7 +250,7 @@ void GISASSimulation::initSimulationElementVector() SimulationElement sim_element(wavelength, alpha_i, phi_i, alpha_bin.m_lower, alpha_bin.m_upper, phi_bin.m_lower, phi_bin.m_upper); sim_element.setPolarization(beam_polarization); - sim_element.setPolarizationOperator(analyzer_operator); + sim_element.setAnalyzerOperator(analyzer_operator); m_sim_elements.push_back(sim_element); } } diff --git a/Core/Algorithms/src/Instrument.cpp b/Core/Algorithms/src/Instrument.cpp index 7c9d3e9892d..87a66206184 100644 --- a/Core/Algorithms/src/Instrument.cpp +++ b/Core/Algorithms/src/Instrument.cpp @@ -130,7 +130,6 @@ void Instrument::normalize(OutputData<double> *p_intensity, getBeam().getCentralK().z().real()); // normalize by detector cell sizes - //double sin_alpha_i = std::abs(getBeam().getCentralK().cosTheta()); double sin_alpha_i = std::abs(realpart.cosTheta()); m_detector.normalize(p_intensity, p_polarized_intensity, sin_alpha_i); } diff --git a/Core/Algorithms/src/Simulation.cpp b/Core/Algorithms/src/Simulation.cpp index 3a53ac6bbf3..6de679c2a3c 100644 --- a/Core/Algorithms/src/Simulation.cpp +++ b/Core/Algorithms/src/Simulation.cpp @@ -93,8 +93,6 @@ void Simulation::runSimulation() if (m_progress) // TODO: m_progress->init(this, param_combinations); - // Initialize vector of simulation elements - // no averaging needed: if (param_combinations == 1) { boost::scoped_ptr<ParameterPool> p_param_pool(createParameterTree()); diff --git a/Tests/FunctionalTests/TestPyCore/isgisaxs07.py b/Tests/FunctionalTests/TestPyCore/isgisaxs07.py index e13ba273797..ba02d1ea3e1 100644 --- a/Tests/FunctionalTests/TestPyCore/isgisaxs07.py +++ b/Tests/FunctionalTests/TestPyCore/isgisaxs07.py @@ -23,9 +23,6 @@ def RunSimulation(): # collection of particles particle_layout = ParticleLayout() - #ParticleInfo particle_info1(new Particle(n_particle, ff1), 0, pos1, 0.5); - #particle_layout.addParticleInfo(particle_info1); - # # add particle number 1: ff1 = FormFactorBox(2.0*nanometer, 2.0*nanometer,1.0*nanometer) pos1 = kvector_t(0.0*nanometer, 0.0*nanometer, 0.0) -- GitLab