Skip to content
Snippets Groups Projects
Commit 80583e88 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Update and improve report from Std Check

parent 1d130a6e
No related branches found
No related tags found
No related merge requests found
......@@ -31,34 +31,36 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati
// Load reference if available
ASSERT(name != "");
try {
reference.reset(IntensityDataIOFactory::readOutputData(
FileSystemUtils::jointPath(BATesting::ReferenceDir_Std(), name + ".int.gz")));
const std::string refPath = FileSystemUtils::jointPath(
BATesting::ReferenceDir_Std(), name + ".int.gz");
std::cout << "- compare with reference: " << refPath << "\n";
reference.reset(IntensityDataIOFactory::readOutputData(refPath));
} catch (const std::exception&) {
std::cout << "No reference found, but we proceed with the simulation to create a new one\n";
std::cout << "Failure: reference not found\n";
std::cout << " note: we proceed with the simulation to create a new one\n";
}
// Compare with reference if available.
bool success = false;
if (reference) {
std::cout << "- check diff" << std::endl;
success = IntensityDataFunctions::checkRelativeDifference(*reference, *result_data, limit);
if (IntensityDataFunctions::checkRelativeDifference(*reference, *result_data, limit)) {
std::cout << "- success" << std::endl;
return true; // regular exit
}
std::cout << "Failure ..." << std::endl;
}
// Save simulation if different from reference.
if (!success) {
std::cout << "- failure ..." << std::endl;
FileSystemUtils::createDirectories(BATesting::TestOutDir_Std());
std::string out_fname =
FileSystemUtils::jointPath(BATesting::TestOutDir_Std(), name + ".int.gz");
IntensityDataIOFactory::writeOutputData(*result_data, out_fname);
std::cout << "New simulation result stored in " << out_fname << "\n"
<< "To visualize an intensity map, use " << BABuild::buildBinDir()
<< "/plot_intensity_data.py;"
<< " to plot a difference image, use " << BABuild::buildBinDir()
<< "/plot_intensity_data_diff.py\n"
<< "If the new result is correct, then move it to "
<< BATesting::ReferenceDir_Core() << "/\n";
}
// Save simulation, as it differs from reference.
FileSystemUtils::createDirectories(BATesting::TestOutDir_Std());
std::string out_fname =
FileSystemUtils::jointPath(BATesting::TestOutDir_Std(), name + ".int.gz");
IntensityDataIOFactory::writeOutputData(*result_data, out_fname);
std::cout << "New simulation result: " << out_fname << "\n"
<< "To visualize an intensity map, use " << BABuild::buildBinDir() << "/plot_int.py;"
<< " to plot a difference image, use " << BABuild::buildBinDir()
<< "/plot_diff_int.py\n"
<< "If the new result is correct, then move it to "
<< BATesting::ReferenceDir_Core() << "/\n";
return success;
return false;
}
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