Skip to content
Snippets Groups Projects
Commit 19bbf64a authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

IsGISAXS11 test cleanup

parent eae5875e
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@ set(executable_name App)
# source files
file(GLOB source_files
"src/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS11/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS15/*.cpp"
)
......@@ -19,13 +18,11 @@ list(REMOVE_ITEM source_files ${CMAKE_CURRENT_SOURCE_DIR}/src/AppDict.cpp)
# include files
file(GLOB include_files
"inc/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS11/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS15/*.h"
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS11
${CMAKE_CURRENT_SOURCE_DIR}/../Tests/FunctionalTests/TestCore/IsGISAXS15
)
......
......@@ -32,8 +32,6 @@ ISample *MultilayerOffspecTestcase2a();
ISample *MultilayerOffspecTestcase2b();
ISample *MultilayerSpecularMagneticTestCase();
ISample *PolarizedDWBATestCase();
ISample *IsGISAXS11_CoreShellParticles();
ISample *IsGISAXS14_LayeredSpheresOnGradedInterface();
ISample *IsGISAXS15_SSCA();
ISample *MesoCrystal1();
ISample *MesoCrystal2();
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/inc/TestIsGISAXS11.h
//! @brief Defines class TestIsGISAXS11.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef TESTISGISAXS11_H_
#define TESTISGISAXS11_H_
#include "IApplicationTest.h"
//! IsGISAXS ex#11: ?.
class TestIsGISAXS11 : public IApplicationTest
{
public:
TestIsGISAXS11();
virtual ~TestIsGISAXS11(){ }
virtual void execute();
virtual void finalise();
};
#endif /* TESTISGISAXS11_H_ */
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/inc/TestIsGISAXS14.h
//! @brief Defines class TestIsGISAXS14.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef TESTISGISAXS14_H
#define TESTISGISAXS14_H
#include "IApplicationTest.h"
//! IsGISAXS ex#14: Multi layered sphere on graded interface.
class TestIsGISAXS14 : public IApplicationTest
{
public:
TestIsGISAXS14();
virtual ~TestIsGISAXS14() {}
virtual void execute();
virtual void finalise();
};
#endif // TESTISGISAXS14_H
......@@ -25,10 +25,8 @@
#include "TestFormFactors.h"
#include "TestFourier.h"
#include "TestFumiliLMA.h"
#include "TestIsGISAXS11.h"
#include "TestIsGISAXS12.h"
#include "TestIsGISAXS13.h"
#include "TestIsGISAXS14.h"
#include "TestIsGISAXS15.h"
#include "TestIsGISAXS5.h"
#include "TestMesoCrystal1.h"
......@@ -161,11 +159,6 @@ void RegisterApplicationTests(ApplicationTestFactory *p_test_factory)
IFactoryCreateFunction<TestIsGISAXS5, IApplicationTest>,
"functional test: isgisaxs ex-5 (fit with paracrystal 1d structure "
"factor)");
p_test_factory->registerItem(
"isgisaxs11",
IFactoryCreateFunction<TestIsGISAXS11, IApplicationTest>,
"functional test: isgisaxs ex-11 (core shell parallelopiped islands "
"on top of substrate)");
p_test_factory->registerItem(
"isgisaxs12",
IFactoryCreateFunction<TestIsGISAXS12, IApplicationTest>,
......@@ -174,11 +167,6 @@ void RegisterApplicationTests(ApplicationTestFactory *p_test_factory)
"isgisaxs13",
IFactoryCreateFunction<TestIsGISAXS13, IApplicationTest>,
"functional test: isgisaxs ex-13 (simulated annealing fit)");
p_test_factory->registerItem(
"isgisaxs14",
IFactoryCreateFunction<TestIsGISAXS14, IApplicationTest>,
"functional test: isgisaxs ex-14 (multilayered sphere on graded "
"interface)");
p_test_factory->registerItem(
"isgisaxs15",
IFactoryCreateFunction<TestIsGISAXS15, IApplicationTest>,
......
......@@ -50,12 +50,6 @@ SampleFactory::SampleFactory()
registerItem("MultilayerSpecularMagneticTestCase",
StandardSamples::MultilayerSpecularMagneticTestCase);
// IsGISAXS11 example: core shell parallelepipeds
registerItem("IsGISAXS11_CoreShellParticle", StandardSamples::IsGISAXS11_CoreShellParticles);
// IsGISAXS14 example: layered sphere on graded interface
registerItem("IsGISAXS14_LayeredSpheresOnGradedInterface", StandardSamples::IsGISAXS14_LayeredSpheresOnGradedInterface);
// IsGISAXS15 example: Size-Spacing Correlation Approximation
registerItem("IsGISAXS15_SSCA", StandardSamples::IsGISAXS15_SSCA);
......
......@@ -255,73 +255,6 @@ ISample *StandardSamples::MultilayerOffspecTestcase2b()
}
// IsGISAXS ex#11: Core-shell parallelepiped islands.
ISample *StandardSamples::IsGISAXS11_CoreShellParticles()
{
MultiLayer *p_multi_layer = new MultiLayer();
complex_t n_air(1.0, 0.0);
complex_t n_particle_shell(1.0-1e-4, 2e-8);
complex_t n_particle_core(1.0-6e-5, 2e-8);
const IMaterial *p_air_material =
MaterialManager::getHomogeneousMaterial("Air11", n_air);
const IMaterial *core_material =
MaterialManager::getHomogeneousMaterial("Core", n_particle_core);
const IMaterial *shell_material =
MaterialManager::getHomogeneousMaterial("Shell", n_particle_core);
Layer air_layer;
air_layer.setMaterial(p_air_material);
Particle shell_particle(shell_material, new FormFactorParallelepiped
(8*Units::nanometer, 8*Units::nanometer));
Particle core_particle(core_material, new FormFactorParallelepiped
(7*Units::nanometer, 6*Units::nanometer));
kvector_t core_position(0.0, 0.0, 0.0);
ParticleCoreShell particle(shell_particle, core_particle, core_position);
ParticleDecoration particle_decoration(particle.clone());
particle_decoration.addInterferenceFunction(new InterferenceFunctionNone());
air_layer.setDecoration(particle_decoration);
p_multi_layer->addLayer(air_layer);
return p_multi_layer;
}
//! IsGISAXS ex#14: Layered sphere on graded interface.
ISample *StandardSamples::IsGISAXS14_LayeredSpheresOnGradedInterface()
{
MultiLayer *p_multi_layer = new MultiLayer();
complex_t n_air(1.0, 0.0);
complex_t n_substrate(1.0-6e-6, 2e-8);
complex_t n_particle(1.0-6e-5, 2e-8);
const IMaterial *p_air_material =
MaterialManager::getHomogeneousMaterial("Air10", n_air);
const IMaterial *p_substrate_material =
MaterialManager::getHomogeneousMaterial("Substrate10", n_substrate);
const IMaterial *particle_material =
MaterialManager::getHomogeneousMaterial("Particle", n_particle);
Layer air_layer;
air_layer.setMaterial(p_air_material);
Layer substrate_layer;
substrate_layer.setMaterial(p_substrate_material);
IInterferenceFunction *p_interference_function =
new InterferenceFunction1DParaCrystal
(15.0*Units::nanometer,5*Units::nanometer, 1e7*Units::nanometer);
ParticleDecoration particle_decoration
(new Particle(particle_material, new FormFactorSphere
(5*Units::nanometer, 5.*2.0*Units::nanometer)));
particle_decoration.addInterferenceFunction(p_interference_function);
air_layer.setDecoration(particle_decoration);
p_multi_layer->addLayer(air_layer);
p_multi_layer->addLayer(substrate_layer);
return p_multi_layer;
}
//! IsGISAXS ex#15: Size-spacing correlation approximation.
ISample *StandardSamples::IsGISAXS15_SSCA()
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/src/TestIsGISAXS11.cpp
//! @brief Implements class TestIsGISAXS11.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#include "TestIsGISAXS11.h"
#include "IsGISAXS11.h"
#include "IsGISAXSTools.h"
#include "OutputDataIOFactory.h"
#include "Utils.h"
#include <fstream>
TestIsGISAXS11::TestIsGISAXS11() : IApplicationTest("TestIsGISAXS11")
{
setOutputPath(Utils::FileSystem::GetPathToData("../Tests/ReferenceData/IsGISAXS/ex-11/" ));
}
void TestIsGISAXS11::execute()
{
FunctionalTests::IsGISAXS11 test;
test.run();
OutputDataIOFactory::writeIntensityData(*test.getOutputData(), "this_core_shell_qxqy.ima");
}
void TestIsGISAXS11::finalise()
{
std::string isgi_file(getOutputPath()+"isgi_core_shell_qxqy.ima.gz");
std::string this_file("this_core_shell_qxqy.ima");
OutputData<double> *isgi_data = OutputDataIOFactory::readIntensityData(isgi_file);
OutputData<double> *our_data = OutputDataIOFactory::readIntensityData(this_file);
IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, "TestIsGISAXS11_c1", "Core shell parallelepiped islands");
delete isgi_data;
delete our_data;
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/src/TestIsGISAXS14.cpp
//! @brief Implements class TestIsGISAXS14.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2013
//! @authors Scientific Computing Group at MLZ Garching
//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#include "TestIsGISAXS14.h"
#include "IsGISAXSTools.h"
#include "OutputDataIOFactory.h"
#include "Utils.h"
#include "Simulation.h"
#include "MultiLayer.h"
#include "SampleFactory.h"
#include "Units.h"
#include <fstream>
TestIsGISAXS14::TestIsGISAXS14() : IApplicationTest("TestIsGISAXS14")
{
setOutputPath(Utils::FileSystem::GetPathToData("../Tests/ReferenceData/IsGISAXS/ex-14/" ));
}
void TestIsGISAXS14::execute()
{
MultiLayer *sample = dynamic_cast<MultiLayer *>(SampleFactory::createSample("IsGISAXS14_LayeredSpheresOnGradedInterface"));
Simulation simulation(mp_options);
simulation.setSample(*sample);
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.runSimulation();
OutputDataIOFactory::writeIntensityData(*simulation.getIntensityData(), "this_multilayer_sphere.ima");
}
void TestIsGISAXS14::finalise()
{
//std::string isgi_file(getOutputPath()+"isgi_normal_sphere_H2.0.ima");
std::string isgi_file(getOutputPath()+"test_this_fullsphere.ima");
// std::string isgi_file(getOutputPath()+"isgi_normal_sphere_H2.0_nocorr.ima");
// std::string isgi_file(getOutputPath()+"isgi_normal_fullsphere_nocorr.ima");
// std::string this_file(getOutputPath()+"this_multilayer_sphere_nocorr.ima");
std::string this_file("this_multilayer_sphere.ima");
OutputData<double> *isgi_data = OutputDataIOFactory::readIntensityData(isgi_file);
OutputData<double> *our_data = OutputDataIOFactory::readIntensityData(this_file);
IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, "TestIsGISAXS14_c1", "Multilayered sphere on graded interface");
delete isgi_data;
delete our_data;
}
......@@ -69,6 +69,10 @@ FunctionalTestRegistry::Catalogue::Catalogue()
"Cylinders with interference on top of substrate",
"isgisaxs10_reference.ima.gz", 2e-10);
add("isgisaxs11",
"Core shell nanoparticles",
"isgisaxs11_reference.ima.gz", 2e-10);
}
......
......@@ -48,7 +48,6 @@ SimulationRegistry::SimulationRegistry()
"isgisaxs07", StandardSimulations::IsGISAXS07,
"Mixture of different particles a la IsGISAXS morphology file");
registerItem(
"isgisaxs08a", StandardSimulations::IsGISAXS08a,
"2DDL paracrystal lattice");
......@@ -59,7 +58,6 @@ SimulationRegistry::SimulationRegistry()
registerItem(
"isgisaxs09a", StandardSimulations::IsGISAXS09a,
"Pyramids on top of substrate");
registerItem(
"isgisaxs09b", StandardSimulations::IsGISAXS09b,
"Rotated pyramids on top of substrate");
......@@ -70,13 +68,12 @@ SimulationRegistry::SimulationRegistry()
registerItem(
"isgisaxs11", StandardSimulations::IsGISAXS11,
"IsGISAXS11 example, Core shell nanoparticles");
"Core shell nanoparticles");
registerItem(
"isgisaxs15", StandardSimulations::IsGISAXS15,
"IsGISAXS15 example, Size spacing correlation approximation");
registerItem(
"mesocrystal01", StandardSimulations::MesoCrystal01,
"mesocrystals of cylindrical shape composed by spherical nanoparticles");
......
#include "IsGISAXS11.h"
#include "FormFactorParallelepiped.h"
#include "InterferenceFunctionNone.h"
#include "MaterialManager.h"
#include "MultiLayer.h"
#include "OutputDataIOFactory.h"
#include "ParticleBuilder.h"
#include "ParticleCoreShell.h"
#include "ParticleDecoration.h"
#include "Simulation.h"
#include "Units.h"
#include "Utils.h"
#include "MathFunctions.h"
#include "SimulationRegistry.h"
#include "OutputDataFunctions.h"
#include <iostream>
#include <cmath>
FunctionalTests::IsGISAXS11::IsGISAXS11()
: m_name("IsGISAXS11")
, m_description("Core shell nanoparticles")
, m_result(0)
, m_reference(0)
{
}
void FunctionalTests::IsGISAXS11::run(const std::string &path_to_data)
{
SimulationRegistry sim_registry;
Simulation *simulation = sim_registry.createSimulation("isgisaxs11");
// loading reference data
std::string filename = path_to_data + "isgisaxs11_reference.ima.gz";
m_reference = OutputDataIOFactory::readIntensityData(filename);
simulation->runSimulation();
m_result = simulation->getIntensityData();
delete simulation;
}
int FunctionalTests::IsGISAXS11::analyseResults()
{
const double threshold(2e-10);
// calculating average relative difference
double diff = OutputDataFunctions::GetDifference(*m_result,*m_reference);
bool status_ok(true);
if( diff > threshold ) status_ok=false;
std::cout << m_name << " " << m_description << " " <<
(status_ok ? "[OK]" : "[FAILED]") << std::endl;
return (status_ok ? 0 : 1);
}
#ifdef STANDALONE
std::string GetPathToData(int argc, char **argv)
{
if(argc == 2) return argv[1];
return Utils::FileSystem::GetPathToData("../../../ReferenceData/BornAgain/", argv[0]);
}
#include "FunctionalTestRegistry.h"
#include "FileSystem.h"
int main(int argc, char **argv)
{
FunctionalTests::IsGISAXS11 test;
test.run(GetPathToData(argc, argv));
return test.analyseResults();
if(argc == 2) Utils::FileSystem::SetReferenceDataDir(argv[1]);
return FUNCTIONAL_TEST("isgisaxs11");
}
#endif
#ifndef FUNCTIONALTESTS_ISGISAXS11_H
#define FUNCTIONALTESTS_ISGISAXS11_H
#include "ISampleBuilder.h"
#include <string>
#include "OutputData.h"
namespace FunctionalTests {
class IsGISAXS11
{
public :
IsGISAXS11();
~IsGISAXS11() { delete m_result; delete m_reference; }
void run(const std::string &path_to_data = std::string());
int analyseResults();
const OutputData<double> *getOutputData() { return m_result; }
private:
std::string m_name;
std::string m_description;
OutputData<double> *m_result;
OutputData<double> *m_reference;
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment