diff --git a/App/src/TestFittingModule2.cpp b/App/src/TestFittingModule2.cpp index 50d08c800d4f3b48676a1d6e65daf499efe59545..93d59eb2865e19322dc8304347b2c70e50b0abb5 100644 --- a/App/src/TestFittingModule2.cpp +++ b/App/src/TestFittingModule2.cpp @@ -141,7 +141,7 @@ void TestFittingModule2::fit_example_chimodule() // setting up fitSuite ChiSquaredModule chiModule; - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError() ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError() ); chiModule.setOutputDataNormalizer( OutputDataSimpleNormalizer() ); m_fitSuite->addSimulationAndRealData( *mp_simulation, *mp_real_data, chiModule); diff --git a/App/src/TestFumiliLMA.cpp b/App/src/TestFumiliLMA.cpp index 7876c60839ab4f449f12bb1d3330b74356bcd828..fe3fc706776459db2aef10839c50515d31bdb1c4 100644 --- a/App/src/TestFumiliLMA.cpp +++ b/App/src/TestFumiliLMA.cpp @@ -57,7 +57,7 @@ TestFumiliLMA::TestFumiliLMA() // chi module m_chi_module = new ChiSquaredModule(); - m_chi_module->setChiSquaredFunction(SquaredFunctionWithGaussianError(m_sigma) ); + m_chi_module->setChiSquaredFunction(SquaredFunctionGaussianError(m_sigma) ); // "real" data OutputData<double> data; diff --git a/App/src/TestIsGISAXS12.cpp b/App/src/TestIsGISAXS12.cpp index f3a6bddd4de414a8a994396dc8c4dbd57e0cc1ef..47c5ce775cf49dab751bdccdb1753870c8f93c2a 100644 --- a/App/src/TestIsGISAXS12.cpp +++ b/App/src/TestIsGISAXS12.cpp @@ -235,7 +235,7 @@ void TestIsGISAXS12::run_isgisaxs_fit() // setting up fitSuite ChiSquaredModule chiModule; - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError(0.08) ); chiModule.setOutputDataNormalizer( OutputDataNormalizer() ); for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin(); it!= isgi_scans.end(); ++it) { @@ -309,7 +309,7 @@ void TestIsGISAXS12::run_test_chimodule() // setting up fitSuite ChiSquaredModule chiModule; - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError(0.08) ); OutputDataNormalizer normalizer(1.31159E+05, -8.10009E-02); @@ -371,7 +371,7 @@ void TestIsGISAXS12::run_test_minimizer() // setting up fitSuite ChiSquaredModule chiModule; - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError(0.08) ); chiModule.setOutputDataNormalizer( OutputDataNormalizer() ); for(IsGISAXSData::DataSet_t::iterator it=isgi_scans_smoothed.begin(); it!= isgi_scans_smoothed.end(); ++it) { m_fitSuite->addSimulationAndRealData(*m_simulation, *(*it), chiModule); diff --git a/App/src/TestIsGISAXS13.cpp b/App/src/TestIsGISAXS13.cpp index 303ffc9a0fd3b56309cc6debf30aaaa3957d3ed5..28e5004c1a5bcc21a0dae5dc6cfdf8e70325f784 100644 --- a/App/src/TestIsGISAXS13.cpp +++ b/App/src/TestIsGISAXS13.cpp @@ -123,7 +123,7 @@ void TestIsGISAXS13::run_isgisaxs_fit() // chi squared module ChiSquaredModule chiModule; - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError(0.08) ); chiModule.setOutputDataNormalizer( OutputDataNormalizer() ); //chiModule.setIntensityFunction( IntensityFunctionLog() ); for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin(); diff --git a/App/src/TestMesoCrystal2.cpp b/App/src/TestMesoCrystal2.cpp index d1d502b37841f83cf597fbfb10de033a20fa0c35..142f1ea422dd56336fb6fee680b8d2a779675002 100644 --- a/App/src/TestMesoCrystal2.cpp +++ b/App/src/TestMesoCrystal2.cpp @@ -24,6 +24,7 @@ #include "Simulation.h" #include "IInterferenceFunction.h" #include "InterferenceFunctionNone.h" +#include "IntensityDataHelper.h" #include "IsGISAXSTools.h" #include "LatticeBasis.h" #include "MaterialManager.h" @@ -70,8 +71,8 @@ TestMesoCrystal2::~TestMesoCrystal2() void TestMesoCrystal2::execute() { - //run_fit(); - draw_results(); + run_fit(); + //draw_results(); } @@ -199,7 +200,8 @@ void TestMesoCrystal2::initializeRealData() delete m_real_data; //std::string file_name = Utils::FileSystem::GetHomePath()+"Examples/MesoCrystals/ex02_fitspheres/004_230_P144_im_full_qyqz.txt.gz"; //std::string file_name = Utils::FileSystem::GetHomePath()+"Examples/MesoCrystals/ex02_fitspheres/004_230_P144_im_full_phitheta.txt.gz"; - std::string file_name = "dev-tools/tmp-examples/MesoCrystals/ex02_fitspheres/004_230_P144_im_full_phitheta.txt.gz"; + //std::string file_name = "dev-tools/tmp-examples/MesoCrystals/ex02_fitspheres/004_230_P144_im_full_phitheta.txt.gz"; + std::string file_name = "../support/input/001_ElisabethJosten/2013.01.03/004_230_P144_im_full_phitheta.txt.gz"; m_real_data = OutputDataIOFactory::readIntensityData(file_name); @@ -290,13 +292,14 @@ void TestMesoCrystal2::fitsuite_config4() } // Mask *mask1 = OutputDataFunctions::CreateRectangularMask(*m_real_data, 0.041, 0.003, 0.051, 0.03); - Mask *mask1 = OutputDataFunctions::CreateRectangularMask(*m_real_data, 0.025, 0.003, 0.051, 0.0375); - m_real_data->setMask(*mask1); +// Mask *mask1 = OutputDataFunctions::CreateRectangularMask(*m_real_data, 0.025, 0.003, 0.051, 0.0375); +// m_real_data->setMask(*mask1); +// IntensityDataHelper::setRectangularMask(*m_real_data, 0.025, 0.003, 0.051, 0.0375); ChiSquaredModule chiModule; // chiModule.setChiSquaredFunction( SquaredFunctionDefault() ); //chiModule.setChiSquaredFunction( SquaredFunctionWhichOnlyWorks() ); // it works only with resolution function, without it fit doesn't converge - chiModule.setChiSquaredFunction( SquaredFunctionWhichOnlyWorks() ); + chiModule.setChiSquaredFunction( SquaredFunctionMeanSquaredError() ); //chiModule.setOutputDataNormalizer( OutputDataSimpleNormalizer(1.0,0) ); m_fitSuite->addSimulationAndRealData(*m_simulation, *m_real_data, chiModule); @@ -366,7 +369,7 @@ void TestMesoCrystal2::fitsuite_config3() ChiSquaredModule chiModule; // chiModule.setChiSquaredFunction( SquaredFunctionDefault() ); //chiModule.setChiSquaredFunction( SquaredFunctionWhichOnlyWorks() ); // it works only with resolution function, without it fit doesn't converge - chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError() ); + chiModule.setChiSquaredFunction( SquaredFunctionSystematicError() ); //chiModule.setOutputDataNormalizer( OutputDataSimpleNormalizer(1.0,0) ); m_fitSuite->addSimulationAndRealData(*m_simulation, *m_real_data, chiModule); diff --git a/App/src/TestToySimulation.cpp b/App/src/TestToySimulation.cpp index a7cf63cbe8cbca94e6cadcd23084be1fc94ffa93..19368ea3f43f4623efc896fd293d148d760dbf46 100644 --- a/App/src/TestToySimulation.cpp +++ b/App/src/TestToySimulation.cpp @@ -114,7 +114,7 @@ void TestToySimulation::execute() m_fitSuite->addFitParameter("*/par2", 0.0, 0.01, AttLimits::lowerLimited(0.0)); ChiSquaredModule chi_module; - chi_module.setChiSquaredFunction(SquaredFunctionWithGaussianError(m_sigma_noise) ); + chi_module.setChiSquaredFunction(SquaredFunctionGaussianError(m_sigma_noise) ); m_fitSuite->addSimulationAndRealData(*m_simulation, *m_real_data, chi_module); m_fitSuite->runFit(); } diff --git a/Core/Algorithms/inc/ISquaredFunction.h b/Core/Algorithms/inc/ISquaredFunction.h index df3ddcfbc2c07e211ef44ea91e5d2d2d76fec99d..8969ec38661b440e33e0254e8eb85d4efe1eca83 100644 --- a/Core/Algorithms/inc/ISquaredFunction.h +++ b/Core/Algorithms/inc/ISquaredFunction.h @@ -23,7 +23,7 @@ //! @class ISquaredFunction -//! @ingroup algorithms_internal +//! @ingroup fitting_internal //! @brief Interface providing measures for deviation between two values. //! //! Used By ChiSquaredModule for chi2 calculations @@ -48,8 +48,11 @@ public: //! @class SquaredFunctionDefault -//! @ingroup algorithms_internal -//! @brief Squared difference betwee two values +//! @ingroup fitting +//! @brief Squared difference between two values. +//! +//! value = (a-b)*(a-b)/norm, where +//! norm = max(b, 1.0) class BA_CORE_API_ SquaredFunctionDefault : public ISquaredFunction { @@ -76,16 +79,19 @@ public: }; -//! @class SquaredFunctionWhichOnlyWorks -//! @ingroup algorithms_internal -//! @brief Squared difference betwee two values +//! @class SquaredFunctionMeanSquaredError +//! @ingroup fitting +//! @brief Squared difference between two values normalized by mean squared error +//! +//! value = (a-b)*(a-b)/norm, where +//! norm = sqrt(sigma1*sigma1 + sigma2*sigma2), sigma1=max(a, 1.0), sigma2=max(b,1.0) -class BA_CORE_API_ SquaredFunctionWhichOnlyWorks : public ISquaredFunction +class BA_CORE_API_ SquaredFunctionMeanSquaredError : public ISquaredFunction { public: - SquaredFunctionWhichOnlyWorks() {} - virtual ~SquaredFunctionWhichOnlyWorks() {} - virtual SquaredFunctionWhichOnlyWorks *clone() const { return new SquaredFunctionWhichOnlyWorks(*this); } + SquaredFunctionMeanSquaredError() {} + virtual ~SquaredFunctionMeanSquaredError() {} + virtual SquaredFunctionMeanSquaredError *clone() const { return new SquaredFunctionMeanSquaredError(*this); } virtual double calculateSquaredDifference(double real_value, double simulated_value) const { @@ -102,16 +108,19 @@ public: }; -//! @class SquaredFunctionWithSystematicError -//! @ingroup algorithms_internal -//! @brief Squared difference between two values with systematic error +//! @class SquaredFunctionSystematicError +//! @ingroup fitting +//! @brief Squared difference between two values normalized by systematic error +//! +//! value = (a-b)*(a-b)/norm, where +//! norm = max(error, 1.0), error = b + (epsilon*b)**2 -class BA_CORE_API_ SquaredFunctionWithSystematicError : public ISquaredFunction +class BA_CORE_API_ SquaredFunctionSystematicError : public ISquaredFunction { public: - SquaredFunctionWithSystematicError(double epsilon = 0.08) : m_epsilon(epsilon){} - virtual ~SquaredFunctionWithSystematicError() {} - virtual SquaredFunctionWithSystematicError *clone() const { return new SquaredFunctionWithSystematicError(*this); } + SquaredFunctionSystematicError(double epsilon = 0.08) : m_epsilon(epsilon){} + virtual ~SquaredFunctionSystematicError() {} + virtual SquaredFunctionSystematicError *clone() const { return new SquaredFunctionSystematicError(*this); } virtual double calculateSquaredDifference(double real_value, double simulated_value) const { @@ -129,16 +138,19 @@ private: }; -//! @class SquaredFunctionWithGaussianError -//! @ingroup algorithms_internal +//! @class SquaredFunctionGaussianError +//! @ingroup fitting //! @brief Squared difference between two values with gaussian error +//! +//! value = (a-b)*(a-b)/norm, where +//! norm = sigma*sigma, sigma - is set by user -class BA_CORE_API_ SquaredFunctionWithGaussianError : public ISquaredFunction +class BA_CORE_API_ SquaredFunctionGaussianError : public ISquaredFunction { public: - SquaredFunctionWithGaussianError(double sigma = 0.01) : m_sigma(sigma){} - virtual ~SquaredFunctionWithGaussianError() {} - virtual SquaredFunctionWithGaussianError *clone() const { return new SquaredFunctionWithGaussianError(*this); } + SquaredFunctionGaussianError(double sigma = 0.01) : m_sigma(sigma){} + virtual ~SquaredFunctionGaussianError() {} + virtual SquaredFunctionGaussianError *clone() const { return new SquaredFunctionGaussianError(*this); } virtual double calculateSquaredDifference(double real_value, double simulated_value) const { diff --git a/Core/PythonAPI/inc/IntensityDataHelper.pypp.h b/Core/PythonAPI/inc/IntensityDataHelper.pypp.h new file mode 100644 index 0000000000000000000000000000000000000000..9348fb1e88c24e611a0f3ec37003e0d0f751f86e --- /dev/null +++ b/Core/PythonAPI/inc/IntensityDataHelper.pypp.h @@ -0,0 +1,11 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#ifndef IntensityDataHelper_hpp__pyplusplus_wrapper +#define IntensityDataHelper_hpp__pyplusplus_wrapper + +void register_IntensityDataHelper_class(); + +#endif//IntensityDataHelper_hpp__pyplusplus_wrapper diff --git a/Core/PythonAPI/inc/PythonCoreList.h b/Core/PythonAPI/inc/PythonCoreList.h index 93db42eb6aab19e34c3d393b2e11bbf4ec149587..d93d3462a6c63e26c133fff59e81de0906cba2e7 100644 --- a/Core/PythonAPI/inc/PythonCoreList.h +++ b/Core/PythonAPI/inc/PythonCoreList.h @@ -45,6 +45,7 @@ #include "IFormFactorBorn.h" #include "IFormFactorDecorator.h" #include "IInterferenceFunction.h" +#include "IntensityDataHelper.h" #include "IMaterial.h" #include "IObserver.h" #include "IParameterized.h" diff --git a/Core/PythonAPI/src/IntensityDataHelper.pypp.cpp b/Core/PythonAPI/src/IntensityDataHelper.pypp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0d94a566f632f6e5aa54d4ba758643df1f7df1b9 --- /dev/null +++ b/Core/PythonAPI/src/IntensityDataHelper.pypp.cpp @@ -0,0 +1,47 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#include "Macros.h" +GCC_DIAG_OFF(unused-parameter); +GCC_DIAG_OFF(missing-field-initializers); +#include "boost/python.hpp" +GCC_DIAG_ON(unused-parameter); +GCC_DIAG_ON(missing-field-initializers); +#include "PythonCoreList.h" +#include "IntensityDataHelper.pypp.h" + +namespace bp = boost::python; + +void register_IntensityDataHelper_class(){ + + { //::IntensityDataHelper + typedef bp::class_< IntensityDataHelper > IntensityDataHelper_exposer_t; + IntensityDataHelper_exposer_t IntensityDataHelper_exposer = IntensityDataHelper_exposer_t( "IntensityDataHelper" ); + bp::scope IntensityDataHelper_scope( IntensityDataHelper_exposer ); + { //::IntensityDataHelper::setEllipticMask + + typedef void ( *setEllipticMask_function_type )( ::OutputData< double > &,double,double,double,double ); + + IntensityDataHelper_exposer.def( + "setEllipticMask" + , setEllipticMask_function_type( &::IntensityDataHelper::setEllipticMask ) + , ( bp::arg("data"), bp::arg("xc"), bp::arg("yc"), bp::arg("rx"), bp::arg("ry") ) ); + + } + { //::IntensityDataHelper::setRectangularMask + + typedef void ( *setRectangularMask_function_type )( ::OutputData< double > &,double,double,double,double ); + + IntensityDataHelper_exposer.def( + "setRectangularMask" + , setRectangularMask_function_type( &::IntensityDataHelper::setRectangularMask ) + , ( bp::arg("data"), bp::arg("x1"), bp::arg("y1"), bp::arg("x2"), bp::arg("y2") ) ); + + } + IntensityDataHelper_exposer.staticmethod( "setEllipticMask" ); + IntensityDataHelper_exposer.staticmethod( "setRectangularMask" ); + } + +} diff --git a/Core/PythonAPI/src/PythonModule.cpp b/Core/PythonAPI/src/PythonModule.cpp index dee9ac4ce8aa20ccea1f5b09f0ff55d3ed0f5b26..e40e2599bd06ee0d28131b792dc00d6993e646f3 100644 --- a/Core/PythonAPI/src/PythonModule.cpp +++ b/Core/PythonAPI/src/PythonModule.cpp @@ -5,6 +5,7 @@ // the order of 3 guys above is important #include "IFTDistribution2D.pypp.h" +#include "IntensityDataHelper.pypp.h" #include "Detector.pypp.h" #include "FormFactorRipple2.pypp.h" #include "LatticeBasis.pypp.h" @@ -169,6 +170,7 @@ BOOST_PYTHON_MODULE(libBornAgainCore){ register_ISampleBuilder_class(); register_ISelectionRule_class(); register_Instrument_class(); + register_IntensityDataHelper_class(); register_InterferenceFunction1DParaCrystal_class(); register_InterferenceFunction2DLattice_class(); register_InterferenceFunction2DParaCrystal_class(); diff --git a/Core/Tools/inc/IntensityDataHelper.h b/Core/Tools/inc/IntensityDataHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..b61666ba06d2e5f813030f228f7563c7db171870 --- /dev/null +++ b/Core/Tools/inc/IntensityDataHelper.h @@ -0,0 +1,44 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file Tools/inc/IntensityDataHelper.h +//! @brief Defines class IntensityDataHelper. +//! +//! @homepage http://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 INTENSITYDATAHELPER_H +#define INTENSITYDATAHELPER_H + + +#include "OutputData.h" + +//! @class IntensityDataHelper +//! @ingroup tools +//! @brief Class holding collection of static methods to work with intensity data. + +class BA_CORE_API_ IntensityDataHelper +{ +public: + + //! Sets rectangular mask to IntensityData to exclude all points outside the + //! mask from analysis + BA_CORE_API_ static void setRectangularMask(OutputData<double>& data, + double x1, double y1, double x2, double y2); + + + //! Sets elliptic mask to IntensityData to exclude all points outside the + //! mask from analysis + BA_CORE_API_ static void setEllipticMask(OutputData<double>& data, + double xc, double yc, double rx, double ry); + +}; + + +#endif // INTENSITYDATAHELPER_H diff --git a/Core/Tools/src/IntensityDataHelper.cpp b/Core/Tools/src/IntensityDataHelper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc5f5dd3176cd8a9364ab01710c5257384661218 --- /dev/null +++ b/Core/Tools/src/IntensityDataHelper.cpp @@ -0,0 +1,19 @@ +#include "IntensityDataHelper.h" +#include "OutputDataFunctions.h" + + +void IntensityDataHelper::setRectangularMask(OutputData<double>& data, + double x1, double y1, double x2, double y2) +{ + Mask *mask1 = OutputDataFunctions::CreateRectangularMask(data, x1, y1, x2, y2); + data.setMask(*mask1); +} + + +void IntensityDataHelper::setEllipticMask(OutputData<double>& data, + double xc, double yc, double rx, double ry) +{ + Mask *mask1 = OutputDataFunctions::CreateEllipticMask(data, xc, yc, rx, ry); + data.setMask(*mask1); +} + diff --git a/Fit/FitKernel/src/FitSuite.cpp b/Fit/FitKernel/src/FitSuite.cpp index cee0ee4bbd0ae115e05bebec4b0d57fec09ddc95..208d87cd34dfe392b78a39edb53634dc4b80e1cb 100644 --- a/Fit/FitKernel/src/FitSuite.cpp +++ b/Fit/FitKernel/src/FitSuite.cpp @@ -134,7 +134,7 @@ void FitSuite::minimize() // minimizing m_minimizer->minimize(); - } +} // get current number of minimization function calls diff --git a/Fit/PythonAPI/inc/SquaredFunctionGaussianError.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionGaussianError.pypp.h new file mode 100644 index 0000000000000000000000000000000000000000..0ddfde95803efc3e3e668330f43ae3c21432ba51 --- /dev/null +++ b/Fit/PythonAPI/inc/SquaredFunctionGaussianError.pypp.h @@ -0,0 +1,11 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#ifndef SquaredFunctionGaussianError_hpp__pyplusplus_wrapper +#define SquaredFunctionGaussianError_hpp__pyplusplus_wrapper + +void register_SquaredFunctionGaussianError_class(); + +#endif//SquaredFunctionGaussianError_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/inc/SquaredFunctionMeanSquaredError.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionMeanSquaredError.pypp.h new file mode 100644 index 0000000000000000000000000000000000000000..038e8a082635d1453f87797fcab0d502315ff0fa --- /dev/null +++ b/Fit/PythonAPI/inc/SquaredFunctionMeanSquaredError.pypp.h @@ -0,0 +1,11 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#ifndef SquaredFunctionMeanSquaredError_hpp__pyplusplus_wrapper +#define SquaredFunctionMeanSquaredError_hpp__pyplusplus_wrapper + +void register_SquaredFunctionMeanSquaredError_class(); + +#endif//SquaredFunctionMeanSquaredError_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/inc/SquaredFunctionSystematicError.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionSystematicError.pypp.h new file mode 100644 index 0000000000000000000000000000000000000000..e3c849f9b7f40ca9aacd86efd4cc66e3b3614dd7 --- /dev/null +++ b/Fit/PythonAPI/inc/SquaredFunctionSystematicError.pypp.h @@ -0,0 +1,11 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#ifndef SquaredFunctionSystematicError_hpp__pyplusplus_wrapper +#define SquaredFunctionSystematicError_hpp__pyplusplus_wrapper + +void register_SquaredFunctionSystematicError_class(); + +#endif//SquaredFunctionSystematicError_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/inc/SquaredFunctionWhichOnlyWorks.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionWhichOnlyWorks.pypp.h deleted file mode 100644 index 2e6a5f25538b4a78c072c88a5a721990c2c9167a..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/inc/SquaredFunctionWhichOnlyWorks.pypp.h +++ /dev/null @@ -1,11 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#ifndef SquaredFunctionWhichOnlyWorks_hpp__pyplusplus_wrapper -#define SquaredFunctionWhichOnlyWorks_hpp__pyplusplus_wrapper - -void register_SquaredFunctionWhichOnlyWorks_class(); - -#endif//SquaredFunctionWhichOnlyWorks_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/inc/SquaredFunctionWithGaussianError.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionWithGaussianError.pypp.h deleted file mode 100644 index b9a043bb2dccc9d0b2bf0fc248841cf76ba30845..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/inc/SquaredFunctionWithGaussianError.pypp.h +++ /dev/null @@ -1,11 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#ifndef SquaredFunctionWithGaussianError_hpp__pyplusplus_wrapper -#define SquaredFunctionWithGaussianError_hpp__pyplusplus_wrapper - -void register_SquaredFunctionWithGaussianError_class(); - -#endif//SquaredFunctionWithGaussianError_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/inc/SquaredFunctionWithSystematicError.pypp.h b/Fit/PythonAPI/inc/SquaredFunctionWithSystematicError.pypp.h deleted file mode 100644 index ba6d9cb2d9d331d4723ab673840ac8ba8212b009..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/inc/SquaredFunctionWithSystematicError.pypp.h +++ /dev/null @@ -1,11 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#ifndef SquaredFunctionWithSystematicError_hpp__pyplusplus_wrapper -#define SquaredFunctionWithSystematicError_hpp__pyplusplus_wrapper - -void register_SquaredFunctionWithSystematicError_class(); - -#endif//SquaredFunctionWithSystematicError_hpp__pyplusplus_wrapper diff --git a/Fit/PythonAPI/src/PythonModule.cpp b/Fit/PythonAPI/src/PythonModule.cpp index 52a616d52fb25673f53b35e4764df957007fc2b3..7eae66dcafd4e7d2b89fb755f6de1d4790ca6055 100644 --- a/Fit/PythonAPI/src/PythonModule.cpp +++ b/Fit/PythonAPI/src/PythonModule.cpp @@ -6,17 +6,15 @@ GCC_DIAG_OFF(missing-field-initializers); GCC_DIAG_ON(unused-parameter); GCC_DIAG_ON(missing-field-initializers); -#include "SquaredFunctionWithGaussianError.pypp.h" #include "OutputDataSimpleNormalizer.pypp.h" #include "AttFitting.pypp.h" #include "FitSuiteObjects.pypp.h" #include "ISquaredFunction.pypp.h" #include "MinimizerFactory.pypp.h" +#include "SquaredFunctionMeanSquaredError.pypp.h" #include "OutputDataNormalizer.pypp.h" #include "MinimizerOptions.pypp.h" -#include "SquaredFunctionWithSystematicError.pypp.h" #include "IOutputDataNormalizer.pypp.h" -#include "SquaredFunctionWhichOnlyWorks.pypp.h" #include "FitParameter.pypp.h" #include "FitObject.pypp.h" #include "IMinimizer.pypp.h" @@ -27,6 +25,8 @@ GCC_DIAG_ON(missing-field-initializers); #include "AttLimits.pypp.h" #include "IChiSquaredModule.pypp.h" #include "FitSuiteParameters.pypp.h" +#include "SquaredFunctionSystematicError.pypp.h" +#include "SquaredFunctionGaussianError.pypp.h" BOOST_PYTHON_MODULE(libBornAgainFit){ @@ -50,7 +50,7 @@ BOOST_PYTHON_MODULE(libBornAgainFit){ register_OutputDataNormalizer_class(); register_OutputDataSimpleNormalizer_class(); register_SquaredFunctionDefault_class(); - register_SquaredFunctionWhichOnlyWorks_class(); - register_SquaredFunctionWithGaussianError_class(); - register_SquaredFunctionWithSystematicError_class(); + register_SquaredFunctionGaussianError_class(); + register_SquaredFunctionMeanSquaredError_class(); + register_SquaredFunctionSystematicError_class(); } diff --git a/Fit/PythonAPI/src/SquaredFunctionGaussianError.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionGaussianError.pypp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..35ffa1942c4cf3afdda57c4e380e82b111d1a58f --- /dev/null +++ b/Fit/PythonAPI/src/SquaredFunctionGaussianError.pypp.cpp @@ -0,0 +1,115 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#include "Macros.h" +GCC_DIAG_OFF(unused-parameter); +GCC_DIAG_OFF(missing-field-initializers); +#include "boost/python.hpp" +GCC_DIAG_ON(unused-parameter); +GCC_DIAG_ON(missing-field-initializers); +#include "PythonFitList.h" +#include "SquaredFunctionGaussianError.pypp.h" + +namespace bp = boost::python; + +struct SquaredFunctionGaussianError_wrapper : SquaredFunctionGaussianError, bp::wrapper< SquaredFunctionGaussianError > { + + SquaredFunctionGaussianError_wrapper(SquaredFunctionGaussianError const & arg ) + : SquaredFunctionGaussianError( arg ) + , bp::wrapper< SquaredFunctionGaussianError >(){ + // copy constructor + + } + + SquaredFunctionGaussianError_wrapper(double sigma=1.00000000000000002081668171172168513294309377670288085938e-2 ) + : SquaredFunctionGaussianError( sigma ) + , bp::wrapper< SquaredFunctionGaussianError >(){ + // constructor + + } + + virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { + if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) + return func_calculateSquaredDifference( real_value, simulated_value ); + else + return this->SquaredFunctionGaussianError::calculateSquaredDifference( real_value, simulated_value ); + } + + + double default_calculateSquaredDifference( double real_value, double simulated_value ) const { + return SquaredFunctionGaussianError::calculateSquaredDifference( real_value, simulated_value ); + } + + virtual double calculateSquaredError( double arg0, double arg1 ) const { + if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) + return func_calculateSquaredError( arg0, arg1 ); + else + return this->SquaredFunctionGaussianError::calculateSquaredError( arg0, arg1 ); + } + + + double default_calculateSquaredError( double arg0, double arg1 ) const { + return SquaredFunctionGaussianError::calculateSquaredError( arg0, arg1 ); + } + + virtual ::SquaredFunctionGaussianError * clone( ) const { + if( bp::override func_clone = this->get_override( "clone" ) ) + return func_clone( ); + else + return this->SquaredFunctionGaussianError::clone( ); + } + + + ::SquaredFunctionGaussianError * default_clone( ) const { + return SquaredFunctionGaussianError::clone( ); + } + +}; + +void register_SquaredFunctionGaussianError_class(){ + + { //::SquaredFunctionGaussianError + typedef bp::class_< SquaredFunctionGaussianError_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionGaussianError_exposer_t; + SquaredFunctionGaussianError_exposer_t SquaredFunctionGaussianError_exposer = SquaredFunctionGaussianError_exposer_t( "SquaredFunctionGaussianError", bp::init< bp::optional< double > >(( bp::arg("sigma")=1.00000000000000002081668171172168513294309377670288085938e-2 )) ); + bp::scope SquaredFunctionGaussianError_scope( SquaredFunctionGaussianError_exposer ); + { //::SquaredFunctionGaussianError::calculateSquaredDifference + + typedef double ( ::SquaredFunctionGaussianError::*calculateSquaredDifference_function_type )( double,double ) const; + typedef double ( SquaredFunctionGaussianError_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; + + SquaredFunctionGaussianError_exposer.def( + "calculateSquaredDifference" + , calculateSquaredDifference_function_type(&::SquaredFunctionGaussianError::calculateSquaredDifference) + , default_calculateSquaredDifference_function_type(&SquaredFunctionGaussianError_wrapper::default_calculateSquaredDifference) + , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); + + } + { //::SquaredFunctionGaussianError::calculateSquaredError + + typedef double ( ::SquaredFunctionGaussianError::*calculateSquaredError_function_type )( double,double ) const; + typedef double ( SquaredFunctionGaussianError_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; + + SquaredFunctionGaussianError_exposer.def( + "calculateSquaredError" + , calculateSquaredError_function_type(&::SquaredFunctionGaussianError::calculateSquaredError) + , default_calculateSquaredError_function_type(&SquaredFunctionGaussianError_wrapper::default_calculateSquaredError) + , ( bp::arg("arg0"), bp::arg("arg1") ) ); + + } + { //::SquaredFunctionGaussianError::clone + + typedef ::SquaredFunctionGaussianError * ( ::SquaredFunctionGaussianError::*clone_function_type )( ) const; + typedef ::SquaredFunctionGaussianError * ( SquaredFunctionGaussianError_wrapper::*default_clone_function_type )( ) const; + + SquaredFunctionGaussianError_exposer.def( + "clone" + , clone_function_type(&::SquaredFunctionGaussianError::clone) + , default_clone_function_type(&SquaredFunctionGaussianError_wrapper::default_clone) + , bp::return_value_policy< bp::manage_new_object >() ); + + } + } + +} diff --git a/Fit/PythonAPI/src/SquaredFunctionMeanSquaredError.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionMeanSquaredError.pypp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..075705d2b2e4d0c3b26544f44f8d88e46a602afa --- /dev/null +++ b/Fit/PythonAPI/src/SquaredFunctionMeanSquaredError.pypp.cpp @@ -0,0 +1,115 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#include "Macros.h" +GCC_DIAG_OFF(unused-parameter); +GCC_DIAG_OFF(missing-field-initializers); +#include "boost/python.hpp" +GCC_DIAG_ON(unused-parameter); +GCC_DIAG_ON(missing-field-initializers); +#include "PythonFitList.h" +#include "SquaredFunctionMeanSquaredError.pypp.h" + +namespace bp = boost::python; + +struct SquaredFunctionMeanSquaredError_wrapper : SquaredFunctionMeanSquaredError, bp::wrapper< SquaredFunctionMeanSquaredError > { + + SquaredFunctionMeanSquaredError_wrapper(SquaredFunctionMeanSquaredError const & arg ) + : SquaredFunctionMeanSquaredError( arg ) + , bp::wrapper< SquaredFunctionMeanSquaredError >(){ + // copy constructor + + } + + SquaredFunctionMeanSquaredError_wrapper( ) + : SquaredFunctionMeanSquaredError( ) + , bp::wrapper< SquaredFunctionMeanSquaredError >(){ + // null constructor + + } + + virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { + if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) + return func_calculateSquaredDifference( real_value, simulated_value ); + else + return this->SquaredFunctionMeanSquaredError::calculateSquaredDifference( real_value, simulated_value ); + } + + + double default_calculateSquaredDifference( double real_value, double simulated_value ) const { + return SquaredFunctionMeanSquaredError::calculateSquaredDifference( real_value, simulated_value ); + } + + virtual ::SquaredFunctionMeanSquaredError * clone( ) const { + if( bp::override func_clone = this->get_override( "clone" ) ) + return func_clone( ); + else + return this->SquaredFunctionMeanSquaredError::clone( ); + } + + + ::SquaredFunctionMeanSquaredError * default_clone( ) const { + return SquaredFunctionMeanSquaredError::clone( ); + } + + virtual double calculateSquaredError( double real_value, double simulated_value=0.0 ) const { + if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) + return func_calculateSquaredError( real_value, simulated_value ); + else + return this->ISquaredFunction::calculateSquaredError( real_value, simulated_value ); + } + + + double default_calculateSquaredError( double real_value, double simulated_value=0.0 ) const { + return ISquaredFunction::calculateSquaredError( real_value, simulated_value ); + } + +}; + +void register_SquaredFunctionMeanSquaredError_class(){ + + { //::SquaredFunctionMeanSquaredError + typedef bp::class_< SquaredFunctionMeanSquaredError_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionMeanSquaredError_exposer_t; + SquaredFunctionMeanSquaredError_exposer_t SquaredFunctionMeanSquaredError_exposer = SquaredFunctionMeanSquaredError_exposer_t( "SquaredFunctionMeanSquaredError", bp::init< >() ); + bp::scope SquaredFunctionMeanSquaredError_scope( SquaredFunctionMeanSquaredError_exposer ); + { //::SquaredFunctionMeanSquaredError::calculateSquaredDifference + + typedef double ( ::SquaredFunctionMeanSquaredError::*calculateSquaredDifference_function_type )( double,double ) const; + typedef double ( SquaredFunctionMeanSquaredError_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; + + SquaredFunctionMeanSquaredError_exposer.def( + "calculateSquaredDifference" + , calculateSquaredDifference_function_type(&::SquaredFunctionMeanSquaredError::calculateSquaredDifference) + , default_calculateSquaredDifference_function_type(&SquaredFunctionMeanSquaredError_wrapper::default_calculateSquaredDifference) + , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); + + } + { //::SquaredFunctionMeanSquaredError::clone + + typedef ::SquaredFunctionMeanSquaredError * ( ::SquaredFunctionMeanSquaredError::*clone_function_type )( ) const; + typedef ::SquaredFunctionMeanSquaredError * ( SquaredFunctionMeanSquaredError_wrapper::*default_clone_function_type )( ) const; + + SquaredFunctionMeanSquaredError_exposer.def( + "clone" + , clone_function_type(&::SquaredFunctionMeanSquaredError::clone) + , default_clone_function_type(&SquaredFunctionMeanSquaredError_wrapper::default_clone) + , bp::return_value_policy< bp::manage_new_object >() ); + + } + { //::ISquaredFunction::calculateSquaredError + + typedef double ( ::ISquaredFunction::*calculateSquaredError_function_type )( double,double ) const; + typedef double ( SquaredFunctionMeanSquaredError_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; + + SquaredFunctionMeanSquaredError_exposer.def( + "calculateSquaredError" + , calculateSquaredError_function_type(&::ISquaredFunction::calculateSquaredError) + , default_calculateSquaredError_function_type(&SquaredFunctionMeanSquaredError_wrapper::default_calculateSquaredError) + , ( bp::arg("real_value"), bp::arg("simulated_value")=0.0 ) ); + + } + } + +} diff --git a/Fit/PythonAPI/src/SquaredFunctionSystematicError.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionSystematicError.pypp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6db460c160a45c94d6bf50a7a6edc7a310d08fb --- /dev/null +++ b/Fit/PythonAPI/src/SquaredFunctionSystematicError.pypp.cpp @@ -0,0 +1,115 @@ +// This file has been generated by Py++. + +// BornAgain: simulate and fit scattering at grazing incidence +//! @brief automatically generated boost::python code for PythonCoreAPI + +#include "Macros.h" +GCC_DIAG_OFF(unused-parameter); +GCC_DIAG_OFF(missing-field-initializers); +#include "boost/python.hpp" +GCC_DIAG_ON(unused-parameter); +GCC_DIAG_ON(missing-field-initializers); +#include "PythonFitList.h" +#include "SquaredFunctionSystematicError.pypp.h" + +namespace bp = boost::python; + +struct SquaredFunctionSystematicError_wrapper : SquaredFunctionSystematicError, bp::wrapper< SquaredFunctionSystematicError > { + + SquaredFunctionSystematicError_wrapper(SquaredFunctionSystematicError const & arg ) + : SquaredFunctionSystematicError( arg ) + , bp::wrapper< SquaredFunctionSystematicError >(){ + // copy constructor + + } + + SquaredFunctionSystematicError_wrapper(double epsilon=8.000000000000000166533453693773481063544750213623046875e-2 ) + : SquaredFunctionSystematicError( epsilon ) + , bp::wrapper< SquaredFunctionSystematicError >(){ + // constructor + + } + + virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { + if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) + return func_calculateSquaredDifference( real_value, simulated_value ); + else + return this->SquaredFunctionSystematicError::calculateSquaredDifference( real_value, simulated_value ); + } + + + double default_calculateSquaredDifference( double real_value, double simulated_value ) const { + return SquaredFunctionSystematicError::calculateSquaredDifference( real_value, simulated_value ); + } + + virtual double calculateSquaredError( double real_value, double simulated_value=0.0 ) const { + if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) + return func_calculateSquaredError( real_value, simulated_value ); + else + return this->SquaredFunctionSystematicError::calculateSquaredError( real_value, simulated_value ); + } + + + double default_calculateSquaredError( double real_value, double simulated_value=0.0 ) const { + return SquaredFunctionSystematicError::calculateSquaredError( real_value, simulated_value ); + } + + virtual ::SquaredFunctionSystematicError * clone( ) const { + if( bp::override func_clone = this->get_override( "clone" ) ) + return func_clone( ); + else + return this->SquaredFunctionSystematicError::clone( ); + } + + + ::SquaredFunctionSystematicError * default_clone( ) const { + return SquaredFunctionSystematicError::clone( ); + } + +}; + +void register_SquaredFunctionSystematicError_class(){ + + { //::SquaredFunctionSystematicError + typedef bp::class_< SquaredFunctionSystematicError_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionSystematicError_exposer_t; + SquaredFunctionSystematicError_exposer_t SquaredFunctionSystematicError_exposer = SquaredFunctionSystematicError_exposer_t( "SquaredFunctionSystematicError", bp::init< bp::optional< double > >(( bp::arg("epsilon")=8.000000000000000166533453693773481063544750213623046875e-2 )) ); + bp::scope SquaredFunctionSystematicError_scope( SquaredFunctionSystematicError_exposer ); + { //::SquaredFunctionSystematicError::calculateSquaredDifference + + typedef double ( ::SquaredFunctionSystematicError::*calculateSquaredDifference_function_type )( double,double ) const; + typedef double ( SquaredFunctionSystematicError_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; + + SquaredFunctionSystematicError_exposer.def( + "calculateSquaredDifference" + , calculateSquaredDifference_function_type(&::SquaredFunctionSystematicError::calculateSquaredDifference) + , default_calculateSquaredDifference_function_type(&SquaredFunctionSystematicError_wrapper::default_calculateSquaredDifference) + , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); + + } + { //::SquaredFunctionSystematicError::calculateSquaredError + + typedef double ( ::SquaredFunctionSystematicError::*calculateSquaredError_function_type )( double,double ) const; + typedef double ( SquaredFunctionSystematicError_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; + + SquaredFunctionSystematicError_exposer.def( + "calculateSquaredError" + , calculateSquaredError_function_type(&::SquaredFunctionSystematicError::calculateSquaredError) + , default_calculateSquaredError_function_type(&SquaredFunctionSystematicError_wrapper::default_calculateSquaredError) + , ( bp::arg("real_value"), bp::arg("simulated_value")=0.0 ) ); + + } + { //::SquaredFunctionSystematicError::clone + + typedef ::SquaredFunctionSystematicError * ( ::SquaredFunctionSystematicError::*clone_function_type )( ) const; + typedef ::SquaredFunctionSystematicError * ( SquaredFunctionSystematicError_wrapper::*default_clone_function_type )( ) const; + + SquaredFunctionSystematicError_exposer.def( + "clone" + , clone_function_type(&::SquaredFunctionSystematicError::clone) + , default_clone_function_type(&SquaredFunctionSystematicError_wrapper::default_clone) + , bp::return_value_policy< bp::manage_new_object >() ); + + } + } + +} diff --git a/Fit/PythonAPI/src/SquaredFunctionWhichOnlyWorks.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionWhichOnlyWorks.pypp.cpp deleted file mode 100644 index 378918ee7ee2be818a1e7e61ee959902551042b7..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/src/SquaredFunctionWhichOnlyWorks.pypp.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#include "Macros.h" -GCC_DIAG_OFF(unused-parameter); -GCC_DIAG_OFF(missing-field-initializers); -#include "boost/python.hpp" -GCC_DIAG_ON(unused-parameter); -GCC_DIAG_ON(missing-field-initializers); -#include "PythonFitList.h" -#include "SquaredFunctionWhichOnlyWorks.pypp.h" - -namespace bp = boost::python; - -struct SquaredFunctionWhichOnlyWorks_wrapper : SquaredFunctionWhichOnlyWorks, bp::wrapper< SquaredFunctionWhichOnlyWorks > { - - SquaredFunctionWhichOnlyWorks_wrapper(SquaredFunctionWhichOnlyWorks const & arg ) - : SquaredFunctionWhichOnlyWorks( arg ) - , bp::wrapper< SquaredFunctionWhichOnlyWorks >(){ - // copy constructor - - } - - SquaredFunctionWhichOnlyWorks_wrapper( ) - : SquaredFunctionWhichOnlyWorks( ) - , bp::wrapper< SquaredFunctionWhichOnlyWorks >(){ - // null constructor - - } - - virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { - if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) - return func_calculateSquaredDifference( real_value, simulated_value ); - else - return this->SquaredFunctionWhichOnlyWorks::calculateSquaredDifference( real_value, simulated_value ); - } - - - double default_calculateSquaredDifference( double real_value, double simulated_value ) const { - return SquaredFunctionWhichOnlyWorks::calculateSquaredDifference( real_value, simulated_value ); - } - - virtual ::SquaredFunctionWhichOnlyWorks * clone( ) const { - if( bp::override func_clone = this->get_override( "clone" ) ) - return func_clone( ); - else - return this->SquaredFunctionWhichOnlyWorks::clone( ); - } - - - ::SquaredFunctionWhichOnlyWorks * default_clone( ) const { - return SquaredFunctionWhichOnlyWorks::clone( ); - } - - virtual double calculateSquaredError( double real_value, double simulated_value=0.0 ) const { - if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) - return func_calculateSquaredError( real_value, simulated_value ); - else - return this->ISquaredFunction::calculateSquaredError( real_value, simulated_value ); - } - - - double default_calculateSquaredError( double real_value, double simulated_value=0.0 ) const { - return ISquaredFunction::calculateSquaredError( real_value, simulated_value ); - } - -}; - -void register_SquaredFunctionWhichOnlyWorks_class(){ - - { //::SquaredFunctionWhichOnlyWorks - typedef bp::class_< SquaredFunctionWhichOnlyWorks_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionWhichOnlyWorks_exposer_t; - SquaredFunctionWhichOnlyWorks_exposer_t SquaredFunctionWhichOnlyWorks_exposer = SquaredFunctionWhichOnlyWorks_exposer_t( "SquaredFunctionWhichOnlyWorks", bp::init< >() ); - bp::scope SquaredFunctionWhichOnlyWorks_scope( SquaredFunctionWhichOnlyWorks_exposer ); - { //::SquaredFunctionWhichOnlyWorks::calculateSquaredDifference - - typedef double ( ::SquaredFunctionWhichOnlyWorks::*calculateSquaredDifference_function_type )( double,double ) const; - typedef double ( SquaredFunctionWhichOnlyWorks_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; - - SquaredFunctionWhichOnlyWorks_exposer.def( - "calculateSquaredDifference" - , calculateSquaredDifference_function_type(&::SquaredFunctionWhichOnlyWorks::calculateSquaredDifference) - , default_calculateSquaredDifference_function_type(&SquaredFunctionWhichOnlyWorks_wrapper::default_calculateSquaredDifference) - , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); - - } - { //::SquaredFunctionWhichOnlyWorks::clone - - typedef ::SquaredFunctionWhichOnlyWorks * ( ::SquaredFunctionWhichOnlyWorks::*clone_function_type )( ) const; - typedef ::SquaredFunctionWhichOnlyWorks * ( SquaredFunctionWhichOnlyWorks_wrapper::*default_clone_function_type )( ) const; - - SquaredFunctionWhichOnlyWorks_exposer.def( - "clone" - , clone_function_type(&::SquaredFunctionWhichOnlyWorks::clone) - , default_clone_function_type(&SquaredFunctionWhichOnlyWorks_wrapper::default_clone) - , bp::return_value_policy< bp::manage_new_object >() ); - - } - { //::ISquaredFunction::calculateSquaredError - - typedef double ( ::ISquaredFunction::*calculateSquaredError_function_type )( double,double ) const; - typedef double ( SquaredFunctionWhichOnlyWorks_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; - - SquaredFunctionWhichOnlyWorks_exposer.def( - "calculateSquaredError" - , calculateSquaredError_function_type(&::ISquaredFunction::calculateSquaredError) - , default_calculateSquaredError_function_type(&SquaredFunctionWhichOnlyWorks_wrapper::default_calculateSquaredError) - , ( bp::arg("real_value"), bp::arg("simulated_value")=0.0 ) ); - - } - } - -} diff --git a/Fit/PythonAPI/src/SquaredFunctionWithGaussianError.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionWithGaussianError.pypp.cpp deleted file mode 100644 index 6d869a72a869ab3957b46ac5c9d8a469bc25395d..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/src/SquaredFunctionWithGaussianError.pypp.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#include "Macros.h" -GCC_DIAG_OFF(unused-parameter); -GCC_DIAG_OFF(missing-field-initializers); -#include "boost/python.hpp" -GCC_DIAG_ON(unused-parameter); -GCC_DIAG_ON(missing-field-initializers); -#include "PythonFitList.h" -#include "SquaredFunctionWithGaussianError.pypp.h" - -namespace bp = boost::python; - -struct SquaredFunctionWithGaussianError_wrapper : SquaredFunctionWithGaussianError, bp::wrapper< SquaredFunctionWithGaussianError > { - - SquaredFunctionWithGaussianError_wrapper(SquaredFunctionWithGaussianError const & arg ) - : SquaredFunctionWithGaussianError( arg ) - , bp::wrapper< SquaredFunctionWithGaussianError >(){ - // copy constructor - - } - - SquaredFunctionWithGaussianError_wrapper(double sigma=1.00000000000000002081668171172168513294309377670288085938e-2 ) - : SquaredFunctionWithGaussianError( sigma ) - , bp::wrapper< SquaredFunctionWithGaussianError >(){ - // constructor - - } - - virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { - if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) - return func_calculateSquaredDifference( real_value, simulated_value ); - else - return this->SquaredFunctionWithGaussianError::calculateSquaredDifference( real_value, simulated_value ); - } - - - double default_calculateSquaredDifference( double real_value, double simulated_value ) const { - return SquaredFunctionWithGaussianError::calculateSquaredDifference( real_value, simulated_value ); - } - - virtual double calculateSquaredError( double arg0, double arg1 ) const { - if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) - return func_calculateSquaredError( arg0, arg1 ); - else - return this->SquaredFunctionWithGaussianError::calculateSquaredError( arg0, arg1 ); - } - - - double default_calculateSquaredError( double arg0, double arg1 ) const { - return SquaredFunctionWithGaussianError::calculateSquaredError( arg0, arg1 ); - } - - virtual ::SquaredFunctionWithGaussianError * clone( ) const { - if( bp::override func_clone = this->get_override( "clone" ) ) - return func_clone( ); - else - return this->SquaredFunctionWithGaussianError::clone( ); - } - - - ::SquaredFunctionWithGaussianError * default_clone( ) const { - return SquaredFunctionWithGaussianError::clone( ); - } - -}; - -void register_SquaredFunctionWithGaussianError_class(){ - - { //::SquaredFunctionWithGaussianError - typedef bp::class_< SquaredFunctionWithGaussianError_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionWithGaussianError_exposer_t; - SquaredFunctionWithGaussianError_exposer_t SquaredFunctionWithGaussianError_exposer = SquaredFunctionWithGaussianError_exposer_t( "SquaredFunctionWithGaussianError", bp::init< bp::optional< double > >(( bp::arg("sigma")=1.00000000000000002081668171172168513294309377670288085938e-2 )) ); - bp::scope SquaredFunctionWithGaussianError_scope( SquaredFunctionWithGaussianError_exposer ); - { //::SquaredFunctionWithGaussianError::calculateSquaredDifference - - typedef double ( ::SquaredFunctionWithGaussianError::*calculateSquaredDifference_function_type )( double,double ) const; - typedef double ( SquaredFunctionWithGaussianError_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; - - SquaredFunctionWithGaussianError_exposer.def( - "calculateSquaredDifference" - , calculateSquaredDifference_function_type(&::SquaredFunctionWithGaussianError::calculateSquaredDifference) - , default_calculateSquaredDifference_function_type(&SquaredFunctionWithGaussianError_wrapper::default_calculateSquaredDifference) - , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); - - } - { //::SquaredFunctionWithGaussianError::calculateSquaredError - - typedef double ( ::SquaredFunctionWithGaussianError::*calculateSquaredError_function_type )( double,double ) const; - typedef double ( SquaredFunctionWithGaussianError_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; - - SquaredFunctionWithGaussianError_exposer.def( - "calculateSquaredError" - , calculateSquaredError_function_type(&::SquaredFunctionWithGaussianError::calculateSquaredError) - , default_calculateSquaredError_function_type(&SquaredFunctionWithGaussianError_wrapper::default_calculateSquaredError) - , ( bp::arg("arg0"), bp::arg("arg1") ) ); - - } - { //::SquaredFunctionWithGaussianError::clone - - typedef ::SquaredFunctionWithGaussianError * ( ::SquaredFunctionWithGaussianError::*clone_function_type )( ) const; - typedef ::SquaredFunctionWithGaussianError * ( SquaredFunctionWithGaussianError_wrapper::*default_clone_function_type )( ) const; - - SquaredFunctionWithGaussianError_exposer.def( - "clone" - , clone_function_type(&::SquaredFunctionWithGaussianError::clone) - , default_clone_function_type(&SquaredFunctionWithGaussianError_wrapper::default_clone) - , bp::return_value_policy< bp::manage_new_object >() ); - - } - } - -} diff --git a/Fit/PythonAPI/src/SquaredFunctionWithSystematicError.pypp.cpp b/Fit/PythonAPI/src/SquaredFunctionWithSystematicError.pypp.cpp deleted file mode 100644 index 37b0378963542325d24c0bfba602a6189dff1f24..0000000000000000000000000000000000000000 --- a/Fit/PythonAPI/src/SquaredFunctionWithSystematicError.pypp.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// This file has been generated by Py++. - -// BornAgain: simulate and fit scattering at grazing incidence -//! @brief automatically generated boost::python code for PythonCoreAPI - -#include "Macros.h" -GCC_DIAG_OFF(unused-parameter); -GCC_DIAG_OFF(missing-field-initializers); -#include "boost/python.hpp" -GCC_DIAG_ON(unused-parameter); -GCC_DIAG_ON(missing-field-initializers); -#include "PythonFitList.h" -#include "SquaredFunctionWithSystematicError.pypp.h" - -namespace bp = boost::python; - -struct SquaredFunctionWithSystematicError_wrapper : SquaredFunctionWithSystematicError, bp::wrapper< SquaredFunctionWithSystematicError > { - - SquaredFunctionWithSystematicError_wrapper(SquaredFunctionWithSystematicError const & arg ) - : SquaredFunctionWithSystematicError( arg ) - , bp::wrapper< SquaredFunctionWithSystematicError >(){ - // copy constructor - - } - - SquaredFunctionWithSystematicError_wrapper(double epsilon=8.000000000000000166533453693773481063544750213623046875e-2 ) - : SquaredFunctionWithSystematicError( epsilon ) - , bp::wrapper< SquaredFunctionWithSystematicError >(){ - // constructor - - } - - virtual double calculateSquaredDifference( double real_value, double simulated_value ) const { - if( bp::override func_calculateSquaredDifference = this->get_override( "calculateSquaredDifference" ) ) - return func_calculateSquaredDifference( real_value, simulated_value ); - else - return this->SquaredFunctionWithSystematicError::calculateSquaredDifference( real_value, simulated_value ); - } - - - double default_calculateSquaredDifference( double real_value, double simulated_value ) const { - return SquaredFunctionWithSystematicError::calculateSquaredDifference( real_value, simulated_value ); - } - - virtual double calculateSquaredError( double real_value, double simulated_value=0.0 ) const { - if( bp::override func_calculateSquaredError = this->get_override( "calculateSquaredError" ) ) - return func_calculateSquaredError( real_value, simulated_value ); - else - return this->SquaredFunctionWithSystematicError::calculateSquaredError( real_value, simulated_value ); - } - - - double default_calculateSquaredError( double real_value, double simulated_value=0.0 ) const { - return SquaredFunctionWithSystematicError::calculateSquaredError( real_value, simulated_value ); - } - - virtual ::SquaredFunctionWithSystematicError * clone( ) const { - if( bp::override func_clone = this->get_override( "clone" ) ) - return func_clone( ); - else - return this->SquaredFunctionWithSystematicError::clone( ); - } - - - ::SquaredFunctionWithSystematicError * default_clone( ) const { - return SquaredFunctionWithSystematicError::clone( ); - } - -}; - -void register_SquaredFunctionWithSystematicError_class(){ - - { //::SquaredFunctionWithSystematicError - typedef bp::class_< SquaredFunctionWithSystematicError_wrapper, bp::bases< ISquaredFunction > > SquaredFunctionWithSystematicError_exposer_t; - SquaredFunctionWithSystematicError_exposer_t SquaredFunctionWithSystematicError_exposer = SquaredFunctionWithSystematicError_exposer_t( "SquaredFunctionWithSystematicError", bp::init< bp::optional< double > >(( bp::arg("epsilon")=8.000000000000000166533453693773481063544750213623046875e-2 )) ); - bp::scope SquaredFunctionWithSystematicError_scope( SquaredFunctionWithSystematicError_exposer ); - { //::SquaredFunctionWithSystematicError::calculateSquaredDifference - - typedef double ( ::SquaredFunctionWithSystematicError::*calculateSquaredDifference_function_type )( double,double ) const; - typedef double ( SquaredFunctionWithSystematicError_wrapper::*default_calculateSquaredDifference_function_type )( double,double ) const; - - SquaredFunctionWithSystematicError_exposer.def( - "calculateSquaredDifference" - , calculateSquaredDifference_function_type(&::SquaredFunctionWithSystematicError::calculateSquaredDifference) - , default_calculateSquaredDifference_function_type(&SquaredFunctionWithSystematicError_wrapper::default_calculateSquaredDifference) - , ( bp::arg("real_value"), bp::arg("simulated_value") ) ); - - } - { //::SquaredFunctionWithSystematicError::calculateSquaredError - - typedef double ( ::SquaredFunctionWithSystematicError::*calculateSquaredError_function_type )( double,double ) const; - typedef double ( SquaredFunctionWithSystematicError_wrapper::*default_calculateSquaredError_function_type )( double,double ) const; - - SquaredFunctionWithSystematicError_exposer.def( - "calculateSquaredError" - , calculateSquaredError_function_type(&::SquaredFunctionWithSystematicError::calculateSquaredError) - , default_calculateSquaredError_function_type(&SquaredFunctionWithSystematicError_wrapper::default_calculateSquaredError) - , ( bp::arg("real_value"), bp::arg("simulated_value")=0.0 ) ); - - } - { //::SquaredFunctionWithSystematicError::clone - - typedef ::SquaredFunctionWithSystematicError * ( ::SquaredFunctionWithSystematicError::*clone_function_type )( ) const; - typedef ::SquaredFunctionWithSystematicError * ( SquaredFunctionWithSystematicError_wrapper::*default_clone_function_type )( ) const; - - SquaredFunctionWithSystematicError_exposer.def( - "clone" - , clone_function_type(&::SquaredFunctionWithSystematicError::clone) - , default_clone_function_type(&SquaredFunctionWithSystematicError_wrapper::default_clone) - , bp::return_value_policy< bp::manage_new_object >() ); - - } - } - -} diff --git a/dev-tools/python-bindings/MakePyCore.py b/dev-tools/python-bindings/MakePyCore.py index da9eb1749fe8d78eacd4944cc34af3ac4689c476..d51f931a9b8b978b4efce5c4f935989d715efbd2 100644 --- a/dev-tools/python-bindings/MakePyCore.py +++ b/dev-tools/python-bindings/MakePyCore.py @@ -81,6 +81,7 @@ include_classes = [ "IObservable", "IParameterized", "IResolutionFunction2D", + "IntensityDataHelper", "ISample", "ISampleBuilder", #"SampleBuilder_t", diff --git a/dev-tools/python-bindings/MakePyFit.py b/dev-tools/python-bindings/MakePyFit.py index 7ce0aea3fbe37f038294535a041fd3b14c122391..ab49483985f00de5669e8127b5d9c396a8d4e800 100644 --- a/dev-tools/python-bindings/MakePyFit.py +++ b/dev-tools/python-bindings/MakePyFit.py @@ -50,9 +50,9 @@ include_classes = [ "OutputDataNormalizer", "OutputDataSimpleNormalizer", "SquaredFunctionDefault", - "SquaredFunctionWhichOnlyWorks", - "SquaredFunctionWithGaussianError", - "SquaredFunctionWithSystematicError", + "SquaredFunctionMeanSquaredError", + "SquaredFunctionGaussianError", + "SquaredFunctionSystematicError", ]