diff --git a/Base/Util/PyFmt.cpp b/Base/Py/PyFmt.cpp similarity index 98% rename from Base/Util/PyFmt.cpp rename to Base/Py/PyFmt.cpp index 2fc6defad0a2f6822808c262f013b9e93d547c2e..5c9f9749c3993780eb31a37caa91b45095f8882e 100644 --- a/Base/Util/PyFmt.cpp +++ b/Base/Py/PyFmt.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Base/Util/PyFmt.cpp +//! @file Base/Py/PyFmt.cpp //! @brief Implements functions from namespace pyfmt. //! //! @homepage http://www.bornagainproject.org @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Base/Const/Units.h" // printDegrees #include "Base/Math/Constants.h" #include "Base/Util/Algorithms.h" diff --git a/Base/Util/PyFmt.h b/Base/Py/PyFmt.h similarity index 95% rename from Base/Util/PyFmt.h rename to Base/Py/PyFmt.h index 4dc6e665b6c5bfc063e43beb9a2e79bccca7773b..83d82883c35acd8b1bb12ac03a9575edb7e925a3 100644 --- a/Base/Util/PyFmt.h +++ b/Base/Py/PyFmt.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Base/Util/PyFmt.h +//! @file Base/Py/PyFmt.h //! @brief Defines namespace pyfmt. //! //! @homepage http://www.bornagainproject.org @@ -17,8 +17,8 @@ #endif #ifndef USER_API -#ifndef BORNAGAIN_BASE_UTIL_PYFMT_H -#define BORNAGAIN_BASE_UTIL_PYFMT_H +#ifndef BORNAGAIN_BASE_PY_PYFMT_H +#define BORNAGAIN_BASE_PY_PYFMT_H #include <heinz/Vectors3D.h> #include <string> @@ -74,5 +74,5 @@ std::string indent(size_t width = 4u); } // namespace Py::Fmt -#endif // BORNAGAIN_BASE_UTIL_PYFMT_H +#endif // BORNAGAIN_BASE_PY_PYFMT_H #endif // USER_API diff --git a/Core/Export/PyFmt2.cpp b/Core/Export/PyFmt2.cpp index ad02725cfcc68ea9a0733576e4429fd7372499cd..b2f4fc65b748ccf63db37191f7d2bd33855b508e 100644 --- a/Core/Export/PyFmt2.cpp +++ b/Core/Export/PyFmt2.cpp @@ -18,7 +18,7 @@ #include "Base/Const/Units.h" #include "Base/Math/Constants.h" #include "Base/Util/Algorithms.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Base/Util/StringUtils.h" #include "Core/Export/PyFmtLimits.h" #include "Device/Mask/Ellipse.h" diff --git a/Core/Export/PyFmtLimits.cpp b/Core/Export/PyFmtLimits.cpp index ecc0755634b8b4e8934f3e866be2ce91912516f2..c55b8f9577968dc167030a903d1156b4cd6e7ccd 100644 --- a/Core/Export/PyFmtLimits.cpp +++ b/Core/Export/PyFmtLimits.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "Core/Export/PyFmtLimits.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Fit/Param/RealLimits.h" #include <iomanip> diff --git a/Core/Export/SampleToPython.cpp b/Core/Export/SampleToPython.cpp index fadbc2b51660a70767c0bec17647a7c4d047758a..ed8632c17c9f1577efa539c57482d8bf46bd653b 100644 --- a/Core/Export/SampleToPython.cpp +++ b/Core/Export/SampleToPython.cpp @@ -14,7 +14,7 @@ #include "Core/Export/SampleToPython.h" #include "Base/Util/Assert.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Base/Vector/RotMatrix.h" #include "Core/Export/ComponentKeyHandler.h" #include "Core/Export/MaterialKeyHandler.h" diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp index c34ae8f7e2eff2adedbf6b2c5d305a8805df9d98..ff43d6b1b2271abd1742e195dafbe45e220786e3 100644 --- a/Core/Export/SimulationToPython.cpp +++ b/Core/Export/SimulationToPython.cpp @@ -14,7 +14,7 @@ #include "Core/Export/SimulationToPython.h" #include "Base/Util/Algorithms.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Core/Background/ConstantBackground.h" #include "Core/Background/PoissonNoiseBackground.h" #include "Core/Export/PyFmt2.h" diff --git a/Device/Data/DataUtils.cpp b/Device/Data/DataUtils.cpp index 05d9c23afbe067fbc11abfc9167daeda224eca96..7002d4001ff26257f6074bc8c45bfc2c7a70821e 100644 --- a/Device/Data/DataUtils.cpp +++ b/Device/Data/DataUtils.cpp @@ -16,7 +16,6 @@ #include "Base/Math/FourierTransform.h" #include "Base/Math/Numeric.h" #include "Device/Data/ArrayUtils.h" -#include "Device/Histo/IHistogram.h" #include <iostream> namespace { @@ -48,30 +47,6 @@ double DataUtils::Data::relativeDataDifference(const OutputData<double>& dat, return diff; } -//! Returns true is relative difference is below threshold; prints informative output -bool DataUtils::Data::checkRelativeDifference(const OutputData<double>& dat, - const OutputData<double>& ref, const double threshold) -{ - const std::unique_ptr<const IHistogram> histo(IHistogram::createHistogram(dat)); - if (histo->getMinimum() == 0 && histo->getMaximum() == 0) { - std::cerr << "FAILED: simulated data set is empty" << std::endl; - return false; - } - - const double diff = relativeDataDifference(dat, ref); - if (diff > threshold) { - std::cerr << "FAILED: relative deviation of dat from ref is " << diff - << ", above given threshold " << threshold << std::endl; - return false; - } - if (diff) - std::cerr << "- OK: relative deviation of dat from ref is " << diff - << ", within given threshold " << threshold << std::endl; - else - std::cout << "- OK: dat = ref\n"; - return true; -} - std::unique_ptr<OutputData<double>> DataUtils::Data::createRelativeDifferenceData(const OutputData<double>& data, const OutputData<double>& reference) diff --git a/Device/Data/DataUtils.h b/Device/Data/DataUtils.h index 1145edb22a947e77f24eb7caa866902382e34da5..0f19301306b569025f2a74c3720137ce9b58e480 100644 --- a/Device/Data/DataUtils.h +++ b/Device/Data/DataUtils.h @@ -23,10 +23,6 @@ namespace DataUtils::Data { //! Returns relative difference between two data sets sum(dat[i] - ref[i])/ref[i]). double relativeDataDifference(const OutputData<double>& dat, const OutputData<double>& ref); -//! Returns true is relative difference is below threshold; prints informative output -bool checkRelativeDifference(const OutputData<double>& dat, const OutputData<double>& ref, - double threshold); - //! Transforms coordinate on axis into the bin-fraction-coordinate. double coordinateToBinf(double coordinate, const IAxis& axis); diff --git a/Device/Histo/HistoUtils.cpp b/Device/Histo/HistoUtils.cpp index 226a1265dfbe9b9f94e84e037b3c6b8f19b9c577..89cd850ab0f4437b11618a72ba4a73bc659f43cc 100644 --- a/Device/Histo/HistoUtils.cpp +++ b/Device/Histo/HistoUtils.cpp @@ -79,6 +79,30 @@ double DataUtils::Histo::getRelativeDifference(const IHistogram& dat, const IHis *std::unique_ptr<OutputData<double>>(ref.getData().meanValues())); } +//! Returns true is relative difference is below threshold; prints informative output +bool DataUtils::Histo::checkRelativeDifference(const OutputData<double>& dat, + const OutputData<double>& ref, const double threshold) +{ + const std::unique_ptr<const IHistogram> histo(IHistogram::createHistogram(dat)); + if (histo->getMinimum() == 0 && histo->getMaximum() == 0) { + std::cerr << "FAILED: simulated data set is empty" << std::endl; + return false; + } + + const double diff = DataUtils::Data::relativeDataDifference(dat, ref); + if (diff > threshold) { + std::cerr << "FAILED: relative deviation of dat from ref is " << diff + << ", above given threshold " << threshold << std::endl; + return false; + } + if (diff) + std::cerr << "- OK: relative deviation of dat from ref is " << diff + << ", within given threshold " << threshold << std::endl; + else + std::cout << "- OK: dat = ref\n"; + return true; +} + bool DataUtils::Histo::agreesWithReference(const SimulationResult& dat, const std::string& refFileName, double tol) { @@ -88,5 +112,5 @@ bool DataUtils::Histo::agreesWithReference(const SimulationResult& dat, return false; } std::unique_ptr<OutputData<double>> datDat(dat.data()); - return DataUtils::Data::checkRelativeDifference(*datDat, *refDat, tol); + return DataUtils::Histo::checkRelativeDifference(*datDat, *refDat, tol); } diff --git a/Device/Histo/HistoUtils.h b/Device/Histo/HistoUtils.h index 4056e84565149acf1e96c0e91e033ac5da05d4a6..55353555f945d9bcec8116b89e83928828a9a8f9 100644 --- a/Device/Histo/HistoUtils.h +++ b/Device/Histo/HistoUtils.h @@ -39,6 +39,10 @@ double RelativeDifference(const SimulationResult& dat, const SimulationResult& r double getRelativeDifference(const IHistogram& dat, const IHistogram& ref); +//! Returns true is relative difference is below threshold; prints informative output +bool checkRelativeDifference(const OutputData<double>& dat, const OutputData<double>& ref, + double threshold); + //! Returns true if SimulatioResult agrees with data from reference file bool agreesWithReference(const SimulationResult& dat, const std::string& refFileName, double tol); diff --git a/GUI/View/PlotUtil/PlotEventInfo.cpp b/GUI/View/PlotUtil/PlotEventInfo.cpp index dc5fac31bb6da5dba5926a03080da0ed99f8dd6d..ba17563c23ff649b8ba3d497a9f05fbf685ca8a9 100644 --- a/GUI/View/PlotUtil/PlotEventInfo.cpp +++ b/GUI/View/PlotUtil/PlotEventInfo.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/View/PlotUtil/PlotEventInfo.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" PlotEventInfo::PlotEventInfo(PLOT_TYPE type) : m_in_axes_range(false) diff --git a/GUI/View/Projection/SaveProjectionsAssistant.cpp b/GUI/View/Projection/SaveProjectionsAssistant.cpp index a6b106eeb90495ca12f0fa884b7bf8b324406c71..ac6e03fc9e21e63eeea90394baf14ecf49b4b485 100644 --- a/GUI/View/Projection/SaveProjectionsAssistant.cpp +++ b/GUI/View/Projection/SaveProjectionsAssistant.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/View/Projection/SaveProjectionsAssistant.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Device/Histo/Histogram1D.h" #include "Device/Histo/Histogram2D.h" #include "GUI/Application/ApplicationSettings.h" diff --git a/Param/Distrib/Distributions.cpp b/Param/Distrib/Distributions.cpp index 1d974a70c1167a6c6964b87f2de912ad4f0ad3c5..72d6768836ae414c7999fb7f6a51669b0750c241 100644 --- a/Param/Distrib/Distributions.cpp +++ b/Param/Distrib/Distributions.cpp @@ -14,7 +14,7 @@ #include "Param/Distrib/Distributions.h" #include "Base/Math/Constants.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Param/Distrib/ParameterSample.h" #include <algorithm> #include <cmath> diff --git a/Resample/Processed/ParticleRegions.cpp b/Resample/Processed/ParticleRegions.cpp index d404464e1428ab841f487551a00f32b445f9fc36..2e485ee157ecea7d8d737f1870164c1111072876 100644 --- a/Resample/Processed/ParticleRegions.cpp +++ b/Resample/Processed/ParticleRegions.cpp @@ -14,7 +14,7 @@ #include "Resample/Processed/ParticleRegions.h" #include "Resample/Processed/Slicer.h" -#include "Resample/Processed/ZLimits.h" +#include "Resample/Slice/ZLimits.h" #include "Sample/Aggregate/ParticleLayout.h" #include "Sample/Multilayer/Layer.h" #include "Sample/Multilayer/MultiLayer.h" diff --git a/Resample/Processed/Slicer.cpp b/Resample/Processed/Slicer.cpp index 6d8f26abade58014a83c7df7916a9f9ed12b7832..cf0d692632f50d354ca337afa7a17921c0f868e2 100644 --- a/Resample/Processed/Slicer.cpp +++ b/Resample/Processed/Slicer.cpp @@ -22,7 +22,7 @@ #include "Resample/Particle/ReMesocrystal.h" #include "Resample/Particle/ReParticle.h" #include "Resample/Processed/ParticleInSlice.h" -#include "Resample/Processed/ZLimits.h" +#include "Resample/Slice/ZLimits.h" #include "Sample/HardParticle/HardParticles.h" #include "Sample/Material/MaterialFactoryFuncs.h" #include "Sample/Particle/Crystal.h" diff --git a/Resample/Slice/Slice.h b/Resample/Slice/Slice.h index 599b448488d3ca3601012853bc61fee917a7c230..cb55b6901b0c7529102438e3d8a77f7bb51dc8c3 100644 --- a/Resample/Slice/Slice.h +++ b/Resample/Slice/Slice.h @@ -20,7 +20,7 @@ #ifndef BORNAGAIN_RESAMPLE_SLICE_SLICE_H #define BORNAGAIN_RESAMPLE_SLICE_SLICE_H -#include "Resample/Processed/ZLimits.h" +#include "Resample/Slice/ZLimits.h" #include "Sample/Material/Material.h" #include <memory> diff --git a/Resample/Processed/ZLimits.cpp b/Resample/Slice/ZLimits.cpp similarity index 94% rename from Resample/Processed/ZLimits.cpp rename to Resample/Slice/ZLimits.cpp index fbdb74e7df62bfe17b969ff308b66a1aa4dbf4c9..eeece937dba194f673869b1e57b2756312668cd9 100644 --- a/Resample/Processed/ZLimits.cpp +++ b/Resample/Slice/ZLimits.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Resample/Processed/ZLimits.cpp +//! @file Resample/Slice/ZLimits.cpp //! @brief Defines class ZLimits. //! //! @homepage http://www.bornagainproject.org @@ -12,7 +12,7 @@ // // ************************************************************************************************ -#include "Resample/Processed/ZLimits.h" +#include "Resample/Slice/ZLimits.h" #include "Base/Util/Assert.h" #include <algorithm> #include <cmath> diff --git a/Resample/Processed/ZLimits.h b/Resample/Slice/ZLimits.h similarity index 90% rename from Resample/Processed/ZLimits.h rename to Resample/Slice/ZLimits.h index 9a7d33f2260e47298df187e90a372ffc9076d2ba..c217ba3716dfecbf04ce376a9999391bdaf791f3 100644 --- a/Resample/Processed/ZLimits.h +++ b/Resample/Slice/ZLimits.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Resample/Processed/ZLimits.h +//! @file Resample/Slice/ZLimits.h //! @brief Defines class ZLimits. //! //! @homepage http://www.bornagainproject.org @@ -17,8 +17,8 @@ #endif #ifndef USER_API -#ifndef BORNAGAIN_RESAMPLE_PROCESSED_ZLIMITS_H -#define BORNAGAIN_RESAMPLE_PROCESSED_ZLIMITS_H +#ifndef BORNAGAIN_RESAMPLE_SLICE_ZLIMITS_H +#define BORNAGAIN_RESAMPLE_SLICE_ZLIMITS_H #include <cmath> #include <iostream> @@ -58,5 +58,5 @@ bool operator!=(const ZLimits& left, const ZLimits& right); std::ostream& operator<<(std::ostream& ostr, const ZLimits& limits); -#endif // BORNAGAIN_RESAMPLE_PROCESSED_ZLIMITS_H +#endif // BORNAGAIN_RESAMPLE_SLICE_ZLIMITS_H #endif // USER_API diff --git a/Sample/Correlations/FTDecay1D.cpp b/Sample/Correlations/FTDecay1D.cpp index 3de34925d444015dc5d3240ec47bc24bd9e1b086..c61a5b7c2f0be119c5ef7ff34d2c8f26ddd34358 100644 --- a/Sample/Correlations/FTDecay1D.cpp +++ b/Sample/Correlations/FTDecay1D.cpp @@ -15,7 +15,7 @@ #include "Sample/Correlations/FTDecay1D.h" #include "Base/Math/Functions.h" #include "Base/Util/Assert.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include <algorithm> // ************************************************************************************************ diff --git a/Sample/Correlations/FTDecay2D.cpp b/Sample/Correlations/FTDecay2D.cpp index 0c176021c0b42087900a50f1e06da66b2b109e38..3c0504da85bc91375b1dea4fb39c421d3499405a 100644 --- a/Sample/Correlations/FTDecay2D.cpp +++ b/Sample/Correlations/FTDecay2D.cpp @@ -15,7 +15,7 @@ #include "Sample/Correlations/FTDecay2D.h" #include "Base/Math/Functions.h" #include "Base/Util/Assert.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include <algorithm> // ************************************************************************************************ diff --git a/Sample/Correlations/FTDistributions1D.cpp b/Sample/Correlations/FTDistributions1D.cpp index 3f59b06a91c1de08318de3fa95fb06191b63c599..3ba3987b085cb17f2366fb605cc396baa5d6ebd7 100644 --- a/Sample/Correlations/FTDistributions1D.cpp +++ b/Sample/Correlations/FTDistributions1D.cpp @@ -16,7 +16,7 @@ #include "Base/Math/Constants.h" #include "Base/Math/Functions.h" #include "Base/Util/Assert.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include <limits> namespace { diff --git a/Sample/Correlations/FTDistributions2D.cpp b/Sample/Correlations/FTDistributions2D.cpp index 97cc62128e0ef5aeae61d5fb2b8f07138b1bcb75..c66c553fbc4c52e55936375bbd4f14544f7f1cdc 100644 --- a/Sample/Correlations/FTDistributions2D.cpp +++ b/Sample/Correlations/FTDistributions2D.cpp @@ -16,7 +16,7 @@ #include "Base/Math/Bessel.h" #include "Base/Math/IntegratorGK.h" #include "Base/Util/Assert.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include <limits> // ************************************************************************************************ diff --git a/Sample/Interface/LayerRoughness.cpp b/Sample/Interface/LayerRoughness.cpp index d2fb135218435be95f9e980a7fcc75d2ea2dc660..6947a5da82dfabf0a8157ac10020f3d457b00521 100644 --- a/Sample/Interface/LayerRoughness.cpp +++ b/Sample/Interface/LayerRoughness.cpp @@ -14,7 +14,7 @@ #include "Sample/Interface/LayerRoughness.h" #include "Base/Math/Constants.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Fit/Param/RealLimits.h" //! Constructor of layer roughness. diff --git a/Sample/Particle/IBornFF.cpp b/Sample/Particle/IBornFF.cpp index 0b143527ef86c6dd920c2a0178396a9a28be8729..02164d23baea57f915e8f556421c04f7283e61ff 100644 --- a/Sample/Particle/IBornFF.cpp +++ b/Sample/Particle/IBornFF.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "Sample/Particle/IBornFF.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Base/Util/StringUtils.h" #include "Base/Vector/WavevectorInfo.h" #include "Sample/Particle/PolyhedralUtil.h" diff --git a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp index c7a3c9bdea38d4853b1f46c2b5041610688200af..6b4947ba51c1685d3eed86227d9e93d651349ae3 100644 --- a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp +++ b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "Sample/SoftParticle/FormFactorSphereLogNormalRadius.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Param/Distrib/Distributions.h" #include "Param/Distrib/ParameterSample.h" #include "Sample/LibFF/SomeFormFactors.h" diff --git a/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp b/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp index dabbe0780718a9eb4865492e74b99cace130b51b..7a17e987777733d068f261807e9b5d4c78626ec9 100644 --- a/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp +++ b/Tests/Functional/Core/Consistence/CompareTwoReferences.cpp @@ -14,7 +14,7 @@ #include "BATesting.h" #include "Base/Util/FileSystemUtils.h" -#include "Device/Data/DataUtils.h" +#include "Device/Histo/HistoUtils.h" #include "Device/Histo/IntensityDataIOFactory.h" #include <iostream> @@ -44,5 +44,5 @@ int compareTwoReferences(const std::string& name0, const std::string& name1, con std::unique_ptr<OutputData<double>> data0 = load(name0); std::unique_ptr<OutputData<double>> data1 = load(name1); - return DataUtils::Data::checkRelativeDifference(*data0, *data1, limit); + return DataUtils::Histo::checkRelativeDifference(*data0, *data1, limit); } diff --git a/Tests/Functional/Core/Std/Check.cpp b/Tests/Functional/Core/Std/Check.cpp index 69ea2c80df40b671c8668e06b7e01e9fe3c396b5..2557a6a3dcf1fb26d352523260e58b6fbd6bf4d6 100644 --- a/Tests/Functional/Core/Std/Check.cpp +++ b/Tests/Functional/Core/Std/Check.cpp @@ -16,7 +16,7 @@ #include "BATesting.h" #include "Base/Util/FileSystemUtils.h" #include "Core/Simulation/ISimulation.h" -#include "Device/Data/DataUtils.h" +#include "Device/Histo/HistoUtils.h" #include "Device/Histo/IntensityDataIOFactory.h" #include "Device/Histo/SimulationResult.h" #include <iostream> @@ -45,7 +45,7 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati // Compare with reference if available. if (reference) { std::cout << "- check diff" << std::endl; - if (DataUtils::Data::checkRelativeDifference(*result_data, *reference, limit)) { + if (DataUtils::Histo::checkRelativeDifference(*result_data, *reference, limit)) { std::cout << "- success" << std::endl; return true; // regular exit } diff --git a/Tests/Functional/GUI/Check.cpp b/Tests/Functional/GUI/Check.cpp index 5fc4cd7fa44d2594785524f78f71837ccfef5bff..39c0ccd934e402830f5867da3acdb73be8d276cc 100644 --- a/Tests/Functional/GUI/Check.cpp +++ b/Tests/Functional/GUI/Check.cpp @@ -16,7 +16,7 @@ #include "BATesting.h" #include "Base/Util/FileSystemUtils.h" #include "Core/Simulation/ISimulation.h" -#include "Device/Data/DataUtils.h" +#include "Device/Histo/HistoUtils.h" #include "Device/Histo/IntensityDataIOFactory.h" #include "Device/Histo/SimulationResult.h" #include "GUI/Model/Instrument/InstrumentItems.h" @@ -63,7 +63,7 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati const std::unique_ptr<OutputData<double>> ref_data = direct_simulation.result().data(); - bool ok = DataUtils::Data::checkRelativeDifference(*domain_data, *ref_data, limit); + bool ok = DataUtils::Histo::checkRelativeDifference(*domain_data, *ref_data, limit); if (ok) return true; diff --git a/Tests/Functional/PyEmbedded/Tests.cpp b/Tests/Functional/PyEmbedded/Tests.cpp index 415deeaf95563f5d477de625c8a78b70dc944496..8cffa32c68c3137790ca4271df8ef0085f0c314a 100644 --- a/Tests/Functional/PyEmbedded/Tests.cpp +++ b/Tests/Functional/PyEmbedded/Tests.cpp @@ -15,7 +15,7 @@ #include "BAVersion.h" #include "Base/Py/PyCore.h" #include "Base/Py/PyUtils.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Base/Util/SysUtils.h" #include "Core/Export/ExportToPython.h" #include "Sample/Multilayer/MultiLayer.h" diff --git a/Tests/Functional/PyStd/Check.cpp b/Tests/Functional/PyStd/Check.cpp index 7ea323df1d5e6d507a548c76b7360557d1fbdb73..f8b5dc1260f32c5a8f93f5da7fc15f053a5c59a5 100644 --- a/Tests/Functional/PyStd/Check.cpp +++ b/Tests/Functional/PyStd/Check.cpp @@ -17,7 +17,7 @@ #include "Base/Util/FileSystemUtils.h" #include "Core/Export/ExportToPython.h" #include "Core/Simulation/ISimulation.h" -#include "Device/Data/DataUtils.h" +#include "Device/Histo/HistoUtils.h" #include "Device/Histo/IntensityDataIOFactory.h" #include "Device/Histo/SimulationResult.h" #include <fstream> @@ -79,5 +79,5 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati const std::unique_ptr<OutputData<double>> ref_data = direct_simulation.result().data(); std::cout << "- ran simulation" << std::endl; - return DataUtils::Data::checkRelativeDifference(*domain_data, *ref_data, limit); + return DataUtils::Histo::checkRelativeDifference(*domain_data, *ref_data, limit); } diff --git a/Tests/Unit/Core/PythonFormattingTest.cpp b/Tests/Unit/Core/PythonFormattingTest.cpp index 9a2e4a87192d9290b6367d102b1d4a3f4205705d..d7dd39bc08c71b0f671425d7c6c3c466d641b178 100644 --- a/Tests/Unit/Core/PythonFormattingTest.cpp +++ b/Tests/Unit/Core/PythonFormattingTest.cpp @@ -1,5 +1,5 @@ #include "Base/Const/Units.h" -#include "Base/Util/PyFmt.h" +#include "Base/Py/PyFmt.h" #include "Core/Export/PyFmt2.h" #include "Core/Export/PyFmtLimits.h" #include "Param/Distrib/Distributions.h" diff --git a/Tests/Unit/Resample/ZLimitsTest.cpp b/Tests/Unit/Resample/ZLimitsTest.cpp index cd8590d8c250b6ad5cca1bd5c09c08191f44be5d..dde56296161822c906431a0e239b79367a4e0abc 100644 --- a/Tests/Unit/Resample/ZLimitsTest.cpp +++ b/Tests/Unit/Resample/ZLimitsTest.cpp @@ -1,4 +1,4 @@ -#include "Resample/Processed/ZLimits.h" +#include "Resample/Slice/ZLimits.h" #include "Tests/GTestWrapper/google_test.h" #include <stdexcept> diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 9af76ac097ecab2f892d1bf95ffe7cd623bef94a..5e9baf497344296b5f3a4ea9e5618f1e65d893cd 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -1571,6 +1571,12 @@ Template function to create an integrator object. // File: PyCore_8h.xml +// File: PyFmt_8cpp.xml + + +// File: PyFmt_8h.xml + + // File: PyObject_8h.xml @@ -1607,12 +1613,6 @@ This templated function is used in catalogs in form of a function pointer 'creat "; -// File: PyFmt_8cpp.xml - - -// File: PyFmt_8h.xml - - // File: StringUtils_8cpp.xml diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index b91a5c26c7cde15cbf0ac4141f642b02172b35cc..f62ff478e02757f47974feb2ad998518727d7f17 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -2789,11 +2789,6 @@ Creates 2D vector from OutputData. Returns relative difference between two data sets sum(dat[i] - ref[i])/ref[i]). "; -%feature("docstring") DataUtils::Data::checkRelativeDifference "bool DataUtils::Data::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold) - -Returns true is relative difference is below threshold; prints informative output. -"; - %feature("docstring") DataUtils::Data::coordinateToBinf "double DataUtils::Data::coordinateToBinf(double coordinate, const IAxis &axis) Transforms coordinate on axis into the bin-fraction-coordinate. @@ -2928,6 +2923,11 @@ Returns sum of relative differences between each pair of elements: (a, b) -> 2*a %feature("docstring") DataUtils::Histo::getRelativeDifference "double DataUtils::Histo::getRelativeDifference(const IHistogram &dat, const IHistogram &ref) "; +%feature("docstring") DataUtils::Histo::checkRelativeDifference "bool DataUtils::Histo::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold) + +Returns true is relative difference is below threshold; prints informative output. +"; + %feature("docstring") DataUtils::Histo::agreesWithReference "bool DataUtils::Histo::agreesWithReference(const SimulationResult &dat, const std::string &refFileName, double tol) Returns true if SimulatioResult agrees with data from reference file. diff --git a/auto/Wrap/doxygenResample.i b/auto/Wrap/doxygenResample.i index 89fd5ad1277a76e3501c11e078b89243898943bf..00c440bb7ba0350aa5f38dbc294c170162c54fac 100644 --- a/auto/Wrap/doxygenResample.i +++ b/auto/Wrap/doxygenResample.i @@ -1050,10 +1050,10 @@ C++ includes: ZLimits.h // File: namespace_0d38.xml -// File: namespace_0d42.xml +// File: namespace_0d40.xml -// File: namespace_0d44.xml +// File: namespace_0d42.xml // File: namespace_0d50.xml @@ -1283,12 +1283,6 @@ Get default z limits for generating a material profile. // File: Slicer_8h.xml -// File: ZLimits_8cpp.xml - - -// File: ZLimits_8h.xml - - // File: KzComputation_8cpp.xml @@ -1313,6 +1307,12 @@ Get default z limits for generating a material profile. // File: SliceStack_8h.xml +// File: ZLimits_8cpp.xml + + +// File: ZLimits_8h.xml + + // File: ComputeFluxMagnetic_8cpp.xml diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index 1cbd2b213ad0ddd7d16e67c506b5b6780586cac1..bb7a451e2e9b70db8ad61f47074569f084e203d5 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -2865,16 +2865,6 @@ def relativeDataDifference(dat, ref): """ return _libBornAgainDevice.relativeDataDifference(dat, ref) -def checkRelativeDifference(dat, ref, threshold): - r""" - checkRelativeDifference(IntensityData dat, IntensityData ref, double threshold) -> bool - bool DataUtils::Data::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold) - - Returns true is relative difference is below threshold; prints informative output. - - """ - return _libBornAgainDevice.checkRelativeDifference(dat, ref, threshold) - def coordinateToBinf(*args): r""" coordinateToBinf(double coordinate, IAxis axis) -> double @@ -4945,6 +4935,16 @@ def getRelativeDifference(dat, ref): """ return _libBornAgainDevice.getRelativeDifference(dat, ref) +def checkRelativeDifference(dat, ref, threshold): + r""" + checkRelativeDifference(IntensityData dat, IntensityData ref, double threshold) -> bool + bool DataUtils::Histo::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold) + + Returns true is relative difference is below threshold; prints informative output. + + """ + return _libBornAgainDevice.checkRelativeDifference(dat, ref, threshold) + def agreesWithReference(dat, refFileName, tol): r""" agreesWithReference(SimulationResult dat, std::string const & refFileName, double tol) -> bool diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index a65732d3e08f3e7859c8b1b4755cf57f26c5cf72..104df8f773c72eb58b8ad935955d1cc2b4aa19ea 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -33177,50 +33177,6 @@ fail: } -SWIGINTERN PyObject *_wrap_checkRelativeDifference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - OutputData< double > *arg1 = 0 ; - OutputData< double > *arg2 = 0 ; - double arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "checkRelativeDifference", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "checkRelativeDifference" "', argument " "1"" of type '" "OutputData< double > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "checkRelativeDifference" "', argument " "1"" of type '" "OutputData< double > const &""'"); - } - arg1 = reinterpret_cast< OutputData< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "checkRelativeDifference" "', argument " "2"" of type '" "OutputData< double > const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "checkRelativeDifference" "', argument " "2"" of type '" "OutputData< double > const &""'"); - } - arg2 = reinterpret_cast< OutputData< double > * >(argp2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "checkRelativeDifference" "', argument " "3"" of type '" "double""'"); - } - arg3 = static_cast< double >(val3); - result = (bool)DataUtils::Data::checkRelativeDifference((OutputData< double > const &)*arg1,(OutputData< double > const &)*arg2,arg3); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_coordinateToBinf__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; double arg1 ; @@ -41667,6 +41623,50 @@ fail: } +SWIGINTERN PyObject *_wrap_checkRelativeDifference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + OutputData< double > *arg1 = 0 ; + OutputData< double > *arg2 = 0 ; + double arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + double val3 ; + int ecode3 = 0 ; + PyObject *swig_obj[3] ; + bool result; + + if (!SWIG_Python_UnpackTuple(args, "checkRelativeDifference", 3, 3, swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "checkRelativeDifference" "', argument " "1"" of type '" "OutputData< double > const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "checkRelativeDifference" "', argument " "1"" of type '" "OutputData< double > const &""'"); + } + arg1 = reinterpret_cast< OutputData< double > * >(argp1); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_OutputDataT_double_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "checkRelativeDifference" "', argument " "2"" of type '" "OutputData< double > const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "checkRelativeDifference" "', argument " "2"" of type '" "OutputData< double > const &""'"); + } + arg2 = reinterpret_cast< OutputData< double > * >(argp2); + ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "checkRelativeDifference" "', argument " "3"" of type '" "double""'"); + } + arg3 = static_cast< double >(val3); + result = (bool)DataUtils::Histo::checkRelativeDifference((OutputData< double > const &)*arg1,(OutputData< double > const &)*arg2,arg3); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_agreesWithReference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; SimulationResult *arg1 = 0 ; @@ -47740,13 +47740,6 @@ static PyMethodDef SwigMethods[] = { "Returns relative difference between two data sets sum(dat[i] - ref[i])/ref[i]). \n" "\n" ""}, - { "checkRelativeDifference", _wrap_checkRelativeDifference, METH_VARARGS, "\n" - "checkRelativeDifference(IntensityData dat, IntensityData ref, double threshold) -> bool\n" - "bool DataUtils::Data::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold)\n" - "\n" - "Returns true is relative difference is below threshold; prints informative output. \n" - "\n" - ""}, { "coordinateToBinf", _wrap_coordinateToBinf, METH_VARARGS, "\n" "coordinateToBinf(double coordinate, IAxis axis) -> double\n" "coordinateToBinf(double & x, double & y, IntensityData data)\n" @@ -48964,6 +48957,13 @@ static PyMethodDef SwigMethods[] = { "double DataUtils::Histo::getRelativeDifference(const IHistogram &dat, const IHistogram &ref)\n" "\n" ""}, + { "checkRelativeDifference", _wrap_checkRelativeDifference, METH_VARARGS, "\n" + "checkRelativeDifference(IntensityData dat, IntensityData ref, double threshold) -> bool\n" + "bool DataUtils::Histo::checkRelativeDifference(const OutputData< double > &dat, const OutputData< double > &ref, double threshold)\n" + "\n" + "Returns true is relative difference is below threshold; prints informative output. \n" + "\n" + ""}, { "agreesWithReference", _wrap_agreesWithReference, METH_VARARGS, "\n" "agreesWithReference(SimulationResult dat, std::string const & refFileName, double tol) -> bool\n" "bool DataUtils::Histo::agreesWithReference(const SimulationResult &dat, const std::string &refFileName, double tol)\n"