Skip to content
Snippets Groups Projects
Commit c7aace04 authored by Ganeva, Marina's avatar Ganeva, Marina
Browse files

Layer with roughness functional test is adjusted to new standarts. Plotting problem is solved.

parent 97efa3c0
No related branches found
No related tags found
No related merge requests found
......@@ -706,8 +706,9 @@ void IsGISAXSTools::drawOutputDataComparisonResults(
// our calculations
c1->cd(1); gPad->SetLogz();
gPad->SetRightMargin(0.12);
IsGISAXSTools::setMinimum(hmin);
if(hmax>0) IsGISAXSTools::setMaximum(hmax);
if(hasMinimum()) IsGISAXSTools::setMinimum(hmin);
//if(hmax>0) IsGISAXSTools::setMaximum(hmax);
if(hasMaximum()) IsGISAXSTools::setMaximum(hmax);
IsGISAXSTools::drawOutputDataInPad(data, "CONT4 Z", "this");
// isgisaxs data
......
......@@ -86,6 +86,10 @@ FunctionalTestRegistry::Catalogue::Catalogue()
"Polarized DWBA with zero magnetic field",
"isgi_cylinder_DWBA.ima.gz", 1e-10);
add("LayerWithRoughness",
"Layers with correlated roughness",
"layer_with_roughness.ima.gz", 2e-10);
}
......
......@@ -84,7 +84,7 @@ SimulationRegistry::SimulationRegistry()
registerItem(
"LayerWithRoughness", StandardSimulations::LayerWithRoughness,
"layer with correlated roughness");
"Layers with correlated roughness");
}
......
......@@ -422,6 +422,7 @@ Simulation *StandardSimulations::LayerWithRoughness()
1.0*Units::angstrom, 0.2*Units::degree, 0.0*Units::degree);
result->setSampleBuilder( builder );
//result->setBeamIntensity(1e+06);
return result;
}
#include "LayerWithRoughness.h"
#include "OutputDataIOFactory.h"
#include "SampleBuilderFactory.h"
#include "Simulation.h"
#include "Utils.h"
#include "Units.h"
#include "MathFunctions.h"
#include "SimulationRegistry.h"
#include "OutputDataFunctions.h"
#include <iostream>
#include <cmath>
FunctionalTests::LayerWithRoughness::LayerWithRoughness()
: m_name("LayerWithRoughness")
, m_description("Layers with correlated roughness")
, m_result(0)
, m_reference(0)
{ }
void FunctionalTests::LayerWithRoughness::run(const std::string &path_to_data)
{
SimulationRegistry sim_registry;
Simulation *simulation = sim_registry.createSimulation("LayerWithRoughness");
// loading reference data
std::string filename = path_to_data + "layer_with_roughness.ima.gz";
m_reference = OutputDataIOFactory::readIntensityData(filename);
simulation->runSimulation();
m_result = simulation->getIntensityData();
//OutputDataIOFactory::writeIntensityData(*m_result,filename);
delete simulation;
}
int FunctionalTests::LayerWithRoughness::analyseResults()
{
const double threshold(2e-10);
// Calculating average relative difference.
double diff = OutputDataFunctions::GetDifference(*m_result,*m_reference);
// Assess result.
bool status_ok(true);
if( diff > threshold ) status_ok=false;
std::cout << " diff " << diff << std::endl;
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::LayerWithRoughness test;
test.run(GetPathToData(argc, argv));
return test.analyseResults();
if(argc == 2) Utils::FileSystem::SetReferenceDataDir(argv[1]);
return FUNCTIONAL_TEST("LayerWithRoughness");
}
#endif
#ifndef FUNCTIONALTESTS_LAYERWITHROUGHNESS_H
#define FUNCTIONALTESTS_LAYERWITHROUGHNESS_H
#include "ISampleBuilder.h"
#include <string>
#include "OutputData.h"
namespace FunctionalTests {
class LayerWithRoughness
{
public:
LayerWithRoughness();
~LayerWithRoughness() { 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