Skip to content
Snippets Groups Projects
Commit 675df01c authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

aesthetics: column width 80

parent 23c5a175
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,8 @@ void FunctionalTestFactory::execute(std::string name, ProgramOptions *p_options) ...@@ -83,7 +83,8 @@ void FunctionalTestFactory::execute(std::string name, ProgramOptions *p_options)
test = createItem( name ); test = createItem( name );
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
std::cout << e.what() << std::endl; std::cout << e.what() << std::endl;
std::cout << "TestFactory::execute() -> Warning. No test with name '" << name << "' is defined." << std::endl; std::cout << "TestFactory::execute() -> Warning. No test with name '"
<< name << "' is defined." << std::endl;
return; return;
} }
...@@ -104,7 +105,8 @@ void FunctionalTestFactory::profile(std::string name, ProgramOptions *p_options) ...@@ -104,7 +105,8 @@ void FunctionalTestFactory::profile(std::string name, ProgramOptions *p_options)
test = createItem( name ); test = createItem( name );
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
std::cout << e.what() << std::endl; std::cout << e.what() << std::endl;
std::cout << "TestFactory::execute() -> Warning. No test with name '" << name << "' is defined." << std::endl; std::cout << "TestFactory::execute() -> Warning. No test with name '"
<< name << "' is defined." << std::endl;
return; return;
} }
...@@ -158,15 +160,18 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -158,15 +160,18 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"diffuse", "diffuse",
IFactoryCreateFunction<TestDiffuseReflection, IFunctionalTest>, IFactoryCreateFunction<TestDiffuseReflection, IFunctionalTest>,
"functional test: diffuse scattering from multilayer with roughness (obsolete)"); "functional test: diffuse scattering from multilayer with roughness "
"(obsolete)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs01", "isgisaxs01",
IFactoryCreateFunction<TestIsGISAXS1, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS1, IFunctionalTest>,
"functional test: isgisaxs ex-1 (2 types of particles without inteference on top of substrate)"); "functional test: isgisaxs ex-1 (2 types of particles without "
"interference on top of substrate)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs02", "isgisaxs02",
IFactoryCreateFunction<TestIsGISAXS2, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS2, IFunctionalTest>,
"functional test: isgisaxs ex-2 (mean form factors for particles with shape size distribution)"); "functional test: isgisaxs ex-2 (mean form factors for particles with "
"shape size distribution)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs03", "isgisaxs03",
IFactoryCreateFunction<TestIsGISAXS3, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS3, IFunctionalTest>,
...@@ -178,19 +183,23 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -178,19 +183,23 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs05", "isgisaxs05",
IFactoryCreateFunction<TestIsGISAXS5, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS5, IFunctionalTest>,
"functional test: isgisaxs ex-5 (fit with paracrystal 1d structure factor)"); "functional test: isgisaxs ex-5 (fit with paracrystal 1d structure "
"factor)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs06", "isgisaxs06",
IFactoryCreateFunction<TestIsGISAXS6, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS6, IFunctionalTest>,
"functional test: isgisaxs ex-6 (cylinders with lattice interference function)"); "functional test: isgisaxs ex-6 (cylinders with lattice interference "
"function)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs07", "isgisaxs07",
IFactoryCreateFunction<TestIsGISAXS7, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS7, IFunctionalTest>,
"functional test: isgisaxs ex-7 (particle mixture from morphology file)"); "functional test: isgisaxs ex-7 (particle mixture from morphology "
"file)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs08", "isgisaxs08",
IFactoryCreateFunction<TestIsGISAXS8, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS8, IFunctionalTest>,
"functional test: isgisaxs ex-8 (paracrystal lattice structure factors)"); "functional test: isgisaxs ex-8 (paracrystal lattice structure "
"factors)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs09", "isgisaxs09",
IFactoryCreateFunction<TestIsGISAXS9, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS9, IFunctionalTest>,
...@@ -198,11 +207,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -198,11 +207,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs10", "isgisaxs10",
IFactoryCreateFunction<TestIsGISAXS10, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS10, IFunctionalTest>,
"functional test: isgisaxs ex-10 (cylinders with interference on top of substrate)"); "functional test: isgisaxs ex-10 (cylinders with interference on top "
"of substrate)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs11", "isgisaxs11",
IFactoryCreateFunction<TestIsGISAXS11, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS11, IFunctionalTest>,
"functional test: isgisaxs ex-11 (core shell parallelopiped islands on top of substrate)"); "functional test: isgisaxs ex-11 (core shell parallelopiped islands "
"on top of substrate)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs12", "isgisaxs12",
IFactoryCreateFunction<TestIsGISAXS12, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS12, IFunctionalTest>,
...@@ -214,11 +225,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -214,11 +225,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs14", "isgisaxs14",
IFactoryCreateFunction<TestIsGISAXS14, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS14, IFunctionalTest>,
"functional test: isgisaxs ex-14 (multilayered sphere on graded interface)"); "functional test: isgisaxs ex-14 (multilayered sphere on graded "
"interface)");
p_test_factory->registerItem( p_test_factory->registerItem(
"isgisaxs15", "isgisaxs15",
IFactoryCreateFunction<TestIsGISAXS15, IFunctionalTest>, IFactoryCreateFunction<TestIsGISAXS15, IFunctionalTest>,
"functional test: isgisaxs ex-15 (size-spacing correlation approximation)"); "functional test: isgisaxs ex-15 (size-spacing correlation "
"approximation)");
p_test_factory->registerItem( p_test_factory->registerItem(
"convolution", "convolution",
IFactoryCreateFunction<TestConvolution, IFunctionalTest>, IFactoryCreateFunction<TestConvolution, IFunctionalTest>,
...@@ -266,7 +279,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -266,7 +279,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"fitbench", "fitbench",
IFactoryCreateFunction<TestFittingBenchmark, IFunctionalTest>, IFactoryCreateFunction<TestFittingBenchmark, IFunctionalTest>,
"functional test: test of minimizers with hard-to-minimize test functions"); "functional test: test of minimizers with hard-to-minimize test "
"functions");
p_test_factory->registerItem( p_test_factory->registerItem(
"Fourier", "Fourier",
IFactoryCreateFunction<TestFourier, IFunctionalTest>, IFactoryCreateFunction<TestFourier, IFunctionalTest>,
...@@ -274,7 +288,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) ...@@ -274,7 +288,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
p_test_factory->registerItem( p_test_factory->registerItem(
"fumili", "fumili",
IFactoryCreateFunction<TestFumiliLMA, IFunctionalTest>, IFactoryCreateFunction<TestFumiliLMA, IFunctionalTest>,
"functional test: test of ROOT's LMA-based minimizers Fumili and GSLMultiFit"); "functional test: test of ROOT's LMA-based minimizers Fumili and "
"GSLMultiFit");
p_test_factory->registerItem( p_test_factory->registerItem(
"toyexp", "toyexp",
IFactoryCreateFunction<TestToySimulation, IFunctionalTest>, IFactoryCreateFunction<TestToySimulation, IFunctionalTest>,
......
// ************************************************************************** // // ************************************************************************** //
// //
// BornAgain: simulate and fit scattering at grazing incidence // BornAgain: simulate and fit scattering at grazing incidence
// //
//! @file App/src/TestIsGISAXS13.cpp //! @file App/src/TestIsGISAXS13.cpp
...@@ -61,7 +61,8 @@ TestIsGISAXS13::TestIsGISAXS13() ...@@ -61,7 +61,8 @@ TestIsGISAXS13::TestIsGISAXS13()
, mp_fitSuite(0) , mp_fitSuite(0)
{ {
setOutputPath(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-13/"); setOutputPath(Utils::FileSystem::GetHomePath()+
"./Examples/IsGISAXS_examples/ex-13/");
} }
...@@ -93,29 +94,44 @@ void TestIsGISAXS13::run_isgisaxs_fit() ...@@ -93,29 +94,44 @@ void TestIsGISAXS13::run_isgisaxs_fit()
// m_fitSuite->setMinimizer( MinimizerFactory::createMinimizer("Scan") ); // m_fitSuite->setMinimizer( MinimizerFactory::createMinimizer("Scan") );
// observers // observers
mp_fitSuite->attachObserver( FitSuiteObserverFactory::createPrintObserver(10) ); mp_fitSuite->attachObserver( FitSuiteObserverFactory::
mp_fitSuite->attachObserver( FitSuiteObserverFactory::createDrawObserver(50) ); createPrintObserver(10) );
mp_fitSuite->attachObserver( FitSuiteObserverFactory::
createDrawObserver(50) );
// fit parameters // fit parameters
mp_fitSuite->addFitParameter("*Normalizer/scale", 1e5, 1e3, AttLimits::limited(1e4, 2e5)); mp_fitSuite->addFitParameter("*Normalizer/scale", 1e5, 1e3,
mp_fitSuite->addFitParameter("*Normalizer/shift", 10, 0.1, AttLimits::limited(0., 20.)); AttLimits::limited(1e4, 2e5));
mp_fitSuite->addFitParameter("*SampleBuilder/particle_radius", 4.0e+00*Units::nanometer, 0.04*Units::nanometer, AttLimits::limited(2.0, 8.0) ); mp_fitSuite->addFitParameter("*Normalizer/shift", 10, 0.1,
mp_fitSuite->addFitParameter("*SampleBuilder/dispersion_radius", 0.2, 0.002, AttLimits::limited(0.01, 1.0) ); AttLimits::limited(0., 20.));
mp_fitSuite->addFitParameter("*SampleBuilder/height_aspect_ratio", 0.8, 0.08, AttLimits::limited(0.5, 1.5) ); mp_fitSuite->addFitParameter("*SampleBuilder/particle_radius",
mp_fitSuite->addFitParameter("*SampleBuilder/interf_distance", 15*Units::nanometer, 0.015*Units::nanometer, AttLimits::limited(0.01, 50.0) ); 4.0e+00*Units::nanometer, 0.04*Units::nanometer,
mp_fitSuite->addFitParameter("*SampleBuilder/interf_width", 3*Units::nanometer, 0.03*Units::nanometer, AttLimits::limited(0.01, 10.) ); AttLimits::limited(2.0, 8.0) );
mp_fitSuite->addFitParameter("*SampleBuilder/dispersion_radius",
0.2, 0.002, AttLimits::limited(0.01, 1.0) );
mp_fitSuite->addFitParameter("*SampleBuilder/height_aspect_ratio",
0.8, 0.08, AttLimits::limited(0.5, 1.5) );
mp_fitSuite->addFitParameter("*SampleBuilder/interf_distance",
15*Units::nanometer, 0.015*Units::nanometer,
AttLimits::limited(0.01, 50.0) );
mp_fitSuite->addFitParameter("*SampleBuilder/interf_width",
3*Units::nanometer, 0.03*Units::nanometer,
AttLimits::limited(0.01, 10.) );
// reading 1D data scans defined in isgisaxs example // reading 1D data scans defined in isgisaxs example
IsGISAXSData::DataSet_t isgi_scans; IsGISAXSData::DataSet_t isgi_scans;
IsGISAXSData::read_datfile(getOutputPath()+"isgi_simulated_annealing.dat", isgi_scans); IsGISAXSData::read_datfile(getOutputPath()+"isgi_simulated_annealing.dat",
isgi_scans);
// chi squared module // chi squared module
ChiSquaredModule chiModule; ChiSquaredModule chiModule;
chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) );
chiModule.setOutputDataNormalizer( OutputDataNormalizer() ); chiModule.setOutputDataNormalizer( OutputDataNormalizer() );
//chiModule.setIntensityFunction( IntensityFunctionLog() ); //chiModule.setIntensityFunction( IntensityFunctionLog() );
for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin(); it!= isgi_scans.end(); ++it) { for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin();
mp_fitSuite->addSimulationAndRealData(*mp_simulation, *(*it), chiModule); it!= isgi_scans.end(); ++it) {
mp_fitSuite->addSimulationAndRealData(*mp_simulation, *(*it),
chiModule);
} }
mp_fitSuite->runFit(); mp_fitSuite->runFit();
...@@ -148,8 +164,10 @@ void TestIsGISAXS13::run_isgisaxs_fit() ...@@ -148,8 +164,10 @@ void TestIsGISAXS13::run_isgisaxs_fit()
for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) { for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) {
c2->cd((int)i_set+1); c2->cd((int)i_set+1);
const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set); const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set);
TH1D *hreal = IsGISAXSTools::getOutputDataScanHist(*obj->getChiSquaredModule()->getRealData(),"BornAgain_real"); TH1D *hreal = IsGISAXSTools::getOutputDataScanHist(*obj->
TH1D *hsimul = IsGISAXSTools::getOutputDataScanHist(*obj->getChiSquaredModule()->getSimulationData(),"BornAgain_simul"); getChiSquaredModule()->getRealData(),"BornAgain_real");
TH1D *hsimul = IsGISAXSTools::getOutputDataScanHist(*obj->
getChiSquaredModule()->getSimulationData(),"BornAgain_simul");
hreal->SetLineColor(kBlue); hreal->SetLineColor(kBlue);
gPad->SetLogy(); gPad->SetLogy();
hreal->DrawCopy(); hreal->DrawCopy();
...@@ -167,12 +185,15 @@ void TestIsGISAXS13::run_isgisaxs_fit() ...@@ -167,12 +185,15 @@ void TestIsGISAXS13::run_isgisaxs_fit()
for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) { for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) {
c2->cd(3+1); c2->cd(3+1);
const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set); const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set);
OutputData<double > *real = obj->getChiSquaredModule()->getRealData()->clone(); OutputData<double > *real = obj->getChiSquaredModule()->
OutputData<double > *simul = obj->getChiSquaredModule()->getSimulationData()->clone(); getRealData()->clone();
OutputData<double > *simul = obj->getChiSquaredModule()->
getSimulationData()->clone();
c2->cd((int)(i_set+3)); c2->cd((int)(i_set+3));
*simul /= *real; *simul /= *real;
TH1D *hratio = IsGISAXSTools::getOutputDataScanHist(*simul,"BornAgain_real_simul_ratio"); TH1D *hratio = IsGISAXSTools::getOutputDataScanHist(*simul,
"BornAgain_real_simul_ratio");
hratio->DrawCopy(); hratio->DrawCopy();
if(i_set==0) { if(i_set==0) {
leg2->AddEntry(hratio,"BornAgain simul/real","lp"); leg2->AddEntry(hratio,"BornAgain simul/real","lp");
...@@ -197,8 +218,11 @@ void TestIsGISAXS13::initializeSimulation() ...@@ -197,8 +218,11 @@ void TestIsGISAXS13::initializeSimulation()
delete mp_simulation; delete mp_simulation;
mp_simulation = new Simulation(mp_options); mp_simulation = new Simulation(mp_options);
mp_simulation->setSampleBuilder(mp_sample_builder); mp_simulation->setSampleBuilder(mp_sample_builder);
mp_simulation->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); mp_simulation->setDetectorParameters(
mp_simulation->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); 100, 0.0*Units::degree, 2.0*Units::degree,
100, 0.0*Units::degree, 2.0*Units::degree, true);
mp_simulation->setBeamParameters(1.0*Units::angstrom,
-0.2*Units::degree, 0.0*Units::degree);
} }
......
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